Skip to content

Commit b08ebeb

Browse files
authored
Generate semconv/v1.15.0 (#3578)
* Add generated semconv/v1.15.0 * Add changelog entry for changes * Update PR number in changelog entry
1 parent 82882df commit b08ebeb

File tree

9 files changed

+3185
-0
lines changed

9 files changed

+3185
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3131
- The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
3232
- The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`.
3333
- The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`.
34+
- Add the `go.opentelemetry.io/otel/semconv/v1.15.0` package.
35+
The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578)
3436

3537
### Changed
3638

semconv/v1.15.0/doc.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright The OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package semconv implements OpenTelemetry semantic conventions.
16+
//
17+
// OpenTelemetry semantic conventions are agreed standardized naming
18+
// patterns for OpenTelemetry things. This package represents the conventions
19+
// as of the v1.15.0 version of the OpenTelemetry specification.
20+
package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0"

semconv/v1.15.0/exception.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright The OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0"
16+
17+
const (
18+
// ExceptionEventName is the name of the Span event representing an exception.
19+
ExceptionEventName = "exception"
20+
)

semconv/v1.15.0/http.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright The OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0"
16+
17+
// HTTP scheme attributes.
18+
var (
19+
HTTPSchemeHTTP = HTTPSchemeKey.String("http")
20+
HTTPSchemeHTTPS = HTTPSchemeKey.String("https")
21+
)

semconv/v1.15.0/httpconv/http.go

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright The OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package httpconv provides OpenTelemetry semantic convetions for the net/http
16+
// package from the standard library.
17+
package httpconv // import "go.opentelemetry.io/otel/semconv/v1.15.0/httpconv"
18+
19+
import (
20+
"net/http"
21+
22+
"go.opentelemetry.io/otel/attribute"
23+
"go.opentelemetry.io/otel/codes"
24+
"go.opentelemetry.io/otel/semconv/internal/v2"
25+
semconv "go.opentelemetry.io/otel/semconv/v1.15.0"
26+
)
27+
28+
var (
29+
nc = &internal.NetConv{
30+
NetHostNameKey: semconv.NetHostNameKey,
31+
NetHostPortKey: semconv.NetHostPortKey,
32+
NetPeerNameKey: semconv.NetPeerNameKey,
33+
NetPeerPortKey: semconv.NetPeerPortKey,
34+
NetSockPeerAddrKey: semconv.NetSockPeerAddrKey,
35+
NetSockPeerPortKey: semconv.NetSockPeerPortKey,
36+
NetTransportOther: semconv.NetTransportOther,
37+
NetTransportTCP: semconv.NetTransportTCP,
38+
NetTransportUDP: semconv.NetTransportUDP,
39+
NetTransportInProc: semconv.NetTransportInProc,
40+
}
41+
42+
hc = &internal.HTTPConv{
43+
NetConv: nc,
44+
45+
EnduserIDKey: semconv.EnduserIDKey,
46+
HTTPClientIPKey: semconv.HTTPClientIPKey,
47+
HTTPFlavorKey: semconv.HTTPFlavorKey,
48+
HTTPMethodKey: semconv.HTTPMethodKey,
49+
HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey,
50+
HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey,
51+
HTTPRouteKey: semconv.HTTPRouteKey,
52+
HTTPSchemeHTTP: semconv.HTTPSchemeHTTP,
53+
HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS,
54+
HTTPStatusCodeKey: semconv.HTTPStatusCodeKey,
55+
HTTPTargetKey: semconv.HTTPTargetKey,
56+
HTTPURLKey: semconv.HTTPURLKey,
57+
HTTPUserAgentKey: semconv.HTTPUserAgentKey,
58+
}
59+
)
60+
61+
// ClientResponse returns attributes for an HTTP response received by a client
62+
// from a server. It will return the following attributes if the related values
63+
// are defined in resp: "http.status.code", "http.response_content_length".
64+
//
65+
// This does not add all OpenTelemetry required attributes for an HTTP event,
66+
// it assumes ClientRequest was used to create the span with a complete set of
67+
// attributes. If a complete set of attributes can be generated using the
68+
// request contained in resp. For example:
69+
//
70+
// append(ClientResponse(resp), ClientRequest(resp.Request)...)
71+
func ClientResponse(resp http.Response) []attribute.KeyValue {
72+
return hc.ClientResponse(resp)
73+
}
74+
75+
// ClientRequest returns attributes for an HTTP request made by a client. The
76+
// following attributes are always returned: "http.url", "http.flavor",
77+
// "http.method", "net.peer.name". The following attributes are returned if the
78+
// related values are defined in req: "net.peer.port", "http.user_agent",
79+
// "http.request_content_length", "enduser.id".
80+
func ClientRequest(req *http.Request) []attribute.KeyValue {
81+
return hc.ClientRequest(req)
82+
}
83+
84+
// ClientStatus returns a span status code and message for an HTTP status code
85+
// value received by a client.
86+
func ClientStatus(code int) (codes.Code, string) {
87+
return hc.ClientStatus(code)
88+
}
89+
90+
// ServerRequest returns attributes for an HTTP request received by a server.
91+
// The following attributes are always returned: "http.method", "http.scheme",
92+
// "http.flavor", "http.target", "net.host.name". The following attributes are
93+
// returned if they related values are defined in req: "net.host.port",
94+
// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id",
95+
// "http.client_ip".
96+
func ServerRequest(req *http.Request) []attribute.KeyValue {
97+
return hc.ServerRequest(req)
98+
}
99+
100+
// ServerStatus returns a span status code and message for an HTTP status code
101+
// value returned by a server. Status codes in the 400-499 range are not
102+
// returned as errors.
103+
func ServerStatus(code int) (codes.Code, string) {
104+
return hc.ServerStatus(code)
105+
}
106+
107+
// RequestHeader returns the contents of h as attributes.
108+
//
109+
// Instrumentation should require an explicit configuration of which headers to
110+
// captured and then prune what they pass here. Including all headers can be a
111+
// security risk - explicit configuration helps avoid leaking sensitive
112+
// information.
113+
//
114+
// The User-Agent header is already captured in the http.user_agent attribute
115+
// from ClientRequest and ServerRequest. Instrumentation may provide an option
116+
// to capture that header here even though it is not recommended. Otherwise,
117+
// instrumentation should filter that out of what is passed.
118+
func RequestHeader(h http.Header) []attribute.KeyValue {
119+
return hc.RequestHeader(h)
120+
}
121+
122+
// ResponseHeader returns the contents of h as attributes.
123+
//
124+
// Instrumentation should require an explicit configuration of which headers to
125+
// captured and then prune what they pass here. Including all headers can be a
126+
// security risk - explicit configuration helps avoid leaking sensitive
127+
// information.
128+
//
129+
// The User-Agent header is already captured in the http.user_agent attribute
130+
// from ClientRequest and ServerRequest. Instrumentation may provide an option
131+
// to capture that header here even though it is not recommended. Otherwise,
132+
// instrumentation should filter that out of what is passed.
133+
func ResponseHeader(h http.Header) []attribute.KeyValue {
134+
return hc.ResponseHeader(h)
135+
}

semconv/v1.15.0/netconv/net.go

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright The OpenTelemetry Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package netconv provides OpenTelemetry semantic convetions for the net
16+
// package from the standard library.
17+
package netconv // import "go.opentelemetry.io/otel/semconv/v1.15.0/netconv"
18+
19+
import (
20+
"net"
21+
22+
"go.opentelemetry.io/otel/attribute"
23+
"go.opentelemetry.io/otel/semconv/internal/v2"
24+
semconv "go.opentelemetry.io/otel/semconv/v1.15.0"
25+
)
26+
27+
var nc = &internal.NetConv{
28+
NetHostNameKey: semconv.NetHostNameKey,
29+
NetHostPortKey: semconv.NetHostPortKey,
30+
NetPeerNameKey: semconv.NetPeerNameKey,
31+
NetPeerPortKey: semconv.NetPeerPortKey,
32+
NetSockFamilyKey: semconv.NetSockFamilyKey,
33+
NetSockPeerAddrKey: semconv.NetSockPeerAddrKey,
34+
NetSockPeerPortKey: semconv.NetSockPeerPortKey,
35+
NetSockHostAddrKey: semconv.NetSockHostAddrKey,
36+
NetSockHostPortKey: semconv.NetSockHostPortKey,
37+
NetTransportOther: semconv.NetTransportOther,
38+
NetTransportTCP: semconv.NetTransportTCP,
39+
NetTransportUDP: semconv.NetTransportUDP,
40+
NetTransportInProc: semconv.NetTransportInProc,
41+
}
42+
43+
// Transport returns an attribute describing the transport protocol of the
44+
// passed network. See the net.Dial for information about acceptable network
45+
// values.
46+
func Transport(network string) attribute.KeyValue {
47+
return nc.Transport(network)
48+
}
49+
50+
// Client returns attributes for a client network connection to address. See
51+
// net.Dial for information about acceptable address values, address should be
52+
// the same as the one used to create conn. If conn is nil, only network peer
53+
// attributes will be returned that describe address. Otherwise, the socket
54+
// level information about conn will also be included.
55+
func Client(address string, conn net.Conn) []attribute.KeyValue {
56+
return nc.Client(address, conn)
57+
}
58+
59+
// Server returns attributes for a network listener listening at address. See
60+
// net.Listen for information about acceptable address values, address should
61+
// be the same as the one used to create ln. If ln is nil, only network host
62+
// attributes will be returned that describe address. Otherwise, the socket
63+
// level information about ln will also be included.
64+
func Server(address string, ln net.Listener) []attribute.KeyValue {
65+
return nc.Server(address, ln)
66+
}

0 commit comments

Comments
 (0)