-
Notifications
You must be signed in to change notification settings - Fork 853
WIP: new metrics emitter and histogram strategy #7201
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
base: master
Are you sure you want to change the base?
Conversation
t.metrics.replicationLag( | ||
t.ackLevels.UpdateIfNeededAndGetQueueMaxReadLevel(persistence.HistoryTaskCategoryReplication, pollingCluster), | ||
taskInfos, | ||
msgs, | ||
t.scope, | ||
) |
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 done it this way mostly because:
- the metrics-func is private and local to this file, so it's not too concerning to have it depend on excessively-large objects
- each argument is a unique type, so it's not possible to pass them wrong (the main alternative is to pass three integers).
common/metrics/structured/base.go
Outdated
var Module = fx.Provide(func(s tally.Scope) Emitter { | ||
return Emitter{scope: s} | ||
}) |
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.
this is the only constructor, outside tests. makes it fairly likely that I've got my fx / resource / context / etc injection correct.
// TODO: this can / likely should be turned into an interface to allow disconnecting from tally, | ||
// to allow providing a specific version or to drop it entirely if desired. |
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 haven't built that here because the PR is already large, and it's a fair bit simpler to not introduce an interface.
but the resulting Emitter API is very simple compared to Tally, seems likely to be fairly easy to turn into an interface and build a different impl if needed.
@@ -0,0 +1,476 @@ | |||
package main |
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.
needs a moderate amount of cleanup / "report bad tag formats on the line of code that has the tag, not via a log.Fatal", but you get the idea.
Proof of concept on display.
This is an attempt to move away from our opaque and broadly-disliked metrics system, and towards two major changes:
Once this runs in prod for a bit, so I have more data to play with, I'll build alerts and dashboards based on the new data, and we can check the runtime cost of these new metrics.
I've selected moderately-used and rather-expensive (high cardinality, high number of calls) metrics for this first one, to try to give us a realistic sample.