Documentation ¶
Index ¶
- Constants
- Variables
- func GetOtelTracer(ctx context.Context) trace.Tracer
- func Middleware(service string, opts ...Option) func(next http.Handler) http.Handler
- func OtelClientTrace(next http.RoundTripper) http.RoundTripper
- func WithAttributes(attr ...attribute.KeyValue) []attribute.KeyValue
- func WithOtelTracer(ctx context.Context, tracer trace.Tracer) context.Context
- type ClientTraceOption
- type ClientTraceOptions
- type ClientTracer
- type Option
- type RoundTripperFunc
- type ServiceTraceOption
- type ServiceTraceOptions
- type ServiceTracer
Constants ¶
const (
MuxRouteKey = attribute.Key("mux.routes")
)
Variables ¶
var ( //ClientName is a trace attribute for the service name ClientName = semconv.PeerServiceKey )
var OtelTracingMiddleware = func(name string) func(next http.Handler) http.Handler { return Middleware(name) }
Functions ¶
func Middleware ¶ added in v0.4.0
Middleware sets up a handler to start tracing the incoming requests. The service parameter should describe the name of the (virtual) server handling the request.
func OtelClientTrace ¶ added in v0.4.0
func OtelClientTrace(next http.RoundTripper) http.RoundTripper
OtelClientTrace adds tracing functionality to an http client (espressed as a roundtripper for api consistency)
func WithAttributes ¶
WithAttributes collects attributes into a attribute slice
Types ¶
type ClientTraceOption ¶
type ClientTraceOption func(*ClientTraceOptions)
ClientTraceOption
func WithClientTracer ¶
func WithClientTracer(tr trace.Tracer) ClientTraceOption
WithClientTracer sets a specific tracer to be uses
type ClientTraceOptions ¶
type ClientTraceOptions struct {
// contains filtered or unexported fields
}
ClientTraceOptions
type ClientTracer ¶
type ClientTracer interface { StartSpan(ctx context.Context, spanName string, attrs []attribute.KeyValue, opts ...trace.SpanOption) (context.Context, trace.Span) EndSpan(span trace.Span) AnnotateWithClientTrace(ctx context.Context) context.Context }
ClientTracer allows tracing of blaze services
func NewClientTracer ¶
func NewClientTracer(opts ...ClientTraceOption) ClientTracer
NewClientTracer creates a new tracer
type Option ¶ added in v0.4.0
type Option func(*config)
Option specifies instrumentation configuration options.
func WithPropagators ¶ added in v0.4.0
func WithPropagators(propagators propagation.TextMapPropagator) Option
WithPropagators specifies propagators to use for extracting information from the HTTP requests. If none are specified, global ones will be used.
func WithTracerProvider ¶ added in v0.4.0
func WithTracerProvider(provider oteltrace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.
type RoundTripperFunc ¶ added in v0.4.0
The RoundTripperFunc type is an adapter to allow the use of ordinary functions as RoundTrippers. If f is a function with the appropriate signature, RountTripperFunc(f) is a RoundTripper that calls f.
type ServiceTraceOption ¶
type ServiceTraceOption func(*ServiceTraceOptions)
ServiceTraceOption
func WithInjectTracerFunction ¶ added in v0.4.0
func WithInjectTracerFunction(itf func(ctx context.Context) context.Context) ServiceTraceOption
WithInjectTracerFunction sets a specific inject tracer function
func WithTracer ¶
func WithTracer(tr trace.Tracer) ServiceTraceOption
WithTracer sets a specific tracer to be uses
func WithTracingMiddleware ¶ added in v0.4.0
func WithTracingMiddleware(tmw func(string) func(next http.Handler) http.Handler) ServiceTraceOption
WithTracingMiddleware sets a specific tracing middleware
type ServiceTraceOptions ¶
type ServiceTraceOptions struct {
// contains filtered or unexported fields
}
ServiceTraceOptions
type ServiceTracer ¶
type ServiceTracer interface { InjectTracer(ctx context.Context) context.Context TracingMiddleware(service string) func(next http.Handler) http.Handler StartSpan(ctx context.Context, spanName string, attrs []attribute.KeyValue, opts ...trace.SpanOption) (context.Context, trace.Span) EndSpan(span trace.Span) }
ServiceTracer allows tracing of blaze services
func NewServiceTracer ¶
func NewServiceTracer(opts ...ServiceTraceOption) ServiceTracer
NewServiceTracer