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();
}
Aggregations