Skip to content

Commit

Permalink
Do not automatically add the BatchTraceSpanProcessor to the list of S…
Browse files Browse the repository at this point in the history
…panProcessors
  • Loading branch information
evanderkoogh committed Aug 28, 2023
1 parent 655f1b8 commit 7578ae2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Expand Up @@ -4,4 +4,5 @@ export * from './sdk.js'
export * from './span.js'
export * from './exporter.js'
export * from './multiexporter.js'
export * from './spanprocessor.js'
export type * from './types.js'
4 changes: 2 additions & 2 deletions src/sdk.ts
Expand Up @@ -72,9 +72,9 @@ function init(config: ResolvedTraceConfig): void {
instrumentGlobalFetch()
propagation.setGlobalPropagator(new W3CTraceContextPropagator())
const resource = createResource(config)
config.spanProcessors.push(new BatchTraceSpanProcessor())
const spanProcessors = Array.isArray(config.spanProcessors) ? config.spanProcessors : [config.spanProcessors]

const provider = new WorkerTracerProvider(config.spanProcessors, resource)
const provider = new WorkerTracerProvider(spanProcessors, resource)
provider.register()
initialised = true
}
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Expand Up @@ -35,7 +35,7 @@ export interface TraceConfig<EC extends ExporterConfig = ExporterConfig> {
postProcessor?: PostProcessorFn
sampling?: SamplingConfig
service: ServiceConfig
spanProcessors: SpanProcessor[]
spanProcessors: SpanProcessor | SpanProcessor[]
}

export interface ResolvedTraceConfig extends TraceConfig {
Expand All @@ -44,7 +44,7 @@ export interface ResolvedTraceConfig extends TraceConfig {
fetch: Required<FetcherConfig>
postProcessor: PostProcessorFn
sampling: Required<SamplingConfig<Sampler>>
spanProcessors: SpanProcessor[]
spanProcessors: SpanProcessor | SpanProcessor[]
}

export interface DOConstructorTrigger {
Expand Down

0 comments on commit 7578ae2

Please sign in to comment.