Update Instrumentation to metrics v0.28.0#1977
Update Instrumentation to metrics v0.28.0#1977MadVikingGod merged 10 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1977 +/- ##
=======================================
+ Coverage 72.1% 72.3% +0.1%
=======================================
Files 124 126 +2
Lines 5330 5412 +82
=======================================
+ Hits 3848 3916 +68
- Misses 1370 1379 +9
- Partials 112 117 +5
|
| return err | ||
| } | ||
|
|
||
| err = r.meter.RegisterCallback( |
There was a problem hiding this comment.
Should this be three separate callbacks as it was before? I'm not sure what impact combining them has.
There was a problem hiding this comment.
I don't believe that any of the callbacks are run in separate routines. So this would just dispense with the overhead of tracking 3 different closures and calling each one serially.
| return err | ||
| } | ||
|
|
||
| err = r.meter.RegisterCallback( |
There was a problem hiding this comment.
I don't believe that any of the callbacks are run in separate routines. So this would just dispense with the overhead of tracking 3 different closures and calling each one serially.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: David Ashpole <dashpole@google.com>
|
In an effort to enable users to test the new release I will merge this sooner than the 24h window. This already has approvals from the maintainers and 1+ approver. |
…x` is "unstable", and as it specifieds a minimum version, that will include "any breaking change after".
try to fix go.opentelemetry.io dependency hell
docker ("indirect") and buildkit ("direct") specify `v0.29.0`;
```bash
go mod graph --modfile=vendor.mod | grep ' go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp'
github.com/docker/docker go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0
github.com/moby/buildkit@v0.11.4 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0
```
containerd specified v0.34.0 for `go.opentelemetry.io/otel/metric`;
```bash
go mod graph --modfile=vendor.mod | grep ' go.opentelemetry.io/otel/metric@'
github.com/docker/docker go.opentelemetry.io/otel/metric@v0.34.0
github.com/containerd/containerd@v1.7.0-rc.2 go.opentelemetry.io/otel/metric@v0.34.0
github.com/moby/buildkit@v0.11.4 go.opentelemetry.io/otel/metric@v0.27.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc@v0.37.0 go.opentelemetry.io/otel/metric@v0.34.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0 go.opentelemetry.io/otel/metric@v0.27.0
go.opentelemetry.io/otel/internal/metric@v0.27.0 go.opentelemetry.io/otel/metric@v0.27.0
```
But BuildKit uses;
```bash
git checkout v0.11.4
go mod graph | grep ' go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp'
github.com/moby/buildkit go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0
k8s.io/apiserver@v0.22.5 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.20.0
k8s.io/component-base@v0.22.5 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.20.0
```
But looks like BuildKit has older versions of the other packages installed;
```bash
go mod graph | grep ' go.opentelemetry.io/otel/metric@'
github.com/moby/buildkit go.opentelemetry.io/otel/metric@v0.27.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.29.0 go.opentelemetry.io/otel/metric@v0.27.0
go.opentelemetry.io/otel/internal/metric@v0.27.0 go.opentelemetry.io/otel/metric@v0.27.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.20.0 go.opentelemetry.io/otel/metric@v0.20.0
go.opentelemetry.io/otel@v0.20.0 go.opentelemetry.io/otel/metric@v0.20.0
go.opentelemetry.io/otel/exporters/otlp@v0.20.0 go.opentelemetry.io/otel/metric@v0.20.0
go.opentelemetry.io/otel/oteltest@v0.20.0 go.opentelemetry.io/otel/metric@v0.20.0
go.opentelemetry.io/otel/sdk/export/metric@v0.20.0 go.opentelemetry.io/otel/metric@v0.20.0
go.opentelemetry.io/otel/sdk/metric@v0.20.0 go.opentelemetry.io/otel/metric@v0.20.0
```
Looks like `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.31.0` is the first version taking the new metrics into account;
https://github.com/open-telemetry/opentelemetry-go-contrib/blob/instrumentation/net/http/otelhttp/v0.31.0/instrumentation/net/http/otelhttp/handler.go#L52-L53
Changed in open-telemetry/opentelemetry-go-contrib@a587520 (open-telemetry/opentelemetry-go-contrib#1977)
Unfortunately, updating these to v0.31.0 works around the other issues, but breaks BuildKit, which doesn't support the newer API;
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.31.0 // indirect // updated to v0.31+ to account for moby#44530 (comment)
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.31.0 // indirect // updated v0.31+ to account for moby#44530 (comment)
```bash
Building static bundles/binary-daemon/dockerd (linux/arm64)...
vendor/github.com/moby/buildkit/util/tracing/transform/span.go:34:26: sd.InstrumentationLibrarySpans undefined (type *"github.com/docker/docker/vendor/go.opentelemetry.io/proto/otlp/trace/v1".ResourceSpans has no field or method InstrumentationLibrarySpans)
vendor/github.com/moby/buildkit/util/tracing/transform/span.go:56:17: undefined: v11.InstrumentationLibrary
vendor/github.com/moby/buildkit/util/tracing/transform/instrumentation.go:9:42: undefined: commonpb.InstrumentationLibrary
vendor/github.com/moby/buildkit/worker/containerd/containerd.go:56:74: cannot use &gogoptypes.Empty{} (value of type *"github.com/docker/docker/vendor/github.com/gogo/protobuf/types".Empty) as *emptypb.Empty value in argument to client.IntrospectionService().Server
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The following Instrumentation packages use the metrics API, and are updated to v0.28.0
Note:
In v0.27.0 of the metrics API there was otel/metric/metrictest. This had a MeterProvider that did not use the SDK to record metrics in memory. That was removed from v0.28.0 and will be replaced in open-telemetry/opentelemetry-go#2722