use of com.navercorp.pinpoint.grpc.trace.PCustomMetric 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();
}
use of com.navercorp.pinpoint.grpc.trace.PCustomMetric in project pinpoint by naver.
the class GrpcCustomMetricMessageConverter method createIntGaugeMetric.
private PCustomMetric createIntGaugeMetric(String metricName, CustomMetricVo[] customMetricVos) {
PIntGaugeMetric.Builder intGaugeMetricBuilder = PIntGaugeMetric.newBuilder();
intGaugeMetricBuilder.setName(metricName);
for (CustomMetricVo customMetricVo : customMetricVos) {
if (customMetricVo instanceof IntGaugeMetricVo) {
int value = ((IntGaugeMetricVo) customMetricVo).getValue();
intGaugeMetricBuilder.addValues(createIntValue(value));
} else {
intGaugeMetricBuilder.addValues(createNotSetIntValue());
}
}
PCustomMetric.Builder customMetricBuilder = PCustomMetric.newBuilder();
customMetricBuilder.setIntGaugeMetric(intGaugeMetricBuilder.build());
return customMetricBuilder.build();
}
use of com.navercorp.pinpoint.grpc.trace.PCustomMetric in project pinpoint by naver.
the class GrpcCustomMetricMessageConverter method createLongGaugeMetric.
private PCustomMetric createLongGaugeMetric(String metricName, CustomMetricVo[] customMetricVos) {
PLongGaugeMetric.Builder longGaugeMetricBuilder = PLongGaugeMetric.newBuilder();
longGaugeMetricBuilder.setName(metricName);
for (CustomMetricVo customMetricVo : customMetricVos) {
if (customMetricVo instanceof LongGaugeMetricVo) {
long value = ((LongGaugeMetricVo) customMetricVo).getValue();
longGaugeMetricBuilder.addValues(createLongValue(value));
} else {
longGaugeMetricBuilder.addValues(createNotSetLongValue());
}
}
PCustomMetric.Builder customMetricBuilder = PCustomMetric.newBuilder();
customMetricBuilder.setLongGaugeMetric(longGaugeMetricBuilder.build());
return customMetricBuilder.build();
}
use of com.navercorp.pinpoint.grpc.trace.PCustomMetric 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();
}
use of com.navercorp.pinpoint.grpc.trace.PCustomMetric in project pinpoint by naver.
the class GrpcCustomMetricMessageConverter method createDoubleGaugeMetric.
private PCustomMetric createDoubleGaugeMetric(String metricName, CustomMetricVo[] customMetricVos) {
PDouleGaugeMetric.Builder doubleGaugeMetricBuilder = PDouleGaugeMetric.newBuilder();
doubleGaugeMetricBuilder.setName(metricName);
for (CustomMetricVo customMetricVo : customMetricVos) {
if (customMetricVo instanceof DoubleGaugeMetricVo) {
double value = ((DoubleGaugeMetricVo) customMetricVo).getValue();
doubleGaugeMetricBuilder.addValues(createDoubleValue(value));
} else {
doubleGaugeMetricBuilder.addValues(createNotSetDoubleValue());
}
}
PCustomMetric.Builder customMetricBuilder = PCustomMetric.newBuilder();
customMetricBuilder.setDoubleGaugeMetric(doubleGaugeMetricBuilder.build());
return customMetricBuilder.build();
}
Aggregations