otel

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleWare

func NewMiddleWare(service string, options ...Option) func(http.Handler) http.Handler

NewMiddleWare creates a MiddleWare that provides OpenTelemetry Parameter service should describe the name of the (virtual) server handling the request. The OTelMiddleWare can be configured using the provided Options.

Types

type Filter

type Filter func(*http.Request) bool

Filter returns true if the request should be traced.

type Handler

type Handler struct {
	http.Handler
}

Handler implements the http.Handler interface and provides trace and metrics to beego web apps.

func (*Handler) ServeHTTP

func (o *Handler) ServeHTTP(rr http.ResponseWriter, req *http.Request)

ServerHTTP calls the configured handler to serve HTTP for req to rr.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option applies a configuration to the given config.

func WithFilter

func WithFilter(f Filter) Option

WithFilter adds the given filter for use in the middleware. Defaults to no filters.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter. If none is specified, the global provider is used.

func WithPropagators

func WithPropagators(propagators propagation.TextMapPropagator) Option

WithPropagators sets the propagators used in the middleware. Defaults to global.Propagators().

func WithSpanNameFormatter

func WithSpanNameFormatter(f SpanNameFormatter) Option

WithSpanNameFormatter sets the formatter to be used to format span names. Defaults to the path template.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.

type SpanNameFormatter

type SpanNameFormatter func(operation string, req *http.Request) string

SpanNameFormatter creates a custom span name from the operation and request object.

Jump to

Keyboard shortcuts

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