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

Fix some invalid metrics definitions #4465

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

MichaelSnowden
Copy link
Contributor

What changed?
These metrics were defined incorrectly: the type of metric actually emitted does not match the metric type in their definition. I found this out when I was working on another change here: 05c26a8

There is still an issue in the archiver metrics code, but it's trickier to fix because, there, not only does the emitted type not match the defined type, but the emitted type is probably not what we want (we probably do want a bytes histogram instead of a counter there), so I'm saving it for a separate PR: 05c26a8#diff-9a79cb5619e22e12ac9cc70a86968b3fce9735922fc7a8f0394664e0ef4bca50L200-L201

Why?
I'm working on fixing this metrics interface, and one of the required changes will be to ensure that metrics definitions actually match the emission type, i.e. you can't do .Counter(NewGaugeDef(...).GetMetricName())

How did you test it?
I made a commit that verifies, at compile time, that the types of metrics definitions provided to the metrics.Handler methods, match the type expected by those methods, and that commit builds (at least locally): 7a0ccd1

Potential risks

Is hotfix candidate?

@MichaelSnowden MichaelSnowden requested a review from a team as a code owner June 9, 2023 05:10
@@ -1470,10 +1470,10 @@ var (
ReplicationTasksRecvBacklog = NewDimensionlessHistogramDef("replication_tasks_recv_backlog")
ReplicationTasksApplied = NewCounterDef("replication_tasks_applied")
ReplicationTasksFailed = NewCounterDef("replication_tasks_failed")
ReplicationTasksLag = NewTimerDef("replication_tasks_lag")
ReplicationTasksLag = NewDimensionlessHistogramDef("replication_tasks_lag")
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this will change the histogram buckets used? It looks like NewTimerDef would cause it to use Milliseconds buckets? But the default for Dimensionless is the same as Milliseconds up to 100,000, so that's probably fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh whoops, yeah that's a good catch. I think it could cause issues for people who overwrote the bucket boundaries originally. I'd at least like to put a comment in the release notes--making a v2 of this metric is probably overkill though.

@MichaelSnowden MichaelSnowden merged commit a6ae651 into master Jun 12, 2023
6 of 7 checks passed
@MichaelSnowden MichaelSnowden deleted the snowden/broken-metrics-types branch June 12, 2023 19:55
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.

None yet

2 participants