Skip to content

metrics: replace archived go-grpc-prometheus dependency - #3308

Merged
thaJeztah merged 1 commit into
moby:masterfrom
thaJeztah:replace_grpc_prometheus
Nov 2, 2026
Merged

thaJeztah merged 1 commit into
moby:masterfrom
thaJeztah:replace_grpc_prometheus

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.

@thaJeztah
thaJeztah force-pushed the replace_grpc_prometheus branch from e459a3b to d9c65dd Compare October 16, 2026 17:43
@codecov-commenter

codecov-commenter commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 14.74%. Comparing base (323aa0b) to head (0562f4d).
⚠️ Report is 5 commits behind head on master.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thaJeztah

Copy link
Copy Markdown
Member Author

The replacement provider inflates message counters by counting EOF receives and failed sends as messages.

Looks like that was fixed in v1.1.1;

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review identified no blocking issues in the collector migration or dependency integration; tests were not run.

No open issues 🎉

Review effort: Balanced

@thaJeztah
thaJeztah force-pushed the replace_grpc_prometheus branch from 8117afb to 5724b39 Compare October 19, 2026 08:37
@thaJeztah

Copy link
Copy Markdown
Member Author

cc @vvoland PTAL

@thaJeztah
thaJeztah requested review from corhere and vvoland October 23, 2026 16:11

@corhere corhere left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM otherwise

Comment thread swarmd/cmd/swarmd/main.go Outdated
Comment on lines +192 to +197
// 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()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is swarmd code, not anything Docker Engine imports

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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>
@thaJeztah
thaJeztah merged commit 49925db into moby:master Nov 2, 2026
8 checks passed
@thaJeztah
thaJeztah deleted the replace_grpc_prometheus branch November 2, 2026 17:51
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