blazetrace

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MuxRouteKey = attribute.Key("mux.routes")
)

Variables

View Source
var (
	//ClientName is a trace attribute for the service name
	ClientName = semconv.PeerServiceKey
)
View Source
var OtelTracingMiddleware = func(name string) func(next http.Handler) http.Handler {
	return Middleware(name)
}

Functions

func GetOtelTracer added in v0.4.0

func GetOtelTracer(ctx context.Context) trace.Tracer

func Middleware added in v0.4.0

func Middleware(service string, opts ...Option) func(next http.Handler) http.Handler

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

func WithAttributes(attr ...attribute.KeyValue) []attribute.KeyValue

WithAttributes collects attributes into a attribute slice

func WithOtelTracer added in v0.4.0

func WithOtelTracer(ctx context.Context, tracer trace.Tracer) context.Context

WithOtelTracer adds the tracer to the context

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

type RoundTripperFunc func(req *http.Request) (*http.Response, error)

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.

func (RoundTripperFunc) RoundTrip added in v0.4.0

func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL