Search in sources :

Example 1 with MetricSample

use of com.linkedin.cruisecontrol.monitor.sampling.MetricSample in project cruise-control by linkedin.

the class CruiseControlUnitTestUtils method populateSampleAggregator.

public static <G, E extends Entity<G>> void populateSampleAggregator(int numWindows, int numSamplesPerWindow, MetricSampleAggregator<G, E> metricSampleAggregator, E entity, int startingWindow, long windowMs, MetricDef metricDef) {
    for (int i = startingWindow; i < numWindows + startingWindow; i++) {
        for (int j = 0; j < numSamplesPerWindow; j++) {
            MetricSample<G, E> sample = new MetricSample<>(entity);
            for (MetricInfo metricInfo : metricDef.all()) {
                sample.record(metricInfo, i * 10 + j);
            }
            sample.close(i * windowMs + 1);
            metricSampleAggregator.addSample(sample);
        }
    }
}
Also used : MetricSample(com.linkedin.cruisecontrol.monitor.sampling.MetricSample) MetricInfo(com.linkedin.cruisecontrol.metricdef.MetricInfo)

Example 2 with MetricSample

use of com.linkedin.cruisecontrol.monitor.sampling.MetricSample in project cruise-control by linkedin.

the class RawMetricValuesTest method getMetricSample.

private MetricSample<String, IntegerEntity> getMetricSample(float v1, float v2, float v3) {
    MetricSample<String, IntegerEntity> metricSample = new MetricSample<>(new IntegerEntity("group", 0));
    metricSample.record(_metricDef.metricInfo("metric1"), v1);
    metricSample.record(_metricDef.metricInfo("metric2"), v2);
    metricSample.record(_metricDef.metricInfo("metric3"), v3);
    metricSample.close(0);
    return metricSample;
}
Also used : MetricSample(com.linkedin.cruisecontrol.monitor.sampling.MetricSample) IntegerEntity(com.linkedin.cruisecontrol.IntegerEntity)

Aggregations

MetricSample (com.linkedin.cruisecontrol.monitor.sampling.MetricSample)2 IntegerEntity (com.linkedin.cruisecontrol.IntegerEntity)1 MetricInfo (com.linkedin.cruisecontrol.metricdef.MetricInfo)1