github.com/songzhibin97/gkit@v1.2.13/trace/option.go (about)

     1  package trace
     2  
     3  import (
     4  	"github.com/songzhibin97/gkit/options"
     5  	"go.opentelemetry.io/otel/propagation"
     6  	"go.opentelemetry.io/otel/trace"
     7  )
     8  
     9  type config struct {
    10  	tracerProvider trace.TracerProvider
    11  	propagator     propagation.TextMapPropagator
    12  }
    13  
    14  // WithPropagator with tracer propagator.
    15  func WithPropagator(propagator propagation.TextMapPropagator) options.Option {
    16  	return func(o interface{}) {
    17  		o.(*config).propagator = propagator
    18  	}
    19  }
    20  
    21  // WithTracerProvider with tracer provider.
    22  func WithTracerProvider(provider trace.TracerProvider) options.Option {
    23  	return func(o interface{}) {
    24  		o.(*config).tracerProvider = provider
    25  	}
    26  }