micro-tracer-otel/options.go
Vasiliy Tolstov 39aa3ccb5a fix Provider option
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-08-16 08:12:36 +03:00

26 lines
589 B
Go

package otel
import (
tracesdk "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/trace"
"go.unistack.org/micro/v3/tracer"
)
type providerKey struct{}
func Provider(tp *tracesdk.TracerProvider) tracer.Option {
return tracer.SetOption(providerKey{}, tp)
}
type providerOptionsKey struct{}
func ProviderOptions(opts ...tracesdk.TracerProviderOption) tracer.Option {
return tracer.SetOption(providerOptionsKey{}, opts)
}
type tracerOptionsKey struct{}
func TracerOptions(opts ...trace.TracerOption) tracer.Option {
return tracer.SetOption(tracerOptionsKey{}, opts)
}