Search in sources :

Example 1 with AtlasConfig

use of com.netflix.spectator.atlas.AtlasConfig in project micrometer by micrometer-metrics.

the class SpectatorTimerTest method timerMax.

@Test
void timerMax() {
    AtlasConfig atlasConfig = k -> null;
    AtlasMeterRegistry registry = new AtlasMeterRegistry(atlasConfig, new MockClock());
    Timer timer = registry.timer("timer");
    timer.record(1, TimeUnit.SECONDS);
    clock(registry).add(atlasConfig.step());
    assertThat(timer.max(TimeUnit.MILLISECONDS)).isEqualTo(1000);
}
Also used : Test(org.junit.jupiter.api.Test) TimeUnit(java.util.concurrent.TimeUnit) AtlasConfig(com.netflix.spectator.atlas.AtlasConfig) Timer(io.micrometer.core.instrument.Timer) MockClock(io.micrometer.core.instrument.MockClock) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) MockClock.clock(io.micrometer.core.instrument.MockClock.clock) Timer(io.micrometer.core.instrument.Timer) AtlasConfig(com.netflix.spectator.atlas.AtlasConfig) MockClock(io.micrometer.core.instrument.MockClock) Test(org.junit.jupiter.api.Test)

Example 2 with AtlasConfig

use of com.netflix.spectator.atlas.AtlasConfig in project iep by Netflix.

the class AtlasRegistryServiceTest method validTagCharacters.

@Test
public void validTagCharacters() throws Exception {
    AtlasRegistryService service = new AtlasRegistryService();
    AtlasRegistry registry = (AtlasRegistry) service.getRegistry();
    AtlasConfig config = (AtlasConfig) registry.config();
    Assert.assertEquals("-._A-Za-z0-9", config.validTagCharacters());
    Assert.assertEquals("-._A-Za-z0-9^~", config.validTagValueCharacters().get("nf.cluster"));
    Assert.assertEquals("-._A-Za-z0-9^~", config.validTagValueCharacters().get("nf.asg"));
    Assert.assertNull(config.validTagValueCharacters().get("nf.zone"));
    service.stop();
}
Also used : AtlasConfig(com.netflix.spectator.atlas.AtlasConfig) AtlasRegistry(com.netflix.spectator.atlas.AtlasRegistry) Test(org.junit.Test)

Aggregations

AtlasConfig (com.netflix.spectator.atlas.AtlasConfig)2 AtlasRegistry (com.netflix.spectator.atlas.AtlasRegistry)1 MockClock (io.micrometer.core.instrument.MockClock)1 MockClock.clock (io.micrometer.core.instrument.MockClock.clock)1 Timer (io.micrometer.core.instrument.Timer)1 TimeUnit (java.util.concurrent.TimeUnit)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1