GH-1068 - Switch to simple event type name for automatically created counters.
This commit is contained in:
@@ -94,7 +94,7 @@ public class CrossModuleEventCounterFactory implements ModulithEventMetrics {
|
||||
|
||||
private static final BiConsumer<Object, Builder> NO_OP = (event, builder) -> {};
|
||||
private static final Function<Object, Builder> DEFAULT_FACTORY = event -> Counter
|
||||
.builder(event.getClass().getName());
|
||||
.builder(event.getClass().getSimpleName());
|
||||
|
||||
public static final ModulithMetricsCustomizer DEFAULT = new ModulithMetricsCustomizer(Object.class, NO_OP);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.modulith.observability.support.CrossModuleEventCounterFactory;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link CrossModuleEventCounterFactory}.
|
||||
@@ -43,7 +42,7 @@ class CrossModuleEventCounterFactoryUnitTests {
|
||||
factory.customize(SampleEvent.class, (__, builder) -> builder.tag("key", "value"));
|
||||
|
||||
assertCounter(new SampleEvent(), it -> {
|
||||
assertThat(it.getName()).isEqualTo(SampleEvent.class.getName());
|
||||
assertThat(it.getName()).isEqualTo(SampleEvent.class.getSimpleName());
|
||||
assertThat(it.getTag("key")).isNotNull();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user