Package com.netflix.servo.monitor

Examples of com.netflix.servo.monitor.LongGauge


            logger.error("Failed to unregister object with the servo registry.", e);
        }
    }

    public static LongGauge newLongGauge(String name) {
        return new LongGauge(MonitorConfig.builder(name).build());
    }
View Full Code Here


    public void testUpdate() throws Exception {
        BasicCounter basicCounter = new BasicCounter(MonitorConfig.builder("basicCounter").build());
        ManualClock manualClock = new ManualClock(0);
        StepCounter stepCounter = new StepCounter(MonitorConfig.builder("stepCounter").build(),
                manualClock);
        LongGauge gauge = new LongGauge(MonitorConfig.builder("longGauge").build());

        ImmutableList<? extends AbstractMonitor<Number>> monitors = ImmutableList.of(basicCounter,
                stepCounter, gauge);

        MemoryMetricObserver observer = new MemoryMetricObserver("normalization-test", 1);
        NormalizationTransform normalizationTransform = new NormalizationTransform(observer, 60,
                120, TimeUnit.SECONDS, manualClock);
        CounterToRateMetricTransform toRateMetricTransform =
                new CounterToRateMetricTransform(normalizationTransform, 60,
                        120, TimeUnit.SECONDS, manualClock);

        double[] rates = {0.5 / 60.0, 2 / 60.0, 3 / 60.0, 4 / 60.0};
        double[] expectedNormalized = {
                rates[0] * (2.0 / 3.0), // 20000L over stepBoundary
                rates[0] * (1.0 / 3.0) + rates[1] * (2.0 / 3.0),
                rates[1] * (1.0 / 3.0) + rates[2] * (2.0 / 3.0),
                rates[2] * (1.0 / 3.0) + rates[3] * (2.0 / 3.0)};

        for (int i = 1; i < 5; ++i) {
            long now = 20000L + i * 60000L;
            long stepBoundary = i * 60000L;
            manualClock.set(now);
            basicCounter.increment(i);
            stepCounter.increment(i);
            gauge.set((long) i);
            List<Metric> metrics = getValue(monitors, manualClock);
            toRateMetricTransform.update(metrics);

            List<Metric> o = observer.getObservations().get(0);
            assertEquals(o.size(), 3);
View Full Code Here

TOP

Related Classes of com.netflix.servo.monitor.LongGauge

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.