Filter out `command` tags from Lettuce metrics and prepend a "chat." prefix to Lettuce metric names

This commit is contained in:
Jon Chambers 2023-07-10 11:05:55 -04:00 committed by Jon Chambers
parent 25f759dd07
commit 8bf5ee45ed
1 changed files with 15 additions and 0 deletions

View File

@ -63,6 +63,21 @@ public class MetricsUtil {
}
});
// Remove high-cardinality `command` tags from Lettuce metrics and prepend "chat." to meter names
datadogMeterRegistry.config().meterFilter(new MeterFilter() {
@Override
public Meter.Id map(final Meter.Id id) {
if (id.getName().startsWith("lettuce")) {
return id.withName(PREFIX + "." + id.getName())
.replaceTags(id.getTags().stream()
.filter(tag -> !"command".equals(tag.getKey()))
.toList());
}
return MeterFilter.super.map(id);
}
});
Metrics.addRegistry(datadogMeterRegistry);
}