Documentation ¶
Index ¶
- Constants
- func ConstructNewSpanContext(ctx context.Context) trace.SpanContext
- func GenerateSpanIDRaw() []byte
- func GenerateSpanIDString() string
- func GenerateTraceIDRaw() []byte
- func GenerateTraceIDString() string
- func HTTPMiddleware(next http.Handler) http.Handler
- func Module(serviceName string) fx.Option
- func NewGRPCClient(collectorURI string, options ...otlptracegrpc.Option) otlptrace.Client
- func NewGlobalTracerProvider(serviceName string, spanExporter sdk.SpanExporter, ...)
- func NewHTTPClient(collectorURI string, options ...otlptracehttp.Option) otlptrace.Client
- func NewTraceSpanExporter(ctx context.Context, client otlptrace.Client) (tracesdk.SpanExporter, error)
- type SpanID
- type TraceID
Constants ¶
View Source
const ( TraceIDKey = "x-trace-id" SpanIDKey = "x-span-id" )
Variables ¶
This section is empty.
Functions ¶
func ConstructNewSpanContext ¶
func ConstructNewSpanContext(ctx context.Context) trace.SpanContext
ConstructNewSpanContext helper function to inject in open telemetry refid from context
func GenerateSpanIDRaw ¶
func GenerateSpanIDRaw() []byte
func GenerateSpanIDString ¶
func GenerateSpanIDString() string
func GenerateTraceIDRaw ¶
func GenerateTraceIDRaw() []byte
func GenerateTraceIDString ¶
func GenerateTraceIDString() string
func HTTPMiddleware ¶
HTTPMiddleware Assume that spanID and TraceID already in ctx Example:
h := refid.HTTPMiddleware(tracing.HTTPMiddleware(otelhttp.NewHandler(s.newRouter(), "app-test", otelhttp.WithTracerProvider(otel.GetTracerProvider()), otelhttp.WithPropagators(propagation.TraceContext{}), )))
func NewGRPCClient ¶
func NewGRPCClient(collectorURI string, options ...otlptracegrpc.Option) otlptrace.Client
NewGRPCClient create new open telemetry tracing grpc client
func NewGlobalTracerProvider ¶
func NewGlobalTracerProvider( serviceName string, spanExporter sdk.SpanExporter, providerOpts ...sdk.TracerProviderOption, )
func NewHTTPClient ¶
func NewHTTPClient(collectorURI string, options ...otlptracehttp.Option) otlptrace.Client
NewHTTPClient create new open telemetry tracing http client
func NewTraceSpanExporter ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.