Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade use of semconv to v1.24.0 #4754

Merged
merged 19 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Changed

- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.23.1`. (#4754)
pellared marked this conversation as resolved.
Show resolved Hide resolved
- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.19.0` version of the OpenTelemetry specification.
It handles spans following semantic convention `v1.22.0` version or greater. (#4754)
pellared marked this conversation as resolved.
Show resolved Hide resolved
- Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722)
- Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721)

Expand Down
2 changes: 1 addition & 1 deletion bridge/opentracing/internal/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/bridge/opentracing/migration"
"go.opentelemetry.io/otel/codes"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/embedded"
"go.opentelemetry.io/otel/trace/noop"
Expand Down
2 changes: 1 addition & 1 deletion example/dice/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"
"go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

// setupOTelSDK bootstraps the OpenTelemetry pipeline.
Expand Down
2 changes: 1 addition & 1 deletion example/otel-collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
)

Expand Down
2 changes: 1 addition & 1 deletion example/zipkin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"go.opentelemetry.io/otel/exporters/zipkin"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"google.golang.org/protobuf/proto"

"go.opentelemetry.io/otel"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1"
cpb "go.opentelemetry.io/proto/otlp/common/v1"
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
cpb "go.opentelemetry.io/proto/otlp/common/v1"
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"google.golang.org/protobuf/proto"

"go.opentelemetry.io/otel"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1"
cpb "go.opentelemetry.io/proto/otlp/common/v1"
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
cpb "go.opentelemetry.io/proto/otlp/common/v1"
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
tracepb "go.opentelemetry.io/proto/otlp/trace/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion exporters/prometheus/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
otelmetric "go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

func TestPrometheusExporter(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion exporters/stdout/stdoutmetric/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion exporters/stdout/stdouttrace/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
)

Expand Down
21 changes: 10 additions & 11 deletions exporters/zipkin/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
)

Expand Down Expand Up @@ -236,15 +236,14 @@ func toZipkinTags(data tracesdk.ReadOnlySpan) map[string]string {
}

// Rank determines selection order for remote endpoint. See the specification
// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/zipkin.md#otlp---zipkin
// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.28.0/specification/trace/sdk_exporters/zipkin.md#otlp---zipkin
var remoteEndpointKeyRank = map[attribute.Key]int{
semconv.PeerServiceKey: 0,
semconv.NetPeerNameKey: 1,
semconv.NetSockPeerNameKey: 2,
semconv.NetSockPeerAddrKey: 3,
keyPeerHostname: 4,
keyPeerAddress: 5,
semconv.DBNameKey: 6,
semconv.PeerServiceKey: 0,
semconv.ServerAddressKey: 1,
semconv.NetworkPeerAddressKey: 2,
keyPeerHostname: 3,
keyPeerAddress: 4,
semconv.DBNameKey: 5,
}

func toZipkinRemoteEndpoint(data tracesdk.ReadOnlySpan) *zkmodel.Endpoint {
Expand Down Expand Up @@ -273,7 +272,7 @@ func toZipkinRemoteEndpoint(data tracesdk.ReadOnlySpan) *zkmodel.Endpoint {
return nil
}

if endpointAttr.Key != semconv.NetSockPeerAddrKey &&
if endpointAttr.Key != semconv.NetworkPeerAddressKey &&
endpointAttr.Value.Type() == attribute.STRING {
return &zkmodel.Endpoint{
ServiceName: endpointAttr.Value.AsString(),
Expand All @@ -300,7 +299,7 @@ func remoteEndpointPeerIPWithPort(peerIP string, attrs []attribute.KeyValue) *zk
}

for _, kv := range attrs {
if kv.Key == semconv.NetSockPeerPortKey {
if kv.Key == semconv.NetworkPeerPortKey {
port, _ := strconv.ParseUint(kv.Value.Emit(), 10, 16)
endpoint.Port = uint16(port)
return endpoint
Expand Down
46 changes: 23 additions & 23 deletions exporters/zipkin/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
)

Expand Down Expand Up @@ -291,8 +291,8 @@ func TestModelConversion(t *testing.T) {
attribute.Int64("attr1", 42),
attribute.String("attr2", "bar"),
attribute.String("peer.hostname", "test-peer-hostname"),
attribute.String("net.sock.peer.addr", "1.2.3.4"),
attribute.Int64("net.sock.peer.port", 9876),
attribute.String("network.peer.address", "1.2.3.4"),
attribute.Int64("network.peer.port", 9876),
},
Events: []tracesdk.Event{
{
Expand Down Expand Up @@ -745,17 +745,17 @@ func TestModelConversion(t *testing.T) {
},
},
Tags: map[string]string{
"attr1": "42",
"attr2": "bar",
"net.sock.peer.addr": "1.2.3.4",
"net.sock.peer.port": "9876",
"peer.hostname": "test-peer-hostname",
"otel.status_code": "ERROR",
"error": "404, file not found",
"service.name": "model-test",
"service.version": "0.1.0",
"resource-attr1": "42",
"resource-attr2": "[0,1,2]",
"attr1": "42",
"attr2": "bar",
"network.peer.address": "1.2.3.4",
"network.peer.port": "9876",
"peer.hostname": "test-peer-hostname",
"otel.status_code": "ERROR",
"error": "404, file not found",
"service.name": "model-test",
"service.version": "0.1.0",
"resource-attr1": "42",
"resource-attr2": "[0,1,2]",
},
},
// model for span data of producer kind
Expand Down Expand Up @@ -1096,25 +1096,25 @@ func TestRemoteEndpointTransformation(t *testing.T) {
SpanKind: trace.SpanKindProducer,
Attributes: []attribute.KeyValue{
semconv.PeerService("peer-service-test"),
semconv.NetPeerName("peer-name-test"),
semconv.NetSockPeerName("net-sock-peer-test"),
semconv.ServerAddress("peer-name-test"),
semconv.NetworkPeerAddress("10.1.2.80"),
},
},
want: &zkmodel.Endpoint{
ServiceName: "peer-service-test",
},
},
{
name: "net-sock-peer-rank",
name: "network-peer-rank",
data: tracetest.SpanStub{
SpanKind: trace.SpanKindProducer,
Attributes: []attribute.KeyValue{
semconv.NetSockPeerName("net-sock-peer-test"),
semconv.NetworkPeerAddress("10.1.2.80"),
semconv.DBName("db-name-test"),
},
},
want: &zkmodel.Endpoint{
ServiceName: "net-sock-peer-test",
IPv4: net.ParseIP("10.1.2.80"),
},
},
{
Expand Down Expand Up @@ -1162,7 +1162,7 @@ func TestRemoteEndpointTransformation(t *testing.T) {
data: tracetest.SpanStub{
SpanKind: trace.SpanKindProducer,
Attributes: []attribute.KeyValue{
semconv.NetSockPeerAddr("INVALID"),
semconv.NetworkPeerAddress("INVALID"),
},
},
want: nil,
Expand All @@ -1172,7 +1172,7 @@ func TestRemoteEndpointTransformation(t *testing.T) {
data: tracetest.SpanStub{
SpanKind: trace.SpanKindProducer,
Attributes: []attribute.KeyValue{
semconv.NetSockPeerAddr("0:0:1:5ee:bad:c0de:0:0"),
semconv.NetworkPeerAddress("0:0:1:5ee:bad:c0de:0:0"),
},
},
want: &zkmodel.Endpoint{
Expand All @@ -1184,8 +1184,8 @@ func TestRemoteEndpointTransformation(t *testing.T) {
data: tracetest.SpanStub{
SpanKind: trace.SpanKindProducer,
Attributes: []attribute.KeyValue{
semconv.NetSockPeerAddr("1.2.3.4"),
semconv.NetSockPeerPort(9876),
semconv.NetworkPeerAddress("1.2.3.4"),
semconv.NetworkPeerPort(9876),
},
},
want: &zkmodel.Endpoint{
Expand Down
2 changes: 1 addition & 1 deletion exporters/zipkin/zipkin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
"go.opentelemetry.io/otel/trace"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/shared/otlp/otlpmetric/otest/client.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"google.golang.org/protobuf/proto"

"go.opentelemetry.io/otel"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1"
cpb "go.opentelemetry.io/proto/otlp/common/v1"
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric/metricdata"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
cpb "go.opentelemetry.io/proto/otlp/common/v1"
mpb "go.opentelemetry.io/proto/otlp/metrics/v1"
rpb "go.opentelemetry.io/proto/otlp/resource/v1"
Expand Down
4 changes: 2 additions & 2 deletions metric/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

var meter = otel.Meter("my-service-meter")
Expand Down Expand Up @@ -277,6 +277,6 @@ func ExampleMeter_attributes() {
statusCode := http.StatusOK

apiCounter.Add(r.Context(), 1,
metric.WithAttributes(semconv.HTTPStatusCode(statusCode)))
metric.WithAttributes(semconv.HTTPResponseStatusCode(statusCode)))
})
}
2 changes: 1 addition & 1 deletion sdk/metric/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"go.opentelemetry.io/otel/sdk/instrumentation"
"go.opentelemetry.io/otel/sdk/metric"
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

// To enable metrics in your application using the SDK,
Expand Down
2 changes: 1 addition & 1 deletion sdk/resource/auto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/stretchr/testify/assert"

"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

func TestDetect(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/resource/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/sdk"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion sdk/resource/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"
"regexp"

semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

type containerIDProvider func() (string, error)
Expand Down
2 changes: 1 addition & 1 deletion sdk/resource/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion sdk/resource/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"go.opentelemetry.io/otel/attribute"
ottest "go.opentelemetry.io/otel/sdk/internal/internaltest"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

func TestDetectOnePair(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/resource/host_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"errors"
"strings"

semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

type hostIDProvider func() (string, error)
Expand Down
2 changes: 1 addition & 1 deletion sdk/resource/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"strings"

"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
semconv "go.opentelemetry.io/otel/semconv/v1.23.1"
)

type osDescriptionProvider func() (string, error)
Expand Down
Loading