Skip to content

Commit

Permalink
collector/batch processor: honor TracerProvider from cfg (#238)
Browse files Browse the repository at this point in the history
If there's a custom TracerProvider set in config, use that. Otherwise,
fall back to the global otel provider.
  • Loading branch information
gdvalle authored Jul 30, 2024
1 parent 8dc843d commit 1a301f7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,14 @@ func newBatchProcessor(set processor.Settings, cfg *Config, batchFunc func() bat
mks[i] = strings.ToLower(k)
}
sort.Strings(mks)

limitBytes := int64(cfg.MaxInFlightSizeMiB) << 20

tp := set.TelemetrySettings.TracerProvider
if tp == nil {
tp = otel.GetTracerProvider()
}

bp := &batchProcessor{
logger: set.Logger,

Expand All @@ -183,7 +190,7 @@ func newBatchProcessor(set processor.Settings, cfg *Config, batchFunc func() bat
metadataLimit: int(cfg.MetadataCardinalityLimit),
limitBytes: limitBytes,
sem: semaphore.NewWeighted(limitBytes),
tracer: otel.GetTracerProvider(),
tracer: tp,
}
if len(bp.metadataKeys) == 0 {
bp.batcher = &singleShardBatcher{batcher: bp.newShard(nil)}
Expand Down

0 comments on commit 1a301f7

Please sign in to comment.