Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Jan 13, 2025
1 parent 4acf12d commit d209457
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 86 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
}
],
"require": {
"monolog/monolog": "^3.0",
"nyholm/dsn": "^2.0",
"nyholm/psr7": "^1.5",
"open-telemetry/sdk": "^1.1",
"psr/http-client": "^1.0",
"symfony/dependency-injection": "*"
},
"require-dev": {
Expand All @@ -40,6 +36,10 @@
"symfony/twig-bundle": "*",
"worldia/coding-standards": "^1.0"
},
"suggest": {
"open-telemetry/exporter-otlp": "To export telemetry data to an OTLP compatible ingester (Jaeger, Tempo, Loki, etc.)",
"symfony/monolog-bundle": "To enable open-telemetry logging"
},
"autoload": {
"psr-4": {
"Instrumentation\\": "src/"
Expand Down
5 changes: 5 additions & 0 deletions src/DependencyInjection/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Instrumentation\Tracing\Bridge\TraceUrlGeneratorInterface;
use Instrumentation\Tracing\Doctrine\Instrumentation\DBAL\Middleware as InstrumentationMiddleware;
use Instrumentation\Tracing\Doctrine\Propagation\DBAL\Middleware as PropagationMiddleware;
use Symfony\Bundle\MonologBundle\MonologBundle;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -188,6 +189,10 @@ protected function loadTracing(array $config, ContainerBuilder $container): void
*/
protected function loadLogging(array $config, ContainerBuilder $container): void
{
if (!class_exists(MonologBundle::class)) {
throw new \InvalidArgumentException('Logging requires "symfony/monolog-bundle". Did you forget to add it?');
}

$loader = $this->getLoader('logging', $container);

$loader->load('logging.php');
Expand Down
3 changes: 1 addition & 2 deletions src/Semantics/Attribute/ClientRequestAttributeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Instrumentation\Semantics\Attribute;

use Instrumentation\Tracing\HttpClient\HttpSensitiveDataHelper;
use OpenTelemetry\SemConv\TraceAttributes;

class ClientRequestAttributeProvider implements ClientRequestAttributeProviderInterface
Expand All @@ -25,7 +24,7 @@ public function getAttributes(string $method, string $url, array $headers = []):
{
$attributes = [
TraceAttributes::HTTP_REQUEST_METHOD => strtoupper($method),
TraceAttributes::URL_FULL => HttpSensitiveDataHelper::filterUrl($url),
TraceAttributes::URL_FULL => preg_replace('|(^https?://(?:.*):)(?:.*)(@.*)|', '$1<redacted>$2', $url),
];

foreach ($this->capturedHeaders as $header) {
Expand Down
33 changes: 0 additions & 33 deletions src/Tracing/HttpClient/HttpMessageHelper.php

This file was deleted.

47 changes: 0 additions & 47 deletions src/Tracing/HttpClient/HttpSensitiveDataHelper.php

This file was deleted.

0 comments on commit d209457

Please sign in to comment.