Skip to content

Commit

Permalink
Add semconv/v1.20.0 (#4078)
Browse files Browse the repository at this point in the history
* Add semconv/v1.20.0

* Update changelog

* Change http.flavor to net.protocol.(name|version)

* Update comments in httpconv

* Fix vanity import

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

---------

Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
3 people authored May 16, 2023
1 parent fadd3d6 commit 8445f21
Show file tree
Hide file tree
Showing 18 changed files with 7,996 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added

- The `go.opentelemetry.io/otel/semconv/v1.20.0` package.
The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078)

### Removed

- The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed.
Expand Down
1 change: 0 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ For example,
```sh
export TAG="v1.13.0" # Change to the release version you are generating.
export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification"
git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG" -b "$TAG"
docker pull otel/semconvgen:latest
make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO.
```
Expand Down
22 changes: 12 additions & 10 deletions internal/tools/semconvkit/templates/httpconv/http.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/semconv/internal/v3"
"go.opentelemetry.io/otel/semconv/internal/v4"
semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}"
)

Expand All @@ -44,7 +44,8 @@ var (

EnduserIDKey: semconv.EnduserIDKey,
HTTPClientIPKey: semconv.HTTPClientIPKey,
HTTPFlavorKey: semconv.HTTPFlavorKey,
NetProtocolNameKey: semconv.NetProtocolNameKey,
NetProtocolVersionKey: semconv.NetProtocolVersionKey,
HTTPMethodKey: semconv.HTTPMethodKey,
HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey,
HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey,
Expand Down Expand Up @@ -74,10 +75,11 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue {
}

// ClientRequest returns trace attributes for an HTTP request made by a client.
// The following attributes are always returned: "http.url", "http.flavor",
// "http.method", "net.peer.name". The following attributes are returned if the
// related values are defined in req: "net.peer.port", "http.user_agent",
// "http.request_content_length", "enduser.id".
// The following attributes are always returned: "http.url",
// "net.protocol.(name|version)", "http.method", "net.peer.name".
// The following attributes are returned if the related values are defined
// in req: "net.peer.port", "http.user_agent", "http.request_content_length",
// "enduser.id".
func ClientRequest(req *http.Request) []attribute.KeyValue {
return hc.ClientRequest(req)
}
Expand Down Expand Up @@ -106,10 +108,10 @@ func ClientStatus(code int) (codes.Code, string) {
// The req Host will be used to determine the server instead.
//
// The following attributes are always returned: "http.method", "http.scheme",
// "http.flavor", "http.target", "net.host.name". The following attributes are
// returned if they related values are defined in req: "net.host.port",
// "net.sock.peer.addr", "net.sock.peer.port", "user_agent.original", "enduser.id",
// "http.client_ip".
// ""net.protocol.(name|version)", "http.target", "net.host.name".
// The following attributes are returned if they related values are defined
// in req: "net.host.port", "net.sock.peer.addr", "net.sock.peer.port",
// "user_agent.original", "enduser.id", "http.client_ip".
func ServerRequest(server string, req *http.Request) []attribute.KeyValue {
return hc.ServerRequest(server, req)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/semconvkit/templates/netconv/net.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"net"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/semconv/internal/v3"
"go.opentelemetry.io/otel/semconv/internal/v4"
semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}"
)

Expand Down
Loading

0 comments on commit 8445f21

Please sign in to comment.