Package com.netflix.servo

Examples of com.netflix.servo.Metric


public class BasicGraphiteNamingConventionTest {

    @Test
    public void testJmxNaming() throws Exception {
        Metric m = getOSMetric("AvailableProcessors");

        GraphiteNamingConvention convention = new BasicGraphiteNamingConvention();
        String name = convention.getName(m);

        assertEquals(name, "java.lang.OperatingSystem.AvailableProcessors");
View Full Code Here


        assertEquals(name, "java.lang.OperatingSystem.AvailableProcessors");
    }

    @Test
    public void testMetricNamingEmptyTags() throws Exception {
        Metric m = new Metric("simpleMonitor", SortedTagList.EMPTY, 0, 1000.0);

        GraphiteNamingConvention convention = new BasicGraphiteNamingConvention();
        String name = convention.getName(m);

        assertEquals(name, "simpleMonitor");
View Full Code Here

    @Test
    public void testMetricNamingWithTags() throws Exception {
        TagList tagList = BasicTagList.of("instance", "GetLogs", DataSourceType.KEY,
                "HystrixCommand");

        Metric m = new Metric("simpleMonitor", tagList, 0, 1000.0);

        GraphiteNamingConvention convention = new BasicGraphiteNamingConvention();
        String name = convention.getName(m);

        assertEquals(name, "HystrixCommand.GetLogs.simpleMonitor");
View Full Code Here

import static org.testng.Assert.assertTrue;

public class AsyncMetricObserverTest {

    private List<Metric> mkList(int v) {
        return ImmutableList.of(new Metric("m", SortedTagList.EMPTY, 0L, v));
    }
View Full Code Here

        .withTag(DataSourceType.COUNTER)
        .build();

    private List<Metric> mkList(long ts, int value) {
        return ImmutableList.of(
            new Metric("m1", SortedTagList.EMPTY, ts, value),
            new Metric("m2", GAUGE, ts, value),
            new Metric("m3", COUNTER, ts, value)
        );
    }
View Full Code Here

public class PrefixMetricFilterTest {

    private List<Metric> mkList() {
        return ImmutableList.of(
                new Metric("m1", SortedTagList.EMPTY, 0L, 0),
                new Metric("m2", SortedTagList.builder().withTag("c", "a.b.c.d.M1").build(), 0L, 0),
                new Metric("m3", SortedTagList.builder().withTag("c", "a.b.c.c.M3").build(), 0L, 0),
                new Metric("m4", SortedTagList.builder().withTag("c", "a.b.c.d.M4").build(), 0L, 0),
                new Metric("m5", SortedTagList.builder().withTag("c", "a.a.a.a.M5").build(), 0L, 0)
        );
    }
View Full Code Here

    public void testBasic() throws Exception {
        MonitorRegistry registry = new BasicMonitorRegistry();
        registry.register(Monitors.newCounter("test"));

        MetricPoller poller = new MonitorRegistryMetricPoller(registry);
        Metric metric = poller.poll(MATCH_ALL).get(0);
        MonitorConfig expected = MonitorConfig.builder("test")
            .withTag(DataSourceType.COUNTER)
            .build();
        assertEquals(metric.getConfig(), expected);
    }
View Full Code Here

        registry.register(new SlowCounter("slow"));
        registry.register(Monitors.newCounter("test"));

        MetricPoller poller = new MonitorRegistryMetricPoller(registry);
        long start = System.currentTimeMillis();
        Metric metric = poller.poll(MATCH_ALL).get(0);
        long end = System.currentTimeMillis();

        // Verify we didn't wait too long, we should only wait 1 second but allow up to
        // 10 to make it less likely to have spurious test failures
        assertTrue(end - start < TEN_SECONDS);

        MonitorConfig expected = MonitorConfig.builder("test")
            .withTag(DataSourceType.COUNTER)
            .build();
        assertEquals(metric.getConfig(), expected);
    }
View Full Code Here

public class BasicMetricFilterTest {

    private List<Metric> mkList() {
        return ImmutableList.of(
            new Metric("m1", SortedTagList.EMPTY, 0L, 0),
            new Metric("m2", SortedTagList.builder().withTag("c", "a.b.c.d.M1").build(), 0L, 0),
            new Metric("m3", SortedTagList.builder().withTag("c", "a.b.c.c.M3").build(), 0L, 0),
            new Metric("m4", SortedTagList.builder().withTag("c", "a.b.c.d.M4").build(), 0L, 0),
            new Metric("m5", SortedTagList.builder().withTag("c", "a.a.a.a.M5").build(), 0L, 0)
        );
    }
View Full Code Here

import static org.testng.Assert.assertEquals;

public class MemoryMetricObserverTest {

    private List<Metric> mkList(int v) {
        return ImmutableList.of(new Metric("m", SortedTagList.EMPTY, 0L, v));
    }
View Full Code Here

TOP

Related Classes of com.netflix.servo.Metric

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.