diff --git a/CHANGELOG.md b/CHANGELOG.md index 2911de4765..27d39bb0a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -273,3 +273,5 @@ significant modifications will be credited to OpenTelemetry Authors. ([#764](https://github.com/open-telemetry/opentelemetry-demo/pull/764)) * [chore] align memory limits with Helm chart ([#781](https://github.com/open-telemetry/opentelemetry-demo/pull/781)) +* [bug] fixing quoteservice metrics exporting (PHP) + ([#793](https://github.com/open-telemetry/opentelemetry-demo/pull/793)) diff --git a/docker-compose.yml b/docker-compose.yml index 26d8a72842..c66669a00f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -456,7 +456,7 @@ services: ports: - "${QUOTE_SERVICE_PORT}" environment: - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:4318/v1/traces + - OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:4318 - OTEL_PHP_AUTOLOAD_ENABLED=true - QUOTE_SERVICE_PORT - OTEL_RESOURCE_ATTRIBUTES diff --git a/src/quoteservice/composer.json b/src/quoteservice/composer.json index a1edfc3bca..c598465f8a 100644 --- a/src/quoteservice/composer.json +++ b/src/quoteservice/composer.json @@ -7,8 +7,9 @@ "php": ">= 8.2", "ext-json": "*", "monolog/monolog": "2.8.0", - "open-telemetry/sdk": "1.0.0beta1", - "open-telemetry/exporter-otlp": "1.0.0beta1", + "open-telemetry/api": "1.0.0beta4", + "open-telemetry/sdk": "1.0.0beta3", + "open-telemetry/exporter-otlp": "1.0.0beta3", "open-telemetry/opentelemetry-auto-slim": "1.0.0beta4", "guzzlehttp/guzzle": "7.4.5", "php-di/php-di": "6.4.0", @@ -21,5 +22,10 @@ "psr-4": { "App\\": "src/" } + }, + "config": { + "allow-plugins": { + "php-http/discovery": false + } } } diff --git a/src/quoteservice/public/index.php b/src/quoteservice/public/index.php index f0150d576d..36aa1e1642 100644 --- a/src/quoteservice/public/index.php +++ b/src/quoteservice/public/index.php @@ -17,10 +17,18 @@ use DI\Bridge\Slim\Bridge; use DI\ContainerBuilder; +use Monolog\Handler\StreamHandler; +use Monolog\Logger; +use OpenTelemetry\API\Common\Log\LoggerHolder; +use Psr\Log\LogLevel; use Slim\Factory\AppFactory; require __DIR__ . '/../vendor/autoload.php'; +LoggerHolder::set( + new Logger('otel-php', [new StreamHandler('php://stdout', LogLevel::DEBUG)]) +); + // Instantiate PHP-DI ContainerBuilder $containerBuilder = new ContainerBuilder();