-
Notifications
You must be signed in to change notification settings - Fork 453
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
Count active metrics that match given query within each tenant #37
Comments
Can you use an exporter that just does a count |
How can we do that for all tenants? |
Plus, we would be potentially opening the TSDBs for tenants who don't have any active metrics, right? |
Using an exporter would require a deployment per cluster right? And then the process itself would be querying for cluster data to then store it back as a metric. So we thought we might just generate the metric from service itself and save us the overhead of the exporter. |
I'm not sure about the exporter. I see two issues:
Because of this, I'm in favour of adding the support directly into Mimir. Now going to review the proposal. |
The proposal LGTM, but I've some small feedback. Thanks!
I would say not a "pre-configured query", but "label matchers". I know it's just wording, but with "query" we mean a different thing.
I would suggest to call it
We learned the hard way it's not easy to handle multiple flags (eg. you can't do it in jsonnet with our config setup, but you need to inject custom args in the container, which is annoying). I would avoid it. You could use a semicolon-separated string.
Based on my feedback above, I would call the metric |
Thanks, I already started implementing in #42, still pending tests and apply this feedback. I was also considering exporting the matcher itself as a label, apart from the |
I have mixed feelings. Looks an anti-pattern to me. |
Added doc-generator.ExamplerConfig interface that can be implemented to provide an optional comment and yaml example for the configuration. Rendered that in the documentation section. Ref: #42 (comment) Ref: #37 Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
* Provide example config for active_series_custom_trackers Added doc-generator.ExamplerConfig interface that can be implemented to provide an optional comment and yaml example for the configuration. Rendered that in the documentation section. Ref: #42 (comment) Ref: #37 Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> * Print the example before the flag Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com> * Indent the example Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
Is your feature request related to a problem? Please describe.
We need a gauge metric that provides the number of active series within each tenant that match a pre-configured query.
I.e., we want to know how many active metrics match
{foo="bar",...}
Describe the solution you'd like
We want to add a configuration to the Ingester, called
active_matching_series
, which is a slice of structs:Same configuration can be provided by using multiple
ingester.active-matching-series
flags, each one with a value built as<name>:<matcher>
, for example:--ingester.active-matching-series='foobar:{foo="bar"}'
A new gauge would be defined in
ingesterMetrics
as:When the ingester is instantiated, we'll instantiate an implementation of this interface:
We would modify the
activeSeriesStripe
to contain a slice of counters, one for each of the matchers:And we'll add a
matches []bool
to theactiveSeriesEntry
struct, which is the most critical part as this is where we'll consume memory. Givenn
the number of matches, we would consume8*3 (slice ptr, cap & len) + n
bytes more per each metric, plus the slice pointer pressure on the garbage collector. With 1M series per ingester, this would be 24MB per ingester plus one megabyte per each of the matchers provided, which isn't a big deal.This slice would be filled once, when creating the series, using the previous interface, as
ActiveSeries
would hold an instance of it. We'll use this bool mask to increase the counters inactiveSeriesStripe.activeMatching
just like we do withactive
, that'sO(n*m)
withn
series andm
matchers.Then we'll modify the signature of
func (c *ActiveSeries) Active() int
tofunc (c *ActiveSeries) Active() (int, []int)
so it would return the number of series matching each one of the matchers too. Counting those would beO(m)
withm
the number of matchers, as each one of the stripes would provide it's own count.Describe alternatives you've considered
Questions
Do we need to modify the
userState
? I don't have enough context on that one yet (maybe I'll see better once I start implementing this).The text was updated successfully, but these errors were encountered: