Documentation
¶
Index ¶
- func CurrentSpanFromContext(ctx context.Context) trace.Span
- func NewPropagatingRoundTripper(rt http.RoundTripper) http.RoundTripper
- func TagsFromContext(ctx context.Context) []attribute.KeyValue
- func Trace(ctx context.Context, op string, ...) (err error)
- func TraceWithResult[T any](ctx context.Context, op string, ...) (result T, err error)
- func Tracing(service string, op string) startup_http.HttpMiddleware
- func WithServiceOverride(ctx context.Context, service string) context.Context
- func WithSpanPropagation(client *http.Client) *http.Client
- func WithTags(ctx context.Context, tags map[string]string) context.Context
- type TracingOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentSpanFromContext ¶ added in v2.2.19
CurrentSpanFromContext returns the current span, or nil if there is no active span.
func NewPropagatingRoundTripper ¶
func NewPropagatingRoundTripper(rt http.RoundTripper) http.RoundTripper
func TagsFromContext ¶ added in v2.2.136
TagsFromContext extracts tags stored in the context as OTel attributes.
func TraceWithResult ¶ added in v2.2.113
func TraceWithResult[T any](ctx context.Context, op string, fn func(ctx context.Context, span trace.Span) (T, error)) (result T, err error)
TraceWithResult traces a child call while propagating the span using the context.
func Tracing ¶
func Tracing(service string, op string) startup_http.HttpMiddleware
Tracing returns a middleware that adds tracing to an http handler.
func WithServiceOverride ¶ added in v2.2.136
WithServiceOverride adds service override tags to the context. See WithTags
func WithSpanPropagation ¶
WithSpanPropagation returns a new http.Client that has automatic propagation of trace context enabled.
Types ¶
type TracingOptions ¶
type TracingOptions struct {
HttpEndpoint string `long:"otlp-trace-endpoint-http" validate:"omitempty" description:"OTLP HTTP endpoint for traces, e.g. localhost:4318"`
Inputs struct {
// The service name of your application
ServiceName string `validate:"required"`
}
// contains filtered or unexported fields
}
func (*TracingOptions) Initialize ¶
func (opts *TracingOptions) Initialize()
func (*TracingOptions) IsActive ¶
func (opts *TracingOptions) IsActive() bool
Click to show internal directories.
Click to hide internal directories.