otelaccesslog

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(next http.Handler) http.Handler

Middleware wraps a http.Handler so it's request uri is added to the trace.Span derived from the http.Request's context. This is a workaround for https://github.com/open-telemetry/opentelemetry-go/commit/7b749591320bfcdef2061f4d4f5aa533ab76b47f

func NewExporter

func NewExporter(log accesslog.Logger) tracesdk.SpanExporter

NewExporter creates a new otel SpanExporter which, when added to an otel provider, sends accesslog.Details derived from trace.SpanKindServer spans, to the provided accesslog.Logger.

logger := accesslog.DefaultLogger(nil)
tracer := tracesdk.NewTraceProvider(
	tracesdk.WithBatcher(otelaccesslog.NewExporter(logger)),
)

func SetHandlerName added in v0.2.0

func SetHandlerName(ctx context.Context, name string)

func WithHandlerName

func WithHandlerName(name string, next http.Handler) http.Handler

WithHandlerName adds name as value to the http.Request's context. It should be used on a per route/handler basis.

Types

This section is empty.

Jump to

Keyboard shortcuts

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