-
Notifications
You must be signed in to change notification settings - Fork 780
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
Embed Ingester metrics into struct #1527
Embed Ingester metrics into struct #1527
Conversation
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
I think this change only addresses a small part of the problems. It's essentially only moving the registration into the constructor, but still registers everything with the global registry. That's certainly an improvement, but you could have it much simpler (by not using There are many ways to do it, but I see a certain convergence onto something like in prometheus/tsdb. Check out https://github.com/prometheus/tsdb/blob/master/db.go#L426 and take it from there. They are also using a metrics |
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
@beorn7 Thanks for the feedback, I updated this PR to reflect your suggestions. |
I'll have a detailed look ASAP (but perhaps not tonight… 😴 ). |
I like the pattern, but what is the scope you want to remove metrics for? It looks like you only removed the metrics from |
I think this is just meant as an incremental step to try things out, with the goal of converting all metrics in the package to the same pattern eventually. |
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 incremental step looks good. If you want to add more metrics from the ingester package to the struct I am happy to review again though!
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.
seems legit
Relates To: #1512
This PR embeds the metrics from the ingester into the ingester struct. This means they will only be initialized if an ingester struct is initialized.
I avoided embedding a prometheus Registerer into the config and passing it because we do not currently use non-default registerers anywhere in cortex. Down the line we may want to consider this approach.
Signed-off-by: Jacob Lisi jacob.t.lisi@gmail.com