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

Update Instrumentation to metrics v0.28.0 #1977

Merged
merged 10 commits into from
Mar 25, 2022

Conversation

MadVikingGod
Copy link
Contributor

@MadVikingGod MadVikingGod commented Mar 24, 2022

The following Instrumentation packages use the metrics API, and are updated to v0.28.0

  • instrumentation/github.com/astaxie/beego/otelbeego
  • instrumentation/github.com/astaxie/beego/otelbeego/test
  • instrumentation/github.com/gocql/gocql/otelgocql
  • instrumentation/github.com/gocql/gocql/otelgocql/test
  • instrumentation/host
  • instrumentation/net/http/otelhttp
  • instrumentation/net/http/otelhttp/test
  • instrumentation/runtime

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

@MadVikingGod MadVikingGod marked this pull request as ready for review March 24, 2022 16:41
@MadVikingGod MadVikingGod changed the title [WIP] Update Instrumentation to metrics v0.28.0 Update Instrumentation to metrics v0.28.0 Mar 24, 2022
@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #1977 (cd160a1) into main (9d5673a) will increase coverage by 0.1%.
The diff coverage is 36.8%.

Impacted file tree graph

@@           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     
Impacted Files Coverage Δ
instrumentation/host/host.go 0.0% <0.0%> (-74.8%) ⬇️
instrumentation/runtime/runtime.go 53.8% <64.1%> (-20.0%) ⬇️
...ation/github.com/astaxie/beego/otelbeego/config.go 100.0% <100.0%> (ø)
...ntation/github.com/gocql/gocql/otelgocql/config.go 57.1% <100.0%> (+57.1%) ⬆️
...ion/github.com/gocql/gocql/otelgocql/instrument.go 62.5% <100.0%> (+62.5%) ⬆️
instrumentation/net/http/otelhttp/config.go 80.6% <100.0%> (ø)
instrumentation/net/http/otelhttp/handler.go 78.2% <100.0%> (ø)
instrumentation/host/version.go 0.0% <0.0%> (-100.0%) ⬇️
... and 7 more

CHANGELOG.md Outdated Show resolved Hide resolved
return err
}

err = r.meter.RegisterCallback(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be three separate callbacks as it was before? I'm not sure what impact combining them has.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

instrumentation/net/http/otelhttp/test/handler_test.go Outdated Show resolved Hide resolved
return err
}

err = r.meter.RegisterCallback(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MadVikingGod
Copy link
Contributor Author

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.

@MadVikingGod MadVikingGod merged commit a587520 into open-telemetry:main Mar 25, 2022
@MadVikingGod MadVikingGod deleted the mvg/update-metric-api branch March 25, 2022 00:46
@MrAlias MrAlias mentioned this pull request Mar 28, 2022
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Mar 8, 2023
…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/[email protected]
github.com/moby/[email protected] go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]
```

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/[email protected]
github.com/containerd/[email protected] go.opentelemetry.io/otel/[email protected]
github.com/moby/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/contrib/instrumentation/net/http/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/otel/internal/[email protected] go.opentelemetry.io/otel/[email protected]
```

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/[email protected]
k8s.io/[email protected] go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]
k8s.io/[email protected] go.opentelemetry.io/contrib/instrumentation/net/http/[email protected]
```

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/[email protected]
go.opentelemetry.io/contrib/instrumentation/net/http/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/otel/internal/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/contrib/instrumentation/net/http/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/otel/exporters/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/otel/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/otel/sdk/export/[email protected] go.opentelemetry.io/otel/[email protected]
go.opentelemetry.io/otel/sdk/[email protected] go.opentelemetry.io/otel/[email protected]
```

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 <[email protected]>
@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants