Package com.netflix.servo

Examples of com.netflix.servo.Metric


public class RegexMetricFilterTest {

    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 class CompositeMetricPollerTest {

    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

        .build();

    private List<Metric> mkList(int v) {
        ImmutableList.Builder<Metric> builder = ImmutableList.builder();
        for (int i = 0; i < v; ++i) {
            builder.add(new Metric("m", TAGS, 0L, i));
        }
        return builder.build();
    }
View Full Code Here

import static org.testng.Assert.assertEquals;

public class NormalizationTransformTest {
    Metric newMetric(long t, double v) {
        return new Metric(MonitorConfig.builder("test").build(), t, v);
    }
View Full Code Here

                TimeUnit.MILLISECONDS, clock);

        int i = 0;
        for (Metric m : input) {
            transform.update(ImmutableList.of(m));
            Metric result = mmo.getObservations().get(0).get(0);
            assertEquals(TimeVal.from(result), expected.get(i));
            i++;
        }
    }
View Full Code Here

    private List<Metric> getValue(List<? extends AbstractMonitor<Number>> monitors, Clock clock) {
        List<Metric> result = Lists.newArrayList();
        for (AbstractMonitor<Number> m : monitors) {
            Number n = m.getValue(0);
            Metric metric = new Metric(m.getConfig(), clock.now(), n);
            result.add(metric);
        }
        return result;
    }
View Full Code Here

                new CounterToRateMetricTransform(normalizationTransform, 60,
                        120, TimeUnit.SECONDS, manualClock);

        manualClock.set(30000L);
        c1.increment();
        Metric m1 = new Metric(c1.getConfig(), manualClock.now(), c1.getValue(0));

        toRateMetricTransform.update(ImmutableList.of(m1));
        assertEquals(NormalizationTransform.HEARTBEAT_EXCEEDED.getValue(0).longValue(), 0);
        List<Metric> o = observer.getObservations().get(0);
        assertEquals(o.size(), 1);

        manualClock.set(100000L);
        Metric m2 = new Metric(c2.getConfig(), manualClock.now(), c2.getValue());
        toRateMetricTransform.update(ImmutableList.of(m2));
        assertEquals(NormalizationTransform.HEARTBEAT_EXCEEDED.getValue(0).longValue(), 0);

        manualClock.set(160000L);
        Metric m3 = new Metric(c3.getConfig(), manualClock.now(), c3.getValue());
        toRateMetricTransform.update(ImmutableList.of(m3));
        assertEquals(NormalizationTransform.HEARTBEAT_EXCEEDED.getValue(0).longValue(), 1);

    }
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.