package internal
import "go.opentelemetry.io/otel/semconv/internal"
Package internal provides common semconv functionality.
Index ¶
- func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string)
- func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string)
- type SemanticConventions
- func (sc *SemanticConventions) EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue
- func (sc *SemanticConventions) HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue
- func (sc *SemanticConventions) HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue
- func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest( serverName, route string, request *http.Request, ) []attribute.KeyValue
- func (sc *SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest( serverName string, request *http.Request, ) []attribute.KeyValue
- func (sc *SemanticConventions) NetAttributesFromHTTPRequest( network string, request *http.Request, ) []attribute.KeyValue
Functions ¶
func SpanStatusFromHTTPStatusCode ¶
SpanStatusFromHTTPStatusCode generates a status code and a message as specified by the OpenTelemetry specification for a span.
func SpanStatusFromHTTPStatusCodeAndSpanKind ¶
func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string)
SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message as specified by the OpenTelemetry specification for a span. Exclude 4xx for SERVER to set the appropriate status.
Types ¶
type SemanticConventions ¶
type SemanticConventions struct {
EnduserIDKey attribute.Key
HTTPClientIPKey attribute.Key
HTTPFlavorKey attribute.Key
HTTPHostKey attribute.Key
HTTPMethodKey attribute.Key
HTTPRequestContentLengthKey attribute.Key
HTTPRouteKey attribute.Key
HTTPSchemeHTTP attribute.KeyValue
HTTPSchemeHTTPS attribute.KeyValue
HTTPServerNameKey attribute.Key
HTTPStatusCodeKey attribute.Key
HTTPTargetKey attribute.Key
HTTPURLKey attribute.Key
HTTPUserAgentKey attribute.Key
NetHostIPKey attribute.Key
NetHostNameKey attribute.Key
NetHostPortKey attribute.Key
NetPeerIPKey attribute.Key
NetPeerNameKey attribute.Key
NetPeerPortKey attribute.Key
NetTransportIP attribute.KeyValue
NetTransportOther attribute.KeyValue
NetTransportTCP attribute.KeyValue
NetTransportUDP attribute.KeyValue
NetTransportUnix attribute.KeyValue
}
SemanticConventions are the semantic convention values defined for a version of the OpenTelemetry specification.
func (*SemanticConventions) EndUserAttributesFromHTTPRequest ¶
func (sc *SemanticConventions) EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue
EndUserAttributesFromHTTPRequest generates attributes of the enduser namespace as specified by the OpenTelemetry specification for a span.
func (*SemanticConventions) HTTPAttributesFromHTTPStatusCode ¶
func (sc *SemanticConventions) HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue
HTTPAttributesFromHTTPStatusCode generates attributes of the http namespace as specified by the OpenTelemetry specification for a span.
func (*SemanticConventions) HTTPClientAttributesFromHTTPRequest ¶
func (sc *SemanticConventions) HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue
HTTPClientAttributesFromHTTPRequest generates attributes of the http namespace as specified by the OpenTelemetry specification for a span on the client side.
func (*SemanticConventions) HTTPServerAttributesFromHTTPRequest ¶
func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest( serverName, route string, request *http.Request, ) []attribute.KeyValue
HTTPServerAttributesFromHTTPRequest generates attributes of the http namespace as specified by the OpenTelemetry specification for a span on the server side. Currently, only basic authentication is supported.
func (*SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest ¶
func (sc *SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest( serverName string, request *http.Request, ) []attribute.KeyValue
HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes to be used with server-side HTTP metrics.
func (*SemanticConventions) NetAttributesFromHTTPRequest ¶
func (sc *SemanticConventions) NetAttributesFromHTTPRequest( network string, request *http.Request, ) []attribute.KeyValue
NetAttributesFromHTTPRequest generates attributes of the net namespace as specified by the OpenTelemetry specification for a span. The network parameter is a string that net.Dial function from standard library can understand.
Source Files ¶
http.go
Directories ¶
| Path | Synopsis |
|---|---|
| semconv/internal/v2 | Package internal provides common semconv functionality. |
| semconv/internal/v3 | Package internal provides common semconv functionality. |
| semconv/internal/v4 | Package internal provides common semconv functionality. |
- Version
- v1.36.0
- Published
- May 21, 2025
- Platform
- darwin/amd64
- Imports
- 8 packages
- Last checked
- 1 hour ago –
Tools for package owners.