Documentation
¶
Overview ¶
Package server_tracing provides HTTP server middleware for distributed tracing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ReadBytesKey = attribute.Key("http.read_bytes")
ReadBytesKey is the attribute key for the total number of bytes read from the request body.
View Source
var WroteBytesKey = attribute.Key("http.wrote_bytes")
WroteBytesKey is the attribute key for the total number of bytes written to the response.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Provider is the tracer provider used to create tracers.
Provider tracing.TracerProvider
// Propagator is the text map propagator for context propagation.
Propagator tracing.Propagator
}
Config holds the configuration for the HTTP server tracing middleware.
func (Config) Middleware ¶
func (c Config) Middleware() http2.Middleware
Middleware returns an HTTP server middleware that creates spans for incoming requests. It extracts trace context from request headers, creates a server span, and sets appropriate attributes including status code and request details. If the provider is a no-op, it returns a pass-through middleware.
Click to show internal directories.
Click to hide internal directories.