From d9ff9697c79ce930a74b1ecf42cd51b2aeeffdff Mon Sep 17 00:00:00 2001 From: Sergey Kuchin <3on.gleip@gmail.com> Date: Wed, 20 Dec 2023 14:11:29 +0300 Subject: [PATCH] fix: Change opentracing protocol --- src/Service.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Service.ts b/src/Service.ts index 2c062e2..5cd68b3 100644 --- a/src/Service.ts +++ b/src/Service.ts @@ -85,9 +85,19 @@ export class Service extends Root { [SemanticResourceAttributes.SERVICE_NAME]: this.options.name, }), }); - const exporter = new JaegerExporter({ - endpoint: this.getSettingFromEnv('OTEL_AGENT', false), - }); + + let host: string | undefined; + let port: number | undefined; + + const agentUrl = this.getSettingFromEnv('OTEL_AGENT', false); + + if (agentUrl) { + const agent = agentUrl.split(':'); + host = agent[0]; + port = parseInt(agent[1]) || undefined; + } + + const exporter = new JaegerExporter({ host, port }); provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); provider.register(); }