-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
chore: armon/go-metrics => hashicorp/go-metrics
#24268
chore: armon/go-metrics => hashicorp/go-metrics
#24268
Conversation
…cs to hashicorp/go-metrics and bumped to version 0.5.3
@@ -97,6 +96,7 @@ require ( | |||
github.com/hashicorp/go-kms-wrapping/wrappers/ocikms/v2 v2.0.7 | |||
github.com/hashicorp/go-kms-wrapping/wrappers/transit/v2 v2.0.8 | |||
github.com/hashicorp/go-memdb v1.3.4 | |||
github.com/hashicorp/go-metrics v0.5.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version bump: 0.5.1
(indirect) => 0.5.3
(direct)
@@ -73,7 +72,7 @@ require ( | |||
github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 | |||
github.com/google/go-cmp v0.5.9 | |||
github.com/google/go-github v17.0.0+incompatible | |||
github.com/google/go-metrics-stackdriver v0.2.0 | |||
github.com/google/go-metrics-stackdriver v0.6.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version bump: 0.2.0
=> 0.6.0
"github.com/armon/go-metrics/circonus" | ||
"github.com/armon/go-metrics/datadog" | ||
"github.com/armon/go-metrics/prometheus" | ||
monitoring "cloud.google.com/go/monitoring/apiv3/v2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using v2
now.
@@ -23,6 +22,7 @@ require ( | |||
github.com/hashicorp/go-immutable-radix v1.3.1 | |||
github.com/hashicorp/go-kms-wrapping/entropy/v2 v2.0.0 | |||
github.com/hashicorp/go-kms-wrapping/v2 v2.0.8 | |||
github.com/hashicorp/go-metrics v0.5.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved SDK dependency armon/go-metrics
to hashicorp/go-metrics
and bumped 0.4.1
=> 0.5.3
CI Results: |
@@ -1828,6 +1828,7 @@ listener "tcp" { | |||
"Samples", | |||
"Timestamp", | |||
"Gauges", | |||
"PrecisionGauges", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2660,6 +2660,7 @@ listener "tcp" { | |||
"Samples", | |||
"Timestamp", | |||
"Gauges", | |||
"PrecisionGauges", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
armon/go-metrics => hashicorp/go-metrics
armon/go-metrics => hashicorp/go-metrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job Pete!
Thinking this through... I'm pretty sure this is going to break a lot of things related to metrics due to the (unfortunate IMO) design choices in go-metrics.
The fact that metrics uses global state to setup sinks and instrumentation means that if any libraries are still using the armon
version, those metrics are suddenly going to dissapear from Vault's actual metrics collection which will now be using hashicorp
right?
At first I thought we'd need to go and fix every one of those deps you listed before we can merge, but actually I think it would be sufficient to also add a
replace github.com/armon/go-metrics => github.com/hashicorp/go-metrics
Bit we'd need to verify this - it would be great to build before and after this PR and verify that all those library's metrics (e.g. Raft metrics) are still present! It's complicated further by the fact that only metrics reported recently are actually output (anther design issues 😢 ) so it's not trivial to just start vault and hit the metrics endpoint once - we may need to actually ensure things happen to see the metrics. The good news is that as long as we have one metric from each library in your list (that currently outputs metrics) that's OK we don't need to figure out how to trigger every single metric to be output!
Blimey that was fast. 😄 Would the problem of global state not have existed previously since we had the indirect reference to
Sad about the amount of testing we'd require to be OK with this though, eeek. |
Build Results: |
Closing #21130 |
One idea is to use an HCPV cluster with a custom binary to test this out. There's an amount of work required to enable the observability provider and so on, but not sure how you plan on testing this. In any case, I'm excited to see this finally being done! |
I've realised I'm probably wrong here since we actually renamed the repo anyway. I was thinking theyd import as differnt modules but actually since we renamed/redirected and updated to go.mod, I think both paths will end up importing the same module under the declared name But yeah we should double check that - e.g. that library metrics are still being emitted. If they are then I think this is fine and we don't need a huge effort to check every single library since they will all work the same way! That probable means the replace directive is unnecessary too? Sorry for the noise! |
8dc9738
to
7808f4c
Compare
…o-hashicorp-go-metrics
…swap-armon-go-metrics-to-hashicorp-go-metrics
…o-hashicorp-go-metrics
…o-hashicorp-go-metrics
…swap-armon-go-metrics-to-hashicorp-go-metrics
…swap-armon-go-metrics-to-hashicorp-go-metrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've realised I'm probably wrong
Wrong again!
Actually this was a legitimate concern that we have now confirmed and that Nomad also discovered independently.
The issue is that despite the redirect which makes it appear to work fine if you mix armon/
and hashicorp/
imports in a greenfield project, all our products (and other projects no doubt that use our libraries) are currently pinned to a version of go-metrics
from before 0.5.0 where the module name was changed.
That means that although the import redirects to hashicorp/
to fetch the code, it's checking out a version of the module whose go.mod
still calls itself armon/go-metrics
.
That results in Consul, Vault and Nomad setting up and configuring metrics syncs on the armon
flavour global metrics instance, while any dependencies that happen to import hashicorp/go-metrics
would likely end up on a newer version that calls itslef hashicorp/go-metrics
and so their metrics will be reported to a different singleton instance than the one that we are actually outputting from and their metrics will be lost!
Conversely, if any of our products change imports and/or upgrade go-metrics
to 0.5.0 or higher, we will loose all the metrics being reported to the older armon/go-metrics import.
There may be some way out of this cleanly but a few folks have looked and it's seeming like a v2 of all our libs will be needed to make the breaking change necessary potentially.
So much as I'd love to resolve this.... this PR should be held back until we work out the strategy across all our products!
…swap-armon-go-metrics-to-hashicorp-go-metrics
This PR is intended to remove the direct dependency within Vault on armon/go-metrics in favor of hashicorp/go-metrics. This should make life easier when we want to update versions going foward.
In addition it also bumps the version to
0.5.3
based on hashicorp/go-metrics#146.Using
go mod graph | grep ' github.com/armon/go-metrics@v\d.\d.\d$'
we can identify indirect dependencies onarmon/go-metrics
in other packages used by Vault, which may require their own PRs if they decide to move away from the library. It would be worth checking each package repo to see if they have tagged newer versions which have already moved tohashicorp/go-metrics
and then update Vault to reference them.