[WIP] Add TSDB statistics collector #103
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a very naive attempt to enrich metrics usage with statistics.
The PR adds a new TSDB collector which polls the
/api/v1/status/tsdbendpoint for the top-N metrics and grabs the number of series broken down by label for the matched metrics.Configuration example:
Output example:
{ "up": { "labels": [ "instance", "job" ], "statistics": { "period": 60, "series_count": 6, "label_value_count_by_label_name": [ { "name": "instance", "value": 6 }, { "name": "job", "value": 6 } ] }, "usage": { "alertRules": [ { "prom_link": "http://localhost:9090/", "group_name": "node", "name": "InstancesPerJobDown", "expression": "1 - avg by (job) (up) >= 0.5" } ] } } }