-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
225 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/Core/Application/Factories/OpenTelemetryCollectorFactoryInterface.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/Core/Application/Telemetry/OpenTelemetryCollectorInterface.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
namespace Webgrip\TelemetryService\Core\Application; | ||
|
||
use DI\Container; | ||
use GuzzleHttp\Client; | ||
use OpenTelemetry\SDK\Common\Attribute\Attributes; | ||
use OpenTelemetry\SDK\Resource\ResourceInfo; | ||
use OpenTelemetry\SemConv\ResourceAttributes; | ||
use Psr\Container\ContainerInterface; | ||
use Psr\Log\LoggerInterface; | ||
use Webgrip\TelemetryService\Core\Application\Factories\LoggerProviderFactoryInterface; | ||
use Webgrip\TelemetryService\Core\Application\Factories\TelemetryServiceFactoryInterface; | ||
use Webgrip\TelemetryService\Core\Application\Factories\TracerProviderFactoryInterface; | ||
use Webgrip\TelemetryService\Core\Domain\Services\TelemetryServiceInterface; | ||
use Webgrip\TelemetryService\Infrastructure\Factories\LoggerProviderFactory; | ||
use Webgrip\TelemetryService\Infrastructure\Factories\TelemetryServiceFactory; | ||
use Webgrip\TelemetryService\Infrastructure\Factories\TracerProviderFactory; | ||
|
||
readonly class TelemetryServiceProvider | ||
{ | ||
/** | ||
* @param ContainerInterface $configuration | ||
*/ | ||
public function __construct( | ||
private ContainerInterface $configuration | ||
) | ||
{ | ||
} | ||
|
||
/** | ||
* @param Container $container | ||
* @return void | ||
*/ | ||
public function register(Container $container): void | ||
{ | ||
$configuration = $this->configuration; | ||
|
||
$container->set(ResourceInfo::class, function (Container $container) use ($configuration) { | ||
return ResourceInfo::create( | ||
Attributes::create([ | ||
ResourceAttributes::DEPLOYMENT_ENVIRONMENT_NAME => $configuration->get('applicationEnvironmentName'), | ||
ResourceAttributes::SERVICE_NAMESPACE => $configuration->get('applicationNamespace'), | ||
ResourceAttributes::SERVICE_NAME => $configuration->get('applicationName'), | ||
ResourceAttributes::SERVICE_VERSION => $configuration->get('applicationVersion'), | ||
]) | ||
); | ||
}); | ||
|
||
$container->set(LoggerProviderFactoryInterface::class, function (Container $container) use ($configuration) { | ||
return new LoggerProviderFactory( | ||
$configuration | ||
); | ||
}); | ||
|
||
$container->set(TracerProviderFactoryInterface::class, function (Container $container) use ($configuration) { | ||
return new TracerProviderFactory( | ||
$configuration | ||
); | ||
}); | ||
|
||
$container->set(TelemetryServiceFactoryInterface::class, function (Container $container) { | ||
return new TelemetryServiceFactory( | ||
$container->get(LoggerProviderFactoryInterface::class), | ||
$container->get(TracerProviderFactoryInterface::class), | ||
$container->get(Client::class) | ||
); | ||
}); | ||
|
||
$container->set(TelemetryServiceInterface::class, function (Container $container) use ($configuration) { | ||
return $container->get(TelemetryServiceFactoryInterface::class)->create( | ||
$configuration, | ||
$container->get(LoggerInterface::class) | ||
); | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
src/Infrastructure/Factories/OpenTelemetryCollectorFactory.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.