in eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/metrics/http/HttpMetrics.java [210:498]
private void initMetrics() {
InstrumentFurther furtherHttpDiscard = new InstrumentFurther();
furtherHttpDiscard.setUnit(MetricInstrumentUnit.SINGLETON);
furtherHttpDiscard.setDescription("Http request discard num.");
furtherHttpDiscard.setName(HTTP_METRICS_NAME_PREFIX + "request.discard.num");
httpDiscardMetric = new LongCounterMetric(furtherHttpDiscard, METRIC_NAME);
metrics.put("httpDiscardMetric", httpDiscardMetric);
//sum of batch send message number
InstrumentFurther furtherSendBatchMsgNumSum = new InstrumentFurther();
furtherSendBatchMsgNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherSendBatchMsgNumSum.setDescription("Sum of batch send message number.");
furtherSendBatchMsgNumSum.setName(HTTP_METRICS_NAME_PREFIX + "batch.send.message.num");
sendBatchMsgNumSumMetric = new LongCounterMetric(furtherSendBatchMsgNumSum, METRIC_NAME);
metrics.put("sendBatchMsgNumSumMetric", sendBatchMsgNumSumMetric);
//sum of batch send message fail message number.
InstrumentFurther furtherSendBatchMsgFailNumSum = new InstrumentFurther();
furtherSendBatchMsgFailNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherSendBatchMsgFailNumSum.setDescription("Sum of batch send message fail message number.");
furtherSendBatchMsgFailNumSum.setName(HTTP_METRICS_NAME_PREFIX + "batch.send.message.fail.num");
sendBatchMsgFailNumSumMetric = new LongCounterMetric(furtherSendBatchMsgFailNumSum, METRIC_NAME);
metrics.put("sendBatchMsgFailNumSumMetric", sendBatchMsgFailNumSumMetric);
//sum of send batch message discard number.
InstrumentFurther furtherSendBatchMsgDiscardNumSum = new InstrumentFurther();
furtherSendBatchMsgDiscardNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherSendBatchMsgDiscardNumSum.setDescription("Sum of batch send message fail message number.");
furtherSendBatchMsgDiscardNumSum.setName(HTTP_METRICS_NAME_PREFIX + "batch.send.message.discard.num");
sendBatchMsgDiscardNumSumMetric = new LongCounterMetric(furtherSendBatchMsgDiscardNumSum, METRIC_NAME);
metrics.put("sendBatchMsgDiscardNumSumMetric", sendBatchMsgDiscardNumSumMetric);
//Sum of send message number.
InstrumentFurther furtherSendMsgNumSum = new InstrumentFurther();
furtherSendMsgNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherSendMsgNumSum.setDescription("Sum of send message number.");
furtherSendMsgNumSum.setName(HTTP_METRICS_NAME_PREFIX + "send.message.num");
sendMsgNumSumMetric = new LongCounterMetric(furtherSendMsgNumSum, METRIC_NAME);
metrics.put("sendMsgNumSumMetric", sendMsgNumSumMetric);
//Sum of send message fail number.
InstrumentFurther furtherSendMsgFailNumSum = new InstrumentFurther();
furtherSendMsgFailNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherSendMsgFailNumSum.setDescription("Sum of send message fail number.");
furtherSendMsgFailNumSum.setName(HTTP_METRICS_NAME_PREFIX + "send.message.fail.num");
sendMsgFailNumSumMetric = new LongCounterMetric(furtherSendMsgFailNumSum, METRIC_NAME);
metrics.put("sendMsgFailNumSumMetric", sendMsgFailNumSumMetric);
//Sum of reply message number.
InstrumentFurther furtherReplyMsgNumSum = new InstrumentFurther();
furtherReplyMsgNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherReplyMsgNumSum.setDescription("Sum of reply message number.");
furtherReplyMsgNumSum.setName(HTTP_METRICS_NAME_PREFIX + "reply.message.num");
replyMsgNumSumMetric = new LongCounterMetric(furtherReplyMsgNumSum, METRIC_NAME);
metrics.put("replyMsgNumSumMetric", replyMsgNumSumMetric);
//Sum of reply message fail number.
InstrumentFurther furtherReplyMsgFailNumSum = new InstrumentFurther();
furtherReplyMsgFailNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherReplyMsgFailNumSum.setDescription("Sum of reply message fail number.");
furtherReplyMsgFailNumSum.setName(HTTP_METRICS_NAME_PREFIX + "reply.message.fail.num");
replyMsgFailNumSumMetric = new LongCounterMetric(furtherReplyMsgFailNumSum, METRIC_NAME);
metrics.put("replyMsgFailNumSumMetric", replyMsgFailNumSumMetric);
//Sum of http push message number.
InstrumentFurther furtherHttpPushMsgNumSum = new InstrumentFurther();
furtherHttpPushMsgNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherHttpPushMsgNumSum.setDescription("Sum of http push message number.");
furtherHttpPushMsgNumSum.setName(HTTP_METRICS_NAME_PREFIX + "push.message.num");
httpPushMsgNumSumMetric = new LongCounterMetric(furtherHttpPushMsgNumSum, METRIC_NAME);
metrics.put("httpPushMsgNumSumMetric", httpPushMsgNumSumMetric);
//Sum of http push message fail number.
InstrumentFurther furtherHttpPushFailNumSum = new InstrumentFurther();
furtherHttpPushFailNumSum.setUnit(MetricInstrumentUnit.SINGLETON);
furtherHttpPushFailNumSum.setDescription("Sum of http push message fail number.");
furtherHttpPushFailNumSum.setName(HTTP_METRICS_NAME_PREFIX + "push.message.fail.num");
httpPushFailNumSumMetric = new LongCounterMetric(furtherHttpPushFailNumSum, METRIC_NAME);
metrics.put("httpPushFailNumSumMetric", httpPushFailNumSumMetric);
//avg body decode cost time of http
InstrumentFurther furtherHttpDecode = new InstrumentFurther();
furtherHttpDecode.setUnit(MetricInstrumentUnit.MILLISECONDS);
furtherHttpDecode.setDescription("Avg body decode cost time of http");
furtherHttpDecode.setName(HTTP_METRICS_NAME_PREFIX + "body.decode.cost.avg");
avgHttpBodyDecodeCostMetric = new ObservableDoubleGaugeMetric(furtherHttpDecode, METRIC_NAME, () -> this.avgHTTPBodyDecodeCost());
avgHttpBodyDecodeCostMetric.putAll(labelMap);
metrics.put("avgHttpBodyDecodeCostMetric", avgHttpBodyDecodeCostMetric);
//Max TPS of HTTP.
InstrumentFurther furtherMaxHttpTps = new InstrumentFurther();
furtherMaxHttpTps.setUnit(MetricInstrumentUnit.TPS);
furtherMaxHttpTps.setDescription("Max TPS of HTTP.");
furtherMaxHttpTps.setName(HTTP_METRICS_NAME_PREFIX + "request.tps.max");
maxHttpTpsMetric = new ObservableDoubleGaugeMetric(furtherMaxHttpTps, METRIC_NAME, () -> this.maxHTTPTPS());
maxHttpTpsMetric.putAll(labelMap);
metrics.put("maxHttpTpsMetric", maxHttpTpsMetric);
//Avg TPS of HTTP.
InstrumentFurther furtherAvgHttpTps = new InstrumentFurther();
furtherAvgHttpTps.setUnit(MetricInstrumentUnit.TPS);
furtherAvgHttpTps.setDescription("Avg TPS of HTTP.");
furtherAvgHttpTps.setName(HTTP_METRICS_NAME_PREFIX + "request.tps.avg");
avgHttpTpsMetric = new ObservableDoubleGaugeMetric(furtherAvgHttpTps, METRIC_NAME, () -> this.avgHTTPTPS());
avgHttpTpsMetric.putAll(labelMap);
metrics.put("avgHttpTpsMetric", avgHttpTpsMetric);
//max cost of HTTP.
InstrumentFurther furtherMaxCostHttpTps = new InstrumentFurther();
furtherMaxCostHttpTps.setUnit(MetricInstrumentUnit.MILLISECONDS);
furtherMaxCostHttpTps.setDescription("Max cost of HTTP.");
furtherMaxCostHttpTps.setName(HTTP_METRICS_NAME_PREFIX + "request.cost.max");
maxHttpCostMetric = new ObservableLongGaugeMetric(furtherMaxCostHttpTps, METRIC_NAME, () -> this.maxHTTPCost());
maxHttpCostMetric.putAll(labelMap);
metrics.put("maxHttpCostMetric", maxHttpCostMetric);
//Avg cost of HTTP.
InstrumentFurther furtherAvgHttpCost = new InstrumentFurther();
furtherAvgHttpCost.setUnit(MetricInstrumentUnit.TPS);
furtherAvgHttpCost.setDescription("Avg cost of HTTP.");
furtherAvgHttpCost.setName(HTTP_METRICS_NAME_PREFIX + "request.cost.avg");
avgHttpCostMetric = new ObservableDoubleGaugeMetric(furtherAvgHttpCost, METRIC_NAME, () -> this.avgHTTPCost());
avgHttpCostMetric.putAll(labelMap);
metrics.put("avgHttpCostMetric", avgHttpCostMetric);
//Max of batch send message tps
InstrumentFurther furtherMaxBatchSendMsgTps = new InstrumentFurther();
furtherMaxBatchSendMsgTps.setUnit(MetricInstrumentUnit.TPS);
furtherMaxBatchSendMsgTps.setDescription("Max of batch send message tps");
furtherMaxBatchSendMsgTps.setName(HTTP_METRICS_NAME_PREFIX + "batch.send.message.tps.max");
maxBatchSendMsgTpsMetric = new ObservableDoubleGaugeMetric(furtherMaxBatchSendMsgTps, METRIC_NAME, () -> this.maxSendBatchMsgTPS());
maxBatchSendMsgTpsMetric.putAll(labelMap);
metrics.put("maxBatchSendMsgTpsMetric", maxBatchSendMsgTpsMetric);
//Avg of batch send message tps.
InstrumentFurther furtherAvgBatchSendMsgTps = new InstrumentFurther();
furtherAvgBatchSendMsgTps.setUnit(MetricInstrumentUnit.TPS);
furtherAvgBatchSendMsgTps.setDescription("Avg of batch send message tps.");
furtherAvgBatchSendMsgTps.setName(HTTP_METRICS_NAME_PREFIX + "batch.send.message.tps.avg");
avgBatchSendMsgTpsMetric = new ObservableDoubleGaugeMetric(furtherAvgBatchSendMsgTps, METRIC_NAME, () -> this.avgSendBatchMsgTPS());
avgBatchSendMsgTpsMetric.putAll(labelMap);
metrics.put("avgBatchSendMsgTpsMetric", avgBatchSendMsgTpsMetric);
//Send batch message fail rate.
InstrumentFurther furtherSumBatchFailRate = new InstrumentFurther();
furtherSumBatchFailRate.setUnit(MetricInstrumentUnit.PERCENT);
furtherSumBatchFailRate.setDescription("Send batch message fail rate.");
furtherSumBatchFailRate.setName(HTTP_METRICS_NAME_PREFIX + "batch.send.message.fail.rate");
sumBatchFailRateMetric = new ObservableDoubleGaugeMetric(furtherSumBatchFailRate, METRIC_NAME, () -> this.getSendBatchMsgFailRate());
sumBatchFailRateMetric.putAll(labelMap);
metrics.put("sumBatchFailRateMetric", sumBatchFailRateMetric);
//Max of send message tps
InstrumentFurther furtherMaxSendMsgTps = new InstrumentFurther();
furtherMaxSendMsgTps.setUnit(MetricInstrumentUnit.TPS);
furtherMaxSendMsgTps.setDescription("Max of send message tps");
furtherMaxSendMsgTps.setName(HTTP_METRICS_NAME_PREFIX + "send.message.tps.max");
maxSendMsgTpsMetric = new ObservableDoubleGaugeMetric(furtherMaxSendMsgTps, METRIC_NAME, () -> this.maxSendMsgTPS());
maxSendMsgTpsMetric.putAll(labelMap);
metrics.put("maxSendMsgTpsMetric", maxSendMsgTpsMetric);
//Avg of send message tps
InstrumentFurther furtherAvgSendMsgTps = new InstrumentFurther();
furtherAvgSendMsgTps.setUnit(MetricInstrumentUnit.TPS);
furtherAvgSendMsgTps.setDescription("Avg of send message tps");
furtherAvgSendMsgTps.setName(HTTP_METRICS_NAME_PREFIX + "send.message.tps.avg");
avgSendMsgTpsMetric = new ObservableDoubleGaugeMetric(furtherAvgSendMsgTps, METRIC_NAME, () -> this.avgSendMsgTPS());
avgSendMsgTpsMetric.putAll(labelMap);
metrics.put("avgSendMsgTpsMetric", avgSendMsgTpsMetric);
//Send message fail rate.
InstrumentFurther furtherSumFailRate = new InstrumentFurther();
furtherSumFailRate.setUnit(MetricInstrumentUnit.PERCENT);
furtherSumFailRate.setDescription("Send message fail rate.");
furtherSumFailRate.setName(HTTP_METRICS_NAME_PREFIX + "send.message.fail.rate");
sumFailRateMetric = new ObservableDoubleGaugeMetric(furtherSumFailRate, METRIC_NAME, () -> this.getSendBatchMsgFailRate());
sumFailRateMetric.putAll(labelMap);
metrics.put("sumFailRateMetric", sumFailRateMetric);
//Max of push message tps.
InstrumentFurther furtherMaxPushMsgTps = new InstrumentFurther();
furtherMaxPushMsgTps.setUnit(MetricInstrumentUnit.TPS);
furtherMaxPushMsgTps.setDescription("Max of push message tps.");
furtherMaxPushMsgTps.setName(HTTP_METRICS_NAME_PREFIX + "push.message.tps.max");
maxPushMsgTpsMetric = new ObservableDoubleGaugeMetric(furtherMaxPushMsgTps, METRIC_NAME, () -> this.maxPushMsgTPS());
maxPushMsgTpsMetric.putAll(labelMap);
metrics.put("maxPushMsgTpsMetric", maxPushMsgTpsMetric);
//Avg of push message tps.
InstrumentFurther furtherAvgPushMsgTps = new InstrumentFurther();
furtherAvgPushMsgTps.setUnit(MetricInstrumentUnit.TPS);
furtherAvgPushMsgTps.setDescription("Avg of push message tps.");
furtherAvgPushMsgTps.setName(HTTP_METRICS_NAME_PREFIX + "push.message.tps.avg");
avgPushMsgTpsMetric = new ObservableDoubleGaugeMetric(furtherAvgPushMsgTps, METRIC_NAME, () -> this.avgPushMsgTPS());
avgPushMsgTpsMetric.putAll(labelMap);
metrics.put("avgPushMsgTpsMetric", avgPushMsgTpsMetric);
//Http push message fail rate.
InstrumentFurther furtherPushSumFailRate = new InstrumentFurther();
furtherPushSumFailRate.setUnit(MetricInstrumentUnit.PERCENT);
furtherPushSumFailRate.setDescription("Http push message fail rate.");
furtherPushSumFailRate.setName(HTTP_METRICS_NAME_PREFIX + "push.message.fail.rate");
pushSumFailRateMetric = new ObservableDoubleGaugeMetric(furtherPushSumFailRate, METRIC_NAME, () -> this.getHttpPushMsgFailRate());
pushSumFailRateMetric.putAll(labelMap);
metrics.put("pushSumFailRateMetric", pushSumFailRateMetric);
//Max of http push latency.
InstrumentFurther furtherMaxClientLatency = new InstrumentFurther();
furtherMaxClientLatency.setUnit(MetricInstrumentUnit.MILLISECONDS);
furtherMaxClientLatency.setDescription("Max of http push latency.");
furtherMaxClientLatency.setName(HTTP_METRICS_NAME_PREFIX + "push.latency.max");
maxClientLatencyMetric = new ObservableDoubleGaugeMetric(furtherMaxClientLatency, METRIC_NAME, () -> this.maxHTTPPushLatency());
maxClientLatencyMetric.putAll(labelMap);
metrics.put("maxClientLatencyMetric", maxClientLatencyMetric);
//Avg of http push latency.
InstrumentFurther furtherAvgClientLatency = new InstrumentFurther();
furtherAvgClientLatency.setUnit(MetricInstrumentUnit.MILLISECONDS);
furtherAvgClientLatency.setDescription("Avg of http push latency.");
furtherAvgClientLatency.setName(HTTP_METRICS_NAME_PREFIX + "push.latency.avg");
avgClientLatencyMetric = new ObservableDoubleGaugeMetric(furtherAvgClientLatency, METRIC_NAME, () -> this.avgHTTPPushLatency());
avgClientLatencyMetric.putAll(labelMap);
metrics.put("avgClientLatencyMetric", avgClientLatencyMetric);
//Size of batch message queue.
InstrumentFurther furtherBatchMsgQ = new InstrumentFurther();
furtherBatchMsgQ.setUnit(MetricInstrumentUnit.SINGLETON);
furtherBatchMsgQ.setDescription("Size of batch message queue.");
furtherBatchMsgQ.setName(HTTP_METRICS_NAME_PREFIX + "batch.message.queue.size");
batchMsgQMetric = new ObservableLongGaugeMetric(furtherBatchMsgQ, METRIC_NAME, () -> this.getBatchMsgQueueSize());
batchMsgQMetric.putAll(labelMap);
metrics.put("batchMsgQMetric", batchMsgQMetric);
//Size of send message queue.
InstrumentFurther furtherSendMsgQ = new InstrumentFurther();
furtherSendMsgQ.setUnit(MetricInstrumentUnit.SINGLETON);
furtherSendMsgQ.setDescription("Size of send message queue.");
furtherSendMsgQ.setName(HTTP_METRICS_NAME_PREFIX + "send.message.queue.size");
sendMsgQMetric = new ObservableLongGaugeMetric(furtherSendMsgQ, METRIC_NAME, () -> this.getSendMsgQueueSize());
sendMsgQMetric.putAll(labelMap);
metrics.put("sendMsgQMetric", sendMsgQMetric);
//Size of push message queue.
InstrumentFurther furtherPushMsgQ = new InstrumentFurther();
furtherPushMsgQ.setUnit(MetricInstrumentUnit.SINGLETON);
furtherPushMsgQ.setDescription("Size of push message queue.");
furtherPushMsgQ.setName(HTTP_METRICS_NAME_PREFIX + "push.message.queue.size");
pushMsgQMetric = new ObservableLongGaugeMetric(furtherPushMsgQ, METRIC_NAME, () -> this.getPushMsgQueueSize());
pushMsgQMetric.putAll(labelMap);
metrics.put("pushMsgQMetric", pushMsgQMetric);
//Size of http retry queue.
InstrumentFurther furtherHttpRetryQ = new InstrumentFurther();
furtherHttpRetryQ.setUnit(MetricInstrumentUnit.SINGLETON);
furtherHttpRetryQ.setDescription("Size of http retry queue.");
furtherHttpRetryQ.setName(HTTP_METRICS_NAME_PREFIX + "retry.queue.size");
httpRetryQMetric = new ObservableLongGaugeMetric(furtherHttpRetryQ, METRIC_NAME, () -> this.getHttpRetryQueueSize());
httpRetryQMetric.putAll(labelMap);
metrics.put("httpRetryQMetric", httpRetryQMetric);
//Avg of batch send message cost.
InstrumentFurther furtherBatchAvgSend2MQCost = new InstrumentFurther();
furtherBatchAvgSend2MQCost.setUnit(MetricInstrumentUnit.MILLISECONDS);
furtherBatchAvgSend2MQCost.setDescription("Avg of batch send message cost.");
furtherBatchAvgSend2MQCost.setName(HTTP_METRICS_NAME_PREFIX + "batch.send.message.cost.avg");
batchAvgSend2MQCostMetric = new ObservableDoubleGaugeMetric(furtherBatchAvgSend2MQCost, METRIC_NAME, () -> this.avgBatchSendMsgCost());
batchAvgSend2MQCostMetric.putAll(labelMap);
metrics.put("avgClientLatencyMetric", batchAvgSend2MQCostMetric);
//Avg of send message cost.
InstrumentFurther furtherAvgSend2MQCost = new InstrumentFurther();
furtherAvgSend2MQCost.setUnit(MetricInstrumentUnit.TPS);
furtherAvgSend2MQCost.setDescription("Avg of send message cost.");
furtherAvgSend2MQCost.setName(HTTP_METRICS_NAME_PREFIX + "send.message.cost.avg");
avgSend2MQCostMetric = new ObservableDoubleGaugeMetric(furtherAvgSend2MQCost, METRIC_NAME, () -> this.avgSendMsgCost());
avgSend2MQCostMetric.putAll(labelMap);
metrics.put("avgSend2MQCostMetric", avgSend2MQCostMetric);
//Avg of reply message cost.
InstrumentFurther furtherAvgReply2MQCost = new InstrumentFurther();
furtherAvgReply2MQCost.setUnit(MetricInstrumentUnit.TPS);
furtherAvgReply2MQCost.setDescription("Avg of reply message cost.");
furtherAvgReply2MQCost.setName(HTTP_METRICS_NAME_PREFIX + "reply.message.cost.avg");
avgReply2MQCostMetric = new ObservableDoubleGaugeMetric(furtherAvgReply2MQCost, METRIC_NAME, () -> this.avgReplyMsgCost());
avgReply2MQCostMetric.putAll(labelMap);
metrics.put("avgReply2MQCostMetric", avgReply2MQCostMetric);
}