Examples of StepCounter


Examples of com.netflix.servo.monitor.StepCounter

    @Test
    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);
View Full Code Here

Examples of jp.sf.amateras.stepcounter.StepCounter

   *
   * @param file �t�@�C��
   * @return �t�@�C���ɑΉ�����{@link Cutter}�̎���
   */
  public static Cutter getCutter(File file) {
    StepCounter counter = StepCounterFactory.getCounter(file.getName());
    if(counter != null && counter instanceof Cutter){
      return (Cutter) counter;
    }
    return null;
  }
View Full Code Here

Examples of jp.sf.amateras.stepcounter.StepCounter

      }
      }
    }

    private CountResult count(File file) throws IOException {
    StepCounter counter = StepCounterFactory.getCounter(file.getName());
    if (counter != null) {
      return counter.count(file, Util.getFileEncoding(file));
    } else {
      return new CountResult(file, file.getName(), null, null, 0, 0, 0);
    }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.