Skip to content

Commit c26c078

Browse files
Karl Johan Ansari-Önnestamquoral
authored andcommitted
feat!: upgrade to latest stable otel API v1.21.0
otel uses a little bit of a strange versioning schema, where the contracts are versioned under otel/semconv/{VERSION}, but the package can be upgraded to several versions ahead of the contract. This has worked fine for our use-cases, but we recently ran into a problem where we go the following error on application startup - after a dependabot upgrade came along: ``` cannot merge resource due to conflicting Schema URL ``` This led down a rabbit hole, eventually finding out this quirk in otel usage. BREAKING CHANGE: This upgrades the version of the otel contract being used. This is possibly a breaking change so care must be taken so that other OTEL packages are upgraded to v1.21 simultaneously so there aren't further breakages.
1 parent 37e60fa commit c26c078

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

cloudmonitoring/metricmiddleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"go.opentelemetry.io/otel"
1010
"go.opentelemetry.io/otel/attribute"
1111
"go.opentelemetry.io/otel/metric"
12-
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
12+
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
1313
"google.golang.org/grpc"
1414
"google.golang.org/grpc/codes"
1515
"google.golang.org/grpc/status"

cloudotel/metricexporter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"go.opentelemetry.io/otel/sdk/instrumentation"
1818
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
1919
"go.opentelemetry.io/otel/sdk/resource"
20-
semconv "go.opentelemetry.io/otel/semconv/v1.14.0"
20+
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
2121
"go.uber.org/zap"
2222
"google.golang.org/grpc/codes"
2323
"google.golang.org/grpc/status"
@@ -73,7 +73,7 @@ func StartMetricExporter(
7373
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",
7474
semconv.NetPeerPortKey,
7575
semconv.NetSockPeerPortKey,
76-
semconv.HTTPClientIPKey,
76+
attribute.Key("http.client_ip"),
7777
),
7878
maskInstrumentAttrs(
7979
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc",

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require (
4242
cloud.google.com/go/compute v1.23.3 // indirect
4343
cloud.google.com/go/monitoring v1.16.3 // indirect
4444
cloud.google.com/go/trace v1.10.4 // indirect
45-
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.20.0 // indirect
45+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.21.0 // indirect
4646
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.45.0 // indirect
4747
github.com/felixge/httpsnoop v1.0.4 // indirect
4848
github.com/go-logr/logr v1.3.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7Biccwk
2222
cloud.google.com/go/trace v1.10.4 h1:2qOAuAzNezwW3QN+t41BtkDJOG42HywL73q8x/f6fnM=
2323
cloud.google.com/go/trace v1.10.4/go.mod h1:Nso99EDIK8Mj5/zmB+iGr9dosS/bzWCJ8wGmE6TXNWY=
2424
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
25-
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.20.0 h1:tk85AYGwOf6VNtoOQi8w/kVDi2vmPxp3/OU2FsUpdcA=
26-
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.20.0/go.mod h1:Xx0VKh7GJ4si3rmElbh19Mejxz68ibWg/J30ZOMrqzU=
25+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.21.0 h1:aNyyrkRcLMWFum5qgYbXl6Ut+MMOmfH/kLjZJ5YJP/I=
26+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.21.0/go.mod h1:BEOBnuYVyPt9wxVRQqqpKUK9FXVcL2+LOjZ8apLa9ao=
2727
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.45.0 h1:Oh5/2grZuv8p5+lidwW2ZfT3V/A3uGS0VaffKDQuOco=
2828
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.45.0/go.mod h1:P+p6V+38uic90/V32zbCutZOcZxzvKjSQX2M1BFMopo=
2929
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.21.0 h1:OEgjQy1rH4Fbn5IpuI9d0uhLl+j6DkDvh9Q2Ucd6GK8=

0 commit comments

Comments
 (0)