add metrics for log counts - #48429
Merged
Merged
Conversation
clintjedwards
approved these changes
Sep 11, 2026
clintjedwards
left a comment
Contributor
There was a problem hiding this comment.
Love it.
My only criticism is I probably wouldn't tally all logs, since its pretty rare for me to care about alerting on Info or Debug or even Warn logs.
But, I doubt the cardinality increase by tracking each distinct level matters at all and it might be good to look at in a pinch for extra data. So full steam ahead.
Member
Author
|
Yeah, I agree only error and warn levels are interesting here, so we could consider limiting the counts to those levels. Note that since only levels within the configured log level are counted, a production system in practice might only produce error+warn level counts anyway. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 adds a
log_messages_totalprometheus metric with alevellabel, for counting produced log messages. Only messages actually logged (i.e. not filtered out by a level filter) are counted.Example:
These metrics should make it possible to monitor for error-level logs by checking counters rather than log scanning, which can be cheaper and allow for more powerful alerting conditions.