Skip to content

Commit

Permalink
fixing quoteservice metrics exporting (open-telemetry#793)
Browse files Browse the repository at this point in the history
* fixing quoteservice metrics exporting
metrics exporting was quietly failing due to misconfiguration. Update some packages
to pick up the relevant bugfix, and use OTEL_EXPORTER_OTLP_ENDPOINT so that metrics,
traces and eventually logs can use it.
In passing, enable some logging which makes future errors more obvious.

* changelog

* Update CHANGELOG.md

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>

* fixing changelog link

* update to latest api with warning fixed

---------

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
  • Loading branch information
2 people authored and mat-rumian committed Mar 20, 2023
1 parent f8c2d16 commit e377bda
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,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
Expand Down
10 changes: 8 additions & 2 deletions src/quoteservice/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -21,5 +22,10 @@
"psr-4": {
"App\\": "src/"
}
},
"config": {
"allow-plugins": {
"php-http/discovery": false
}
}
}
8 changes: 8 additions & 0 deletions src/quoteservice/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit e377bda

Please sign in to comment.