httpconv

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

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

View Source
const UpstreamSemconvVersion = "v1.40.0"

UpstreamSemconvVersion is the upstream semconv version this package targets.

Variables

View Source
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

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

func RequestMethodRaw(v string) attribute.KeyValue

RequestMethodRaw sets http.request.method to an arbitrary string. Prefer RequestMethod with an upstream-typed value where possible.

func ResponseStatusCode

func ResponseStatusCode(v int) attribute.KeyValue

String / int attributes (no upstream typed enum).

func Route

func Route(v string) attribute.KeyValue

func ServerAddress

func ServerAddress(v string) attribute.KeyValue

func ServerPort

func ServerPort(v int) attribute.KeyValue

func URLFull

func URLFull(v string) attribute.KeyValue

func URLPath

func URLPath(v string) attribute.KeyValue

func URLScheme

func URLScheme(v string) attribute.KeyValue

Types

This section is empty.

Jump to

Keyboard shortcuts

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