Documentation
¶
Overview ¶
Package httpconv exposes free-function constructors for OpenTelemetry HTTP span attributes.
Upstream go.opentelemetry.io/otel/semconv/v1.40.0/httpconv packages its attributes as methods on instrument structs (metric-scoped). This package lifts upstream's typed enums into span-ready attribute.KeyValue pairs and exposes the HTTP attribute keys SDKs commonly set on client spans. For metrics, use upstream directly.
Index ¶
- Constants
- Variables
- func RequestMethod(v upstream.RequestMethodAttr) attribute.KeyValue
- func RequestMethodRaw(v string) attribute.KeyValue
- func ResponseStatusCode(v int) attribute.KeyValue
- func Route(v string) attribute.KeyValue
- func ServerAddress(v string) attribute.KeyValue
- func ServerPort(v int) attribute.KeyValue
- func URLFull(v string) attribute.KeyValue
- func URLPath(v string) attribute.KeyValue
- func URLScheme(v string) attribute.KeyValue
Constants ¶
const UpstreamSemconvVersion = "v1.40.0"
UpstreamSemconvVersion is the upstream semconv version this package targets.
Variables ¶
var ( RequestMethodKey = attribute.Key("http.request.method") ResponseStatusCodeKey = attribute.Key("http.response.status_code") URLPathKey = attribute.Key("url.path") URLFullKey = attribute.Key("url.full") URLSchemeKey = attribute.Key("url.scheme") ServerAddressKey = attribute.Key("server.address") ServerPortKey = attribute.Key("server.port") RouteKey = attribute.Key("http.route") )
Attribute keys.
Functions ¶
func RequestMethod ¶
func RequestMethod(v upstream.RequestMethodAttr) attribute.KeyValue
RequestMethod lifts upstream's typed method enum into a span attribute. Use for the canonical HTTP verbs; fall back to RequestMethodRaw for non-standard methods.
func RequestMethodRaw ¶
RequestMethodRaw sets http.request.method to an arbitrary string. Prefer RequestMethod with an upstream-typed value where possible.
func ResponseStatusCode ¶
String / int attributes (no upstream typed enum).
func ServerAddress ¶
func ServerPort ¶
Types ¶
This section is empty.