Search in sources :

Example 1 with IntCountMetricVo

use of com.navercorp.pinpoint.profiler.monitor.metric.custom.IntCountMetricVo in project pinpoint by naver.

the class GrpcCustomMetricMessageConverter method createIntCountMetric.

// raw data              : 10, 12, 13, 14, 14
// count metric format   : 10, 2, 1, 1, 0
private PCustomMetric createIntCountMetric(String metricName, CustomMetricVo[] customMetricVos) {
    PIntCountMetric.Builder intCountMetricBuilder = PIntCountMetric.newBuilder();
    intCountMetricBuilder.setName(metricName);
    int prevValue = 0;
    for (CustomMetricVo customMetricVo : customMetricVos) {
        if (customMetricVo instanceof IntCountMetricVo) {
            int value = ((IntCountMetricVo) customMetricVo).getValue();
            intCountMetricBuilder.addValues(createIntValue(value - prevValue));
            prevValue = value;
        } else {
            intCountMetricBuilder.addValues(createNotSetIntValue());
        }
    }
    PCustomMetric.Builder customMetricBuilder = PCustomMetric.newBuilder();
    customMetricBuilder.setIntCountMetric(intCountMetricBuilder.build());
    return customMetricBuilder.build();
}
Also used : PIntCountMetric(com.navercorp.pinpoint.grpc.trace.PIntCountMetric) IntCountMetricVo(com.navercorp.pinpoint.profiler.monitor.metric.custom.IntCountMetricVo) CustomMetricVo(com.navercorp.pinpoint.profiler.monitor.metric.custom.CustomMetricVo) PCustomMetric(com.navercorp.pinpoint.grpc.trace.PCustomMetric)

Aggregations

PCustomMetric (com.navercorp.pinpoint.grpc.trace.PCustomMetric)1 PIntCountMetric (com.navercorp.pinpoint.grpc.trace.PIntCountMetric)1 CustomMetricVo (com.navercorp.pinpoint.profiler.monitor.metric.custom.CustomMetricVo)1 IntCountMetricVo (com.navercorp.pinpoint.profiler.monitor.metric.custom.IntCountMetricVo)1