Skip to content
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

Add tag "loggerName" to LogbackMetrics #2475

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michalkowol
Copy link

@michalkowol michalkowol commented Feb 25, 2021

Motivation

I find logback.events very useful to determine the overall condition of the system.logback.events with level=error is one of the most important metrics in few projects I am working on.

The missing was information which logger/class triggered that logback event.
To provide even greater insight I think this metric should also include loggerName.

I am testing in on prod (about 15K RPS) and it works very well. My whole team really appreciate this new ability to get a better understanding what happens in our system

image
image

@pivotal-issuemaster
Copy link

@michalkowol Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@michalkowol Thank you for signing the Contributor License Agreement!

@shakuzen shakuzen added the enhancement A general enhancement label Mar 3, 2021
Copy link
Member

@shakuzen shakuzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request. This is interesting and I can see how it would be useful. I do worry if it is a good default, however, given the potential for high cardinality. Perhaps it would be better to make this possible to configure without it being the default. We would also want to do something similar for our Log4j2Metrics.

// cannot use logger.isEnabledFor(level), as it would cause a StackOverflowError by calling this filter again!
if (level.isGreaterOrEqual(logger.getEffectiveLevel())) {
switch (level.toInt()) {
case Level.ERROR_INT:
errorCounter.increment();
getOrCreateErrorCounter(loggerName).increment();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"get or create" is already the behavior when registering a meter, so I don't think the Maps add value here unless I'm missing something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants