diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/metrics/MetricsUtil.java b/service/src/main/java/org/whispersystems/textsecuregcm/metrics/MetricsUtil.java index 194d8c1a4..d1e2af7d5 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/metrics/MetricsUtil.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/metrics/MetricsUtil.java @@ -77,7 +77,7 @@ public DistributionStatisticConfig configure(final Meter.Id id, final Distributi return defaultDistributionStatisticConfig.merge(config); } }) - // Remove high-cardinality `command` tags from Lettuce metrics and prepend "chat." to meter names + // Remove high-cardinality `command` and `remote` tags from Lettuce metrics and prepend "chat." to meter names .meterFilter(new MeterFilter() { @Override public Meter.Id map(final Meter.Id id) { @@ -85,17 +85,13 @@ public Meter.Id map(final Meter.Id id) { return id.withName(PREFIX + "." + id.getName()) .replaceTags(id.getTags().stream() .filter(tag -> !"command".equals(tag.getKey())) + .filter(tag -> !"remote".equals(tag.getKey())) .toList()); } return MeterFilter.super.map(id); } }) - // Deny lettuce metrics, but leave command.completions.max. Note that regardless of configured order, accept - // filters are applied after map filters. - .meterFilter(MeterFilter.deny(id -> - id.getName().startsWith(PREFIX + ".lettuce") && !id.getName().contains("command.completion.max") - )) .meterFilter(MeterFilter.denyNameStartsWith(PushLatencyManager.TIMER_NAME + ".percentile")) .meterFilter(MeterFilter.denyNameStartsWith(MessageMetrics.DELIVERY_LATENCY_TIMER_NAME + ".percentile")); } diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/metrics/MetricsUtilTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/metrics/MetricsUtilTest.java index 6825f4798..d253b216d 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/metrics/MetricsUtilTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/metrics/MetricsUtilTest.java @@ -26,23 +26,18 @@ void name() { } @Test - void lettuceRejection() { + void lettuceTagRejection() { MeterRegistry registry = new SimpleMeterRegistry(); MetricsUtil.configureMeterFilters(registry.config()); - registry.counter("lettuce.command.completion.count").increment(); - registry.counter("lettuce.command.firstresponse.max").increment(); - registry.counter("lettuce.test").increment(); - assertThat(registry.getMeters()).isEmpty(); - - // this lettuce statistic is allow-listed - registry.counter("lettuce.command.completion.max", "command", "hello", "remote", "world").increment(); + registry.counter("lettuce.command.completion.max", "command", "hello", "remote", "world", "allowed", "!").increment(); final List meters = registry.getMeters(); assertThat(meters).hasSize(1); Meter meter = meters.get(0); assertThat(meter.getId().getName()).isEqualTo("chat.lettuce.command.completion.max"); assertThat(meter.getId().getTag("command")).isNull(); - assertThat(meter.getId().getTag("remote")).isNotNull(); + assertThat(meter.getId().getTag("remote")).isNull(); + assertThat(meter.getId().getTag("allowed")).isNotNull(); } }