Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing quoteservice metrics exporting #793

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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