Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #49 from krotscheck/feature/custom_generator
Browse files Browse the repository at this point in the history
Permit setting a custom ID generator
  • Loading branch information
oppegard authored Sep 14, 2021
2 parents 3a6c7fc + 18f8eca commit 8fdb6ef
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ func WithSampler(sampler Sampler) Option {
}
}

// WithGenerator configures Tracer to use a custom trace id generator implementation.
func WithGenerator(generator Generator) Option {
return func(t *WavefrontTracer) {
t.generator = generator
}
}

// WithJaegerPropagator configures Tracer to use Jaeger trace context propagation.
func WithJaegerPropagator(traceId, baggagePrefix string) Option {
return func(args *WavefrontTracer) {
Expand All @@ -74,15 +81,13 @@ func WithJaegerPropagator(traceId, baggagePrefix string) Option {

// WithW3CGenerator configures Tracer to generate Trace and Span IDs according to W3C spec.
func WithW3CGenerator() Option {
return func(t *WavefrontTracer) {
t.generator = NewGeneratorW3C()
}
return WithGenerator(NewGeneratorW3C())
}

// WithW3CPropagator configures Tracer to use trace context propagation according to W3C spec.
func WithW3CPropagator() Option {
return func(t *WavefrontTracer) {
// implies W3C Generator
// implies W3C Generator. Custom ID generators should use WithGenerator after this option.
t.generator = NewGeneratorW3C()
t.textPropagator = NewPropagatorW3C()
}
Expand Down

0 comments on commit 8fdb6ef

Please sign in to comment.