Skip to content

Commit

Permalink
fix: Change opentracing protocol (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
gleip authored Dec 20, 2023
1 parent 07e7688 commit 4798767
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,19 @@ export class Service<E extends Emitter = Emitter> 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();
}
Expand Down

0 comments on commit 4798767

Please sign in to comment.