Skip to content

Commit

Permalink
feat(sdk-node): add override for addspanprocessor method
Browse files Browse the repository at this point in the history
Signed-off-by: Svetlana Brennan <[email protected]>
  • Loading branch information
svetlanabrennan committed Sep 27, 2022
1 parent 83febe8 commit a5c2d93
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { JaegerExporter } from '@opentelemetry/exporter-jaeger';
export class TracerProviderWithEnvExporters extends NodeTracerProvider {
private _configuredExporters: SpanExporter[] = [];
private _spanProcessors: SpanProcessor[] | undefined;
private _hasSpanProcessors: boolean = false;

static configureOtlp(): SpanExporter {
const protocol = this.getOtlpProtocol();
Expand Down Expand Up @@ -95,8 +96,13 @@ export class TracerProviderWithEnvExporters extends NodeTracerProvider {
}
}

override addSpanProcessor(spanProcessor: SpanProcessor) {
super.addSpanProcessor(spanProcessor);
this._hasSpanProcessors = true;
}

override register(config?: SDKRegistrationConfig) {
if (this._spanProcessors) {
if (this._hasSpanProcessors) {
super.register(config);
}
}
Expand Down

0 comments on commit a5c2d93

Please sign in to comment.