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

Use same description for same meter name in Log4j2Metrics #4864

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class Log4j2Metrics implements MeterBinder, AutoCloseable {

private static final String METER_NAME = "log4j2.events";

private static final String METER_DESCRIPTION = "Number of log events";

private final Iterable<Tag> tags;

private final LoggerContext loggerContext;
Expand Down Expand Up @@ -156,42 +158,42 @@ class MetricsFilter extends AbstractFilter {
fatalCounter = Counter.builder(METER_NAME)
.tags(tags)
.tags("level", "fatal")
.description("Number of fatal level log events")
.description(METER_DESCRIPTION)
.baseUnit(BaseUnits.EVENTS)
.register(registry);

errorCounter = Counter.builder(METER_NAME)
.tags(tags)
.tags("level", "error")
.description("Number of error level log events")
.description(METER_DESCRIPTION)
.baseUnit(BaseUnits.EVENTS)
.register(registry);

warnCounter = Counter.builder(METER_NAME)
.tags(tags)
.tags("level", "warn")
.description("Number of warn level log events")
.description(METER_DESCRIPTION)
.baseUnit(BaseUnits.EVENTS)
.register(registry);

infoCounter = Counter.builder(METER_NAME)
.tags(tags)
.tags("level", "info")
.description("Number of info level log events")
.description(METER_DESCRIPTION)
.baseUnit(BaseUnits.EVENTS)
.register(registry);

debugCounter = Counter.builder(METER_NAME)
.tags(tags)
.tags("level", "debug")
.description("Number of debug level log events")
.description(METER_DESCRIPTION)
.baseUnit(BaseUnits.EVENTS)
.register(registry);

traceCounter = Counter.builder(METER_NAME)
.tags(tags)
.tags("level", "trace")
.description("Number of trace level log events")
.description(METER_DESCRIPTION)
.baseUnit(BaseUnits.EVENTS)
.register(registry);
}
Expand Down