Search in sources :

Example 1 with LongCountMetricVo

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

the class GrpcCustomMetricMessageConverter method createLongCountMetric.

// raw data              : 10, 12, 13, 14, 14
// count metric format   : 10, 2, 1, 1, 0
private PCustomMetric createLongCountMetric(String metricName, CustomMetricVo[] customMetricVos) {
    PLongCountMetric.Builder longCountMetricBuilder = PLongCountMetric.newBuilder();
    longCountMetricBuilder.setName(metricName);
    long prevValue = 0;
    for (CustomMetricVo customMetricVo : customMetricVos) {
        if (customMetricVo instanceof LongCountMetricVo) {
            long value = ((LongCountMetricVo) customMetricVo).getValue();
            longCountMetricBuilder.addValues(createLongValue(value - prevValue));
            prevValue = value;
        } else {
            longCountMetricBuilder.addValues(createNotSetLongValue());
        }
    }
    PCustomMetric.Builder customMetricBuilder = PCustomMetric.newBuilder();
    customMetricBuilder.setLongCountMetric(longCountMetricBuilder.build());
    return customMetricBuilder.build();
}
Also used : PLongCountMetric(com.navercorp.pinpoint.grpc.trace.PLongCountMetric) CustomMetricVo(com.navercorp.pinpoint.profiler.monitor.metric.custom.CustomMetricVo) PCustomMetric(com.navercorp.pinpoint.grpc.trace.PCustomMetric) LongCountMetricVo(com.navercorp.pinpoint.profiler.monitor.metric.custom.LongCountMetricVo)

Aggregations

PCustomMetric (com.navercorp.pinpoint.grpc.trace.PCustomMetric)1 PLongCountMetric (com.navercorp.pinpoint.grpc.trace.PLongCountMetric)1 CustomMetricVo (com.navercorp.pinpoint.profiler.monitor.metric.custom.CustomMetricVo)1 LongCountMetricVo (com.navercorp.pinpoint.profiler.monitor.metric.custom.LongCountMetricVo)1