Skip to content

Commit

Permalink
Make descriptions static where they are not (#3201)
Browse files Browse the repository at this point in the history
Since the description of the Meters can be different per Meter, we can run into situations when the description is dynamic/different for different Meter.Ids that share the same name but differ in tags. Some backends do not support different description per time series, so whichever is registered first will be used, and it can be confusing as the description is specific to one set of tag values.
  • Loading branch information
jonatan-ivanov authored May 27, 2022
1 parent 2472f92 commit f89d384
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ public void bindTo(MeterRegistry registry) {
for (Thread.State state : Thread.State.values()) {
Gauge.builder("jvm.threads.states", threadBean, (bean) -> getThreadStateCount(bean, state))
.tags(Tags.concat(tags, "state", getStateTagValue(state)))
.description("The current number of threads having " + state + " state")
.baseUnit(BaseUnits.THREADS).register(registry);
.description("The current number of threads").baseUnit(BaseUnits.THREADS).register(registry);
}
}
catch (Error error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,19 @@ class MetricsTurboFilter extends TurboFilter {

MetricsTurboFilter(MeterRegistry registry, Iterable<Tag> tags) {
errorCounter = Counter.builder("logback.events").tags(tags).tags("level", "error")
.description("Number of error level events that made it to the logs").baseUnit(BaseUnits.EVENTS)
.register(registry);
.description("Number of events that made it to the logs").baseUnit(BaseUnits.EVENTS).register(registry);

warnCounter = Counter.builder("logback.events").tags(tags).tags("level", "warn")
.description("Number of warn level events that made it to the logs").baseUnit(BaseUnits.EVENTS)
.register(registry);
.description("Number of events that made it to the logs").baseUnit(BaseUnits.EVENTS).register(registry);

infoCounter = Counter.builder("logback.events").tags(tags).tags("level", "info")
.description("Number of info level events that made it to the logs").baseUnit(BaseUnits.EVENTS)
.register(registry);
.description("Number of events that made it to the logs").baseUnit(BaseUnits.EVENTS).register(registry);

debugCounter = Counter.builder("logback.events").tags(tags).tags("level", "debug")
.description("Number of debug level events that made it to the logs").baseUnit(BaseUnits.EVENTS)
.register(registry);
.description("Number of events that made it to the logs").baseUnit(BaseUnits.EVENTS).register(registry);

traceCounter = Counter.builder("logback.events").tags(tags).tags("level", "trace")
.description("Number of trace level events that made it to the logs").baseUnit(BaseUnits.EVENTS)
.register(registry);
.description("Number of events that made it to the logs").baseUnit(BaseUnits.EVENTS).register(registry);
}

@Override
Expand Down

0 comments on commit f89d384

Please sign in to comment.