Repository navigation
metrics: replace archived go-grpc-prometheus dependency - #3308
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The replacement provider inflates message counters by counting EOF receives and failed sends as messages.
0 open findings
What changed in this PR
Replaces SwarmKit’s archived gRPC Prometheus dependency with the maintained middleware provider.
Changes:
- Centralizes client and server collectors and updates interceptor wiring.
- Temporarily disables swarmd handling-time histograms.
- Updates module metadata and vendored dependencies.
| File | Description |
|---|---|
| vendor/modules.txt | Updates vendored package inventory. |
| vendor/google.golang.org/grpc/reflection/serverreflection.go | Adds reflection API dependency. |
| vendor/google.golang.org/grpc/reflection/README.md | Adds upstream reflection documentation. |
| vendor/google.golang.org/grpc/reflection/internal/internal.go | Adds reflection implementation. |
| vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go | Adds generated v1alpha messages. |
| vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go | Adds v1alpha service bindings. |
| vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go | Adds generated v1 messages. |
| vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go | Adds v1 service bindings. |
| vendor/google.golang.org/grpc/reflection/adapt.go | Adds reflection version adapters. |
| vendor/golang.org/x/net/context/context.go | Removes obsolete context dependency. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/util.go | Removes legacy utilities. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server.go | Removes legacy server registration. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_reporter.go | Removes legacy server reporter. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_metrics.go | Removes legacy server collector. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/README.md | Removes legacy documentation. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/metric_options.go | Removes legacy metric options. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/makefile | Removes legacy build tooling. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client.go | Removes legacy client registration. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_reporter.go | Removes legacy client reporter. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_metrics.go | Removes legacy client collector. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/CHANGELOG.md | Removes legacy changelog. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.travis.yml | Removes legacy CI configuration. |
| vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.gitignore | Removes legacy ignore rules. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/LICENSE | Includes middleware license. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/server.go | Adds server reporting interceptors. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/reporter.go | Adds shared reporting interfaces. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/doc.go | Adds interceptor documentation. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/client.go | Adds client reporting interceptors. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/callmeta.go | Adds RPC metadata helpers. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/COPYRIGHT | Includes middleware attribution. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_options.go | Adds server collector options. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_metrics.go | Adds replacement server collector. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/reporter.go | Adds shared metric reporting. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/options.go | Adds provider configuration helpers. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/LICENSE | Includes provider license. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/doc.go | Adds provider documentation. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/constants.go | Adds RPC metric constants. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_options.go | Adds client collector options. |
| vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_metrics.go | Adds replacement client collector. |
| swarmd/go.work.sum | Updates workspace checksums. |
| swarmd/go.sum | Updates dependency checksums. |
| swarmd/go.mod | Replaces metrics dependencies. |
| swarmd/cmd/swarmd/main.go | Disables optional handling-time histograms. |
| node/node.go | Uses shared client interceptors. |
| manager/state/raft/util.go | Migrates Raft client interceptors. |
| manager/state/raft/transport/transport.go | Migrates transport client interceptors. |
| manager/manager.go | Migrates interceptors and metric initialization. |
| internal/grpcmetrics/metrics.go | Registers shared collectors once. |
| go.sum | Updates dependency checksums. |
| go.mod | Selects replacement metrics provider. |
| connectionbroker/broker.go | Uses shared client interceptors. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
e459a3b to
d9c65dd
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3308 +/- ##
==========================================
+ Coverage 14.71% 14.74% +0.02%
==========================================
Files 198 199 +1
Lines 93037 93038 +1
==========================================
+ Hits 13693 13719 +26
+ Misses 77997 77985 -12
+ Partials 1347 1334 -13 🚀 New features to boost your workflow:
|
Looks like that was fixed in v1.1.1; |
d9c65dd to
8117afb
Compare
8117afb to
5724b39
Compare
|
cc @vvoland PTAL |
| // This allows to measure latency distribution. | ||
| prometheus.EnableHandlingTimeHistogram() | ||
| // TODO: Restore optional gRPC handling-time histograms. | ||
| // The new Prometheus provider requires configuring histograms when | ||
| // creating the collector. Enabling them globally would also affect | ||
| // SwarmKit consumers such as Docker Engine. | ||
| // | ||
| // // This allows to measure latency distribution. | ||
| // grpc_prometheus.EnableHandlingTimeHistogram() |
There was a problem hiding this comment.
This is swarmd code, not anything Docker Engine imports
There was a problem hiding this comment.
Reverted this bit, and moved it to a follow-up;
Replace github.com/grpc-ecosystem/go-grpc-prometheus with the maintained Prometheus provider from go-grpc-middleware. Add a shared internal/grpcmetrics package to register client and server collectors once, and update the interceptors and server metrics initialization to use the new API. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
5724b39 to
0562f4d
Compare
Replace github.com/grpc-ecosystem/go-grpc-prometheus with the maintained Prometheus provider from go-grpc-middleware.
Add a shared internal/grpcmetrics package to register client and server collectors once, and update the interceptors and server metrics initialization to use the new API.
- What I did
- How I did it
- How to test it
- Description for the changelog