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