New program to generate Cortex usage stats from metrics #2654
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.
Currently, "samples" usage stats are sent to bigtable from Cortex Distributor pods as each request arrives. That's over 1,400 per second as of February 2020.
Since (a) this is very expensive for data we don't actually use in billing and (b) cortexproject/cortex#1491 will remove the hook from Distributor, I wrote this program to do it differently.
This program runs once a minute, querys Prometheus for the number of samples per instance in the last minute, then emits them to be sent by the billing-ingester sidecar as before. I'm sending them with the tag
metrics-samples
so this program can be run in parallel with the current distributor mechanism. Both appear on the admin/billing page.It will under-report if Prometheus is restarted, or if the program itself is down for several minutes.
Ref https://github.com/weaveworks/service-conf/issues/3712