...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package semconv
16
17 import (
18 "net/http"
19
20 "go.opentelemetry.io/otel/attribute"
21 "go.opentelemetry.io/otel/codes"
22 "go.opentelemetry.io/otel/semconv/internal"
23 "go.opentelemetry.io/otel/trace"
24 )
25
26
27 var (
28 HTTPSchemeHTTP = HTTPSchemeKey.String("http")
29 HTTPSchemeHTTPS = HTTPSchemeKey.String("https")
30 )
31
32 var sc = &internal.SemanticConventions{
33 EnduserIDKey: EnduserIDKey,
34 HTTPClientIPKey: HTTPClientIPKey,
35 HTTPFlavorKey: HTTPFlavorKey,
36 HTTPHostKey: HTTPHostKey,
37 HTTPMethodKey: HTTPMethodKey,
38 HTTPRequestContentLengthKey: HTTPRequestContentLengthKey,
39 HTTPRouteKey: HTTPRouteKey,
40 HTTPSchemeHTTP: HTTPSchemeHTTP,
41 HTTPSchemeHTTPS: HTTPSchemeHTTPS,
42 HTTPServerNameKey: HTTPServerNameKey,
43 HTTPStatusCodeKey: HTTPStatusCodeKey,
44 HTTPTargetKey: HTTPTargetKey,
45 HTTPURLKey: HTTPURLKey,
46 HTTPUserAgentKey: HTTPUserAgentKey,
47 NetHostIPKey: NetHostIPKey,
48 NetHostNameKey: NetHostNameKey,
49 NetHostPortKey: NetHostPortKey,
50 NetPeerIPKey: NetPeerIPKey,
51 NetPeerNameKey: NetPeerNameKey,
52 NetPeerPortKey: NetPeerPortKey,
53 NetTransportIP: NetTransportIP,
54 NetTransportOther: NetTransportOther,
55 NetTransportTCP: NetTransportTCP,
56 NetTransportUDP: NetTransportUDP,
57 NetTransportUnix: NetTransportUnix,
58 }
59
60
61
62
63
64 func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue {
65 return sc.NetAttributesFromHTTPRequest(network, request)
66 }
67
68
69
70
71 func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
72 return sc.EndUserAttributesFromHTTPRequest(request)
73 }
74
75
76
77
78 func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue {
79 return sc.HTTPClientAttributesFromHTTPRequest(request)
80 }
81
82
83
84 func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue {
85 return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request)
86 }
87
88
89
90
91
92 func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue {
93 return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request)
94 }
95
96
97
98
99 func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue {
100 return sc.HTTPAttributesFromHTTPStatusCode(code)
101 }
102
103
104
105 func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) {
106 return internal.SpanStatusFromHTTPStatusCode(code)
107 }
108
109
110
111
112 func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) {
113 return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind)
114 }
115
View as plain text