Skip to content

Comments

Upgrade to using hashicorp/go-metrics@v0.5.4#22080

Closed
mkeeler wants to merge 1 commit intomainfrom
hashicorp-metrics
Closed

Upgrade to using hashicorp/go-metrics@v0.5.4#22080
mkeeler wants to merge 1 commit intomainfrom
hashicorp-metrics

Conversation

@mkeeler
Copy link
Member

@mkeeler mkeeler commented Jan 16, 2025

Description

Migrate Consul to using hashicorp/go-metrics instead of armon/go-metrics.

This necessarily includes updates to the following dependencies:

  • raft
  • raft-boltdb/v2
  • raft-wal
  • memberlist
  • serf

All of those libraries were previously updated to support compatibility with hashicorp/go-metrics. In order to get the metrics for those libraries flowing out to hashicorp/go-metrics, I added the hashicorpmetrics build tag.

This should be a non-functional change but unblocks future go-metrics updates.

I also bumped the serf and memberlist dependencies within the api module. While that module doesn't cause any metrics to be invoked, I wanted to ensure only the latest versions with metrics compatibility would be directly relied upon.

Note that armon/go-metrics still appears as an indirect dependency in go.mod. This is because of a new compat package within hashicorp/go-metrics that allow for swapping the underlying metrics module used between armon/go-metrics and hashicorp/go-metrics with the build tag.

Testing & Reproduction steps

  • make dev-build
  • mkdir data
  • `consul agent -server -data-dir $(pwd)/data -bind 127.0.0.1 -bootstrap -hcl 'raft_logstore { backend = "boltdb" }'
  • curl localhost:8500/v1/agent/metrics and then verify metrics are present from raft, raft-boltdb/v2, memberlist and serf.
  • Stop the Consul server
  • rm -rf data/* to wipe the data directory
  • `consul agent -server -data-dir $(pwd)/data -bind 127.0.0.1 -bootstrap
  • curl localhost:8500/v1/agent/metrics and then verify metrics are present from raft, raft-wal, memberlist and serf.

In my own testing I have verified that at least one metric from all the affected libraries are still emitted correctly along with normal Consul metrics.

Note the agent is run twice with the different raft log stores to ensure both metrics from boltdb or the WAL are being emitted

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@mkeeler mkeeler requested a review from a team as a code owner January 16, 2025 19:54
@github-actions github-actions bot added theme/api Relating to the HTTP API interface theme/health-checks Health Check functionality theme/config Relating to Consul Agent configuration, including reloading theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies type/ci Relating to continuous integration (CI) tooling for testing or releases pr/dependencies PR specifically updates dependencies of project theme/envoy/xds Related to Envoy support theme/contributing Additions and enhancements to community contributing materials theme/internals Serf, Raft, SWIM, Lifeguard, Anti-Entropy, locking topics theme/agent-cache Agent Cache labels Jan 16, 2025
@mkeeler mkeeler added pr/no-backport pr/no-changelog PR does not need a corresponding .changelog entry labels Jan 16, 2025
@mkeeler mkeeler requested a review from a team as a code owner January 17, 2025 15:41
@mkeeler mkeeler requested a review from jeanneryan January 17, 2025 15:41
@mkeeler mkeeler force-pushed the hashicorp-metrics branch from 73df053 to 2d179da Compare April 10, 2025 13:53
This also requires bumping the dependencies for:

* memberlist
* serf
* raft
* raft-boltdb/v2

Tidy up other submodules

Fixup a few ci jobs where build tag was missing.

Add tagging to the lint-enums job

Update linting rules to disallow usage of armon/go-metrics

Also prevent usage of hashicorp/go-metrics/compat as that should only be used by libraries.

Dont use the deprecated -tags option to enumcover

Try to get the tags passed through correctly.

Fix serf config cloning test due to new field present in the config.

Attempt to get build tags flowing properly when utilizing gotestsum splitting.

More quoting

One more attempt at passing build tags in GOFLAGS

Add tags to the golden file checker

Sync backport-assistant version with ent

Some more build tag tweaking

Sync with Ent

Use comma separated build tags

Also fixup the compat test image selection

Only tack on the hashicorpmetrics tag if its not in the tag list already
@mkeeler mkeeler force-pushed the hashicorp-metrics branch from 2d179da to 1242cbd Compare April 10, 2025 13:54
@promiseofcake
Copy link

What can we do to get this landed? Downstream transitive consumers are blocked due to the repo ownership change.

@github-actions
Copy link

This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.

@github-actions github-actions bot added the meta/stale Automatically flagged for inactivity by stalebot label Jun 28, 2025
@jrh3k5
Copy link

jrh3k5 commented Jul 20, 2025

Giving this a nudge - I'm unable to update to v0.5.4 of hashicorp/go-metrics due to a transitive dependency on armon/go-metrics by the hashicorp/consul/api Go module.

@github-actions github-actions bot removed the meta/stale Automatically flagged for inactivity by stalebot label Jul 21, 2025
@qwenode
Copy link

qwenode commented Jul 30, 2025

go: github.com/armon/go-metrics@v0.4.2: parsing go.mod:
module declares its path as: github.com/hashicorp/go-metrics
but was required as: github.com/armon/go-metrics
restoring github.com/armon/go-metrics@v0.4.1

@github-actions
Copy link

This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.

@github-actions github-actions bot added the meta/stale Automatically flagged for inactivity by stalebot label Sep 29, 2025
@github-actions
Copy link

Closing due to inactivity. If you feel this was a mistake or you wish to re-open at any time in the future, please leave a comment and it will be re-surfaced for the maintainers to review.

@github-actions github-actions bot closed this Oct 29, 2025
@github-actions github-actions bot deleted the hashicorp-metrics branch October 29, 2025 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta/stale Automatically flagged for inactivity by stalebot pr/dependencies PR specifically updates dependencies of project pr/no-backport pr/no-changelog PR does not need a corresponding .changelog entry theme/agent-cache Agent Cache theme/api Relating to the HTTP API interface theme/config Relating to Consul Agent configuration, including reloading theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies theme/contributing Additions and enhancements to community contributing materials theme/envoy/xds Related to Envoy support theme/health-checks Health Check functionality theme/internals Serf, Raft, SWIM, Lifeguard, Anti-Entropy, locking topics type/ci Relating to continuous integration (CI) tooling for testing or releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants