OPENTELEMETRY_HOST -> OPENTELEMETRY_ENDPOINT

This commit is contained in:
Andrew Dolgov 2023-10-20 21:27:10 +03:00
parent 62ca093b75
commit 7092a1e85d
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
2 changed files with 5 additions and 5 deletions

View File

@ -193,7 +193,7 @@ class Config {
const HTTP_429_THROTTLE_INTERVAL = "HTTP_429_THROTTLE_INTERVAL"; const HTTP_429_THROTTLE_INTERVAL = "HTTP_429_THROTTLE_INTERVAL";
/** host running Jaeger collector to receive traces (disabled if empty) */ /** host running Jaeger collector to receive traces (disabled if empty) */
const OPENTELEMETRY_HOST = "OPENTELEMETRY_HOST"; const OPENTELEMETRY_ENDPOINT = "OPENTELEMETRY_ENDPOINT";
/** Jaeger service name */ /** Jaeger service name */
const OPENTELEMETRY_SERVICE = "OPENTELEMETRY_SERVICE"; const OPENTELEMETRY_SERVICE = "OPENTELEMETRY_SERVICE";
@ -255,7 +255,7 @@ class Config {
Config::HTTP_USER_AGENT => [ 'Tiny Tiny RSS/%s (https://tt-rss.org/)', Config::HTTP_USER_AGENT => [ 'Tiny Tiny RSS/%s (https://tt-rss.org/)',
Config::T_STRING ], Config::T_STRING ],
Config::HTTP_429_THROTTLE_INTERVAL => [ 3600, Config::T_INT ], Config::HTTP_429_THROTTLE_INTERVAL => [ 3600, Config::T_INT ],
Config::OPENTELEMETRY_HOST => [ "", Config::T_STRING ], Config::OPENTELEMETRY_ENDPOINT => [ "", Config::T_STRING ],
Config::OPENTELEMETRY_SERVICE => [ "tt-rss", Config::T_STRING ], Config::OPENTELEMETRY_SERVICE => [ "tt-rss", Config::T_STRING ],
]; ];

View File

@ -16,10 +16,10 @@ class Tracer {
private static $tracer; private static $tracer;
public function __construct() { public function __construct() {
$opentelemetry_host = Config::get(Config::OPENTELEMETRY_HOST); $OPENTELEMETRY_ENDPOINT = Config::get(Config::OPENTELEMETRY_ENDPOINT);
if ($opentelemetry_host) { if ($OPENTELEMETRY_ENDPOINT) {
$transport = (new OtlpHttpTransportFactory())->create("http://$opentelemetry_host/v1/traces", 'application/x-protobuf'); $transport = (new OtlpHttpTransportFactory())->create($OPENTELEMETRY_ENDPOINT, 'application/x-protobuf');
$exporter = new SpanExporter($transport); $exporter = new SpanExporter($transport);
} else { } else {
$exporter = new InMemoryExporter(); $exporter = new InMemoryExporter();