Skip to content

Commit

Permalink
Fix manual sampler and environment exporter case.
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonWeber committed Jan 15, 2024
1 parent f0df5c6 commit a7bc759
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions experimental/packages/opentelemetry-sdk-node/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export class NodeSDK {
* Call this method to construct SDK components and register them with the OpenTelemetry API.
*/
public start(): void {
const env = getEnv();
if (this._disabled) {
return;
}
Expand All @@ -326,9 +327,14 @@ export class NodeSDK {
})
);

const Provider = this._tracerProviderConfig
? NodeTracerProvider
: TracerProviderWithEnvExporters;
// if there is a defined tracerProviderConfig, the traces exporter is defined and not none and there is no traceExporter defined in manual config
const Provider =
this._tracerProviderConfig &&
!env.OTEL_TRACES_EXPORTER &&
env.OTEL_TRACES_EXPORTER !== 'none' &&
!this._tracerProviderConfig.spanProcessor
? NodeTracerProvider
: TracerProviderWithEnvExporters;

const tracerProvider = new Provider({
...this._tracerProviderConfig?.tracerConfig,
Expand Down

0 comments on commit a7bc759

Please sign in to comment.