mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 12:08:03 +01:00
adjust lettuce metric denial for post-transform name
This commit is contained in:
committed by
ravi-signal
parent
b6ee074149
commit
ed6a2c55eb
@@ -5,8 +5,13 @@
|
||||
|
||||
package org.whispersystems.textsecuregcm.metrics;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import io.micrometer.core.instrument.Meter;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
@@ -19,4 +24,25 @@ class MetricsUtilTest {
|
||||
assertEquals("chat.MetricsUtilTest.namespace.metric",
|
||||
MetricsUtil.name(MetricsUtilTest.class, "namespace", "metric"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void lettuceRejection() {
|
||||
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();
|
||||
final List<Meter> 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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user