javeme commented on code in PR #2286:
URL:
https://github.com/apache/incubator-hugegraph/pull/2286#discussion_r1328054366
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java:
##########
@@ -325,13 +323,12 @@ private String baseMetricPrometheusAll() {
}
}
- MetricsUtil.writePrometheus(promMetric,
+ MetricsUtil.writePrometheusFormat(promMetric,
Review Comment:
don't forget update the 327 alignment
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java:
##########
@@ -158,4 +176,244 @@ public String timers() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.timers());
}
+
+ @GET
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String all(@Context GraphManager manager,
+ @QueryParam("type") String type) {
+
+ if (type != null && type.equals(JSON_STR)) {
+ return baseMetricAll();
+ } else {
+ return baseMetricPrometheusAll();
+ }
+ }
+
+ @GET
+ @Path("statistics")
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String statistics(@QueryParam("type") String type) {
+ Map<String, Map<String, Object>> metricMap = statistics();
+
+ if (type != null && type.equals(JSON_STR)) {
+ return JsonUtil.toJson(metricMap);
+ }
+ return statisticsProm(metricMap);
+ }
+
+ public String baseMetricAll() {
+ ServerReporter reporter = ServerReporter.instance();
+ Map<String, Map<String, ? extends Metric>> result = new
LinkedHashMap<>();
+ result.put("gauges", reporter.gauges());
+ result.put("counters", reporter.counters());
+ result.put("histograms", reporter.histograms());
+ result.put("meters", reporter.meters());
+ result.put("timers", reporter.timers());
+ return JsonUtil.toJson(result);
+ }
+
+ private String baseMetricPrometheusAll() {
+ StringBuilder promMetric = new StringBuilder();
+ ServerReporter reporter = ServerReporter.instance();
+ String helpName = "hugegraph_info";
Review Comment:
also define a const var
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java:
##########
@@ -49,6 +49,8 @@ public class API {
public static final String APPLICATION_JSON = MediaType.APPLICATION_JSON;
public static final String APPLICATION_JSON_WITH_CHARSET =
APPLICATION_JSON + ";charset=" + CHARSET;
+ public static final String APPLICATION_TEXT_WITH_CHARSET =
+ MediaType.TEXT_PLAIN + ";charset=" + CHARSET;
Review Comment:
also align with APPLICATION_TEXT_WITH_CHARSET
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java:
##########
@@ -158,4 +176,244 @@ public String timers() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.timers());
}
+
+ @GET
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String all(@Context GraphManager manager,
+ @QueryParam("type") String type) {
+
Review Comment:
expect to remove a blank line
##########
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java:
##########
@@ -102,7 +102,7 @@ public static String replaceSlashInKey(String orgKey) {
return orgKey.replace("/", "_");
}
- public static void writePrometheus(StringBuilder promeMetrics,
+ public static void writePrometheusFormat(StringBuilder promeMetrics,
Review Comment:
ditto
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java:
##########
@@ -158,4 +176,244 @@ public String timers() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.timers());
}
+
+ @GET
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String all(@Context GraphManager manager,
+ @QueryParam("type") String type) {
+
+ if (type != null && type.equals(JSON_STR)) {
+ return baseMetricAll();
+ } else {
+ return baseMetricPrometheusAll();
+ }
+ }
+
+ @GET
+ @Path("statistics")
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String statistics(@QueryParam("type") String type) {
+ Map<String, Map<String, Object>> metricMap = statistics();
+
+ if (type != null && type.equals(JSON_STR)) {
+ return JsonUtil.toJson(metricMap);
+ }
+ return statisticsProm(metricMap);
+ }
+
+ public String baseMetricAll() {
+ ServerReporter reporter = ServerReporter.instance();
+ Map<String, Map<String, ? extends Metric>> result = new
LinkedHashMap<>();
+ result.put("gauges", reporter.gauges());
+ result.put("counters", reporter.counters());
+ result.put("histograms", reporter.histograms());
+ result.put("meters", reporter.meters());
+ result.put("timers", reporter.timers());
+ return JsonUtil.toJson(result);
+ }
+
+ private String baseMetricPrometheusAll() {
+ StringBuilder promMetric = new StringBuilder();
+ ServerReporter reporter = ServerReporter.instance();
+ String helpName = "hugegraph_info";
+ //version
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + UNTYPED + END_LSTR);
+ promMetric.append(helpName)
+ .append("{version=\"")
+ .append(ApiVersion.VERSION.toString()).append("\",}")
+ .append(SPACE_STR + "1.0" + END_LSTR);
+
+ //gauges
+ for (String key : reporter.gauges().keySet()) {
+ final com.codahale.metrics.Gauge<?> gauge
Review Comment:
can we remove final mark and import com.codahale.metrics.Gauge as possible
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/filter/AccessLogFilter.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hugegraph.api.filter;
+
+import static org.apache.hugegraph.api.filter.PathFilter.REQUEST_TIME;
+import static
org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_FAILED_COUNTER;
+import static
org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_RESPONSE_TIME_HISTOGRAM;
+import static
org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_SUCCESS_COUNTER;
+import static
org.apache.hugegraph.metrics.MetricsUtil.METRICS_PATH_TOTAL_COUNTER;
+
+import java.io.IOException;
+
+import org.apache.hugegraph.metrics.MetricsUtil;
+
+import jakarta.inject.Singleton;
+import jakarta.ws.rs.container.ContainerRequestContext;
+import jakarta.ws.rs.container.ContainerResponseContext;
+import jakarta.ws.rs.container.ContainerResponseFilter;
+import jakarta.ws.rs.ext.Provider;
+
+
+@Provider
+@Singleton
+public class AccessLogFilter implements ContainerResponseFilter {
+
+
Review Comment:
expect to remove a blank line
##########
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java:
##########
@@ -24,12 +24,45 @@
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.Snapshot;
import com.codahale.metrics.Timer;
public class MetricsUtil {
- private static final MetricRegistry REGISTRY =
- MetricManager.INSTANCE.getRegistry();
+ public static final String METRICS_PATH_TOTAL_COUNTER = "TOTAL_COUNTER";
+ public static final String METRICS_PATH_FAILED_COUNTER = "FAILED_COUNTER";
+ public static final String METRICS_PATH_SUCCESS_COUNTER =
"SUCCESS_COUNTER";
+ public static final String METRICS_PATH_RESPONSE_TIME_HISTOGRAM =
+ "RESPONSE_TIME_HISTOGRAM";
+ public static final String P75_ATTR = "{name=\"p75\",} ";
+ public static final String P95_ATTR = "{name=\"p95\",} ";
+ public static final String P98_ATTR = "{name=\"p98\",} ";
+ public static final String P99_ATTR = "{name=\"p99\",} ";
+ public static final String P999_ATTR = "{name=\"p999\",} ";
+ public static final String MEAN_RATE_ATRR = "{name=\"mean_rate\",} ";
+ public static final String ONE_MIN_RATE_ATRR = "{name=\"m1_rate\",} ";
+ public static final String FIVE_MIN_RATE_ATRR = "{name=\"m5_rate\",} ";
+ public static final String FIFT_MIN_RATE_ATRR = "{name=\"m15_rate\",} ";
+ public static final MetricRegistry REGISTRY =
+ MetricManager.INSTANCE.getRegistry();
Review Comment:
seems one line is ok
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java:
##########
@@ -97,7 +95,7 @@ public static <R> R commit(HugeGraph g, Callable<R> callable)
{
SUCCEED_METER.mark();
return result;
} catch (IllegalArgumentException | NotFoundException |
- ForbiddenException e) {
+ ForbiddenException e) {
Review Comment:
not addressed comment
##########
hugegraph-test/src/main/java/org/apache/hugegraph/api/MetricsApiTest.java:
##########
@@ -165,8 +190,8 @@ public void testMetricsBackend() {
String key = (String) e.getKey();
value = e.getValue();
Assert.assertTrue(String.format(
- "Expect map value for key %s but got %s",
- key, value),
+ "Expect map value for key %s but
got %s",
Review Comment:
not addressed: prefer to keep the origin alignment
##########
hugegraph-api/src/main/java/org/apache/hugegraph/metrics/MetricsUtil.java:
##########
@@ -40,15 +73,145 @@ public static Counter registerCounter(Class<?> clazz,
String name) {
return REGISTRY.counter(MetricRegistry.name(clazz, name));
}
+ public static Counter registerCounter(String name) {
+ return REGISTRY.counter(MetricRegistry.name(name));
+ }
+
public static Histogram registerHistogram(Class<?> clazz, String name) {
return REGISTRY.histogram(MetricRegistry.name(clazz, name));
}
+ public static Histogram registerHistogram(String name) {
+ return REGISTRY.histogram(name);
+ }
+
+
Review Comment:
remove a blank line
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java:
##########
@@ -158,4 +176,244 @@ public String timers() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.timers());
}
+
+ @GET
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String all(@Context GraphManager manager,
+ @QueryParam("type") String type) {
+
+ if (type != null && type.equals(JSON_STR)) {
+ return baseMetricAll();
+ } else {
+ return baseMetricPrometheusAll();
+ }
+ }
+
+ @GET
+ @Path("statistics")
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String statistics(@QueryParam("type") String type) {
+ Map<String, Map<String, Object>> metricMap = statistics();
+
+ if (type != null && type.equals(JSON_STR)) {
+ return JsonUtil.toJson(metricMap);
+ }
+ return statisticsProm(metricMap);
+ }
+
+ public String baseMetricAll() {
+ ServerReporter reporter = ServerReporter.instance();
+ Map<String, Map<String, ? extends Metric>> result = new
LinkedHashMap<>();
+ result.put("gauges", reporter.gauges());
+ result.put("counters", reporter.counters());
+ result.put("histograms", reporter.histograms());
+ result.put("meters", reporter.meters());
+ result.put("timers", reporter.timers());
+ return JsonUtil.toJson(result);
+ }
+
+ private String baseMetricPrometheusAll() {
+ StringBuilder promMetric = new StringBuilder();
+ ServerReporter reporter = ServerReporter.instance();
+ String helpName = "hugegraph_info";
+ //version
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + UNTYPED + END_LSTR);
+ promMetric.append(helpName)
+ .append("{version=\"")
+ .append(ApiVersion.VERSION.toString()).append("\",}")
+ .append(SPACE_STR + "1.0" + END_LSTR);
+
+ //gauges
+ for (String key : reporter.gauges().keySet()) {
+ final com.codahale.metrics.Gauge<?> gauge
+ = reporter.gauges().get(key);
+ if (gauge != null) {
+ helpName = replaceDotDashInKey(key);
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName).append(SPACE_STR + GAUGE_TYPE +
END_LSTR);
+ promMetric.append(helpName)
+ .append(SPACE_STR + gauge.getValue() + END_LSTR);
+ }
+ }
+
+ //histograms
+ for (String histogramkey : reporter.histograms().keySet()) {
+ final Histogram histogram =
reporter.histograms().get(histogramkey);
+ if (histogram != null) {
+ helpName = replaceDotDashInKey(histogramkey);
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR);
+
+ promMetric.append(helpName)
+ .append(COUNT_ATTR)
+ .append(histogram.getCount() + END_LSTR);
+ promMetric.append(
+ exportSnapshot(helpName, histogram.getSnapshot()));
+ }
+ }
+
+ //meters
+ for (String meterkey : reporter.meters().keySet()) {
+ final Meter metric = reporter.meters().get(meterkey);
+ if (metric != null) {
+ helpName = replaceDotDashInKey(meterkey);
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR);
+
+ promMetric.append(helpName)
+ .append(COUNT_ATTR)
+ .append(metric.getCount() + END_LSTR);
+ promMetric.append(helpName)
+ .append(MEAN_RATE_ATRR)
+ .append(metric.getMeanRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(ONE_MIN_RATE_ATRR)
+ .append(metric.getOneMinuteRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(FIVE_MIN_RATE_ATRR)
+ .append(metric.getFiveMinuteRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(FIFT_MIN_RATE_ATRR)
+ .append(metric.getFifteenMinuteRate() + END_LSTR);
+ }
+ }
+
+ //timer
Review Comment:
note expected "// xx" style, and it's better to add more details for these
comments
##########
hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java:
##########
@@ -158,4 +176,244 @@ public String timers() {
ServerReporter reporter = ServerReporter.instance();
return JsonUtil.toJson(reporter.timers());
}
+
+ @GET
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String all(@Context GraphManager manager,
+ @QueryParam("type") String type) {
+
+ if (type != null && type.equals(JSON_STR)) {
+ return baseMetricAll();
+ } else {
+ return baseMetricPrometheusAll();
+ }
+ }
+
+ @GET
+ @Path("statistics")
+ @Timed
+ @Produces(APPLICATION_TEXT_WITH_CHARSET)
+ @RolesAllowed({"admin", "$owner= $action=metrics_read"})
+ public String statistics(@QueryParam("type") String type) {
+ Map<String, Map<String, Object>> metricMap = statistics();
+
+ if (type != null && type.equals(JSON_STR)) {
+ return JsonUtil.toJson(metricMap);
+ }
+ return statisticsProm(metricMap);
+ }
+
+ public String baseMetricAll() {
+ ServerReporter reporter = ServerReporter.instance();
+ Map<String, Map<String, ? extends Metric>> result = new
LinkedHashMap<>();
+ result.put("gauges", reporter.gauges());
+ result.put("counters", reporter.counters());
+ result.put("histograms", reporter.histograms());
+ result.put("meters", reporter.meters());
+ result.put("timers", reporter.timers());
+ return JsonUtil.toJson(result);
+ }
+
+ private String baseMetricPrometheusAll() {
+ StringBuilder promMetric = new StringBuilder();
+ ServerReporter reporter = ServerReporter.instance();
+ String helpName = "hugegraph_info";
+ //version
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + UNTYPED + END_LSTR);
+ promMetric.append(helpName)
+ .append("{version=\"")
+ .append(ApiVersion.VERSION.toString()).append("\",}")
+ .append(SPACE_STR + "1.0" + END_LSTR);
+
+ //gauges
+ for (String key : reporter.gauges().keySet()) {
+ final com.codahale.metrics.Gauge<?> gauge
+ = reporter.gauges().get(key);
+ if (gauge != null) {
+ helpName = replaceDotDashInKey(key);
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName).append(SPACE_STR + GAUGE_TYPE +
END_LSTR);
+ promMetric.append(helpName)
+ .append(SPACE_STR + gauge.getValue() + END_LSTR);
+ }
+ }
+
+ //histograms
+ for (String histogramkey : reporter.histograms().keySet()) {
+ final Histogram histogram =
reporter.histograms().get(histogramkey);
+ if (histogram != null) {
+ helpName = replaceDotDashInKey(histogramkey);
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR);
+
+ promMetric.append(helpName)
+ .append(COUNT_ATTR)
+ .append(histogram.getCount() + END_LSTR);
+ promMetric.append(
+ exportSnapshot(helpName, histogram.getSnapshot()));
+ }
+ }
+
+ //meters
+ for (String meterkey : reporter.meters().keySet()) {
+ final Meter metric = reporter.meters().get(meterkey);
+ if (metric != null) {
+ helpName = replaceDotDashInKey(meterkey);
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR);
+
+ promMetric.append(helpName)
+ .append(COUNT_ATTR)
+ .append(metric.getCount() + END_LSTR);
+ promMetric.append(helpName)
+ .append(MEAN_RATE_ATRR)
+ .append(metric.getMeanRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(ONE_MIN_RATE_ATRR)
+ .append(metric.getOneMinuteRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(FIVE_MIN_RATE_ATRR)
+ .append(metric.getFiveMinuteRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(FIFT_MIN_RATE_ATRR)
+ .append(metric.getFifteenMinuteRate() + END_LSTR);
+ }
+ }
+
+ //timer
+ for (String timerkey : reporter.timers().keySet()) {
+ final com.codahale.metrics.Timer timer = reporter.timers()
+ .get(timerkey);
+ if (timer != null) {
+ helpName = replaceDotDashInKey(timerkey);
+ promMetric.append(STR_HELP)
+ .append(helpName).append(END_LSTR);
+ promMetric.append(STR_TYPE)
+ .append(helpName)
+ .append(SPACE_STR + HISTOGRAM_TYPE + END_LSTR);
+
+ promMetric.append(helpName)
+ .append(COUNT_ATTR)
+ .append(timer.getCount() + END_LSTR);
+ promMetric.append(helpName)
+ .append(ONE_MIN_RATE_ATRR)
+ .append(timer.getOneMinuteRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(FIVE_MIN_RATE_ATRR)
+ .append(timer.getFiveMinuteRate() + END_LSTR);
+ promMetric.append(helpName)
+ .append(FIFT_MIN_RATE_ATRR)
+ .append(timer.getFifteenMinuteRate() + END_LSTR);
+ promMetric.append(
+ exportSnapshot(helpName, timer.getSnapshot()));
+ }
+ }
+
+ MetricsUtil.writePrometheusFormat(promMetric,
+ MetricManager.INSTANCE.getRegistry());
+
+ return promMetric.toString();
+ }
+
+ private Map<String, Map<String, Object>> statistics() {
+ Map<String, Map<String, Object>> metricsMap = new HashMap<>();
+ ServerReporter reporter = ServerReporter.instance();
+ for (Map.Entry<String, Histogram> entry :
reporter.histograms().entrySet()) {
+ // entryKey = path/method/responseTimeHistogram
+ String entryKey = entry.getKey();
+ String[] split = entryKey.split("/");
+ String lastWord = split[split.length - 1];
+ if (!lastWord.equals(METRICS_PATH_RESPONSE_TIME_HISTOGRAM)) {
+ // original metrics dont report
+ continue;
+ }
+ // metricsName = path/method
+ String metricsName =
+ entryKey.substring(0, entryKey.length() -
lastWord.length() - 1);
+
+ Counter totalCounter = reporter.counters().get(
+ joinWithSlash(metricsName, METRICS_PATH_TOTAL_COUNTER));
+ Counter failedCounter = reporter.counters().get(
+ joinWithSlash(metricsName, METRICS_PATH_FAILED_COUNTER));
+ Counter successCounter = reporter.counters().get(
+ joinWithSlash(metricsName, METRICS_PATH_SUCCESS_COUNTER));
+
+
+ Histogram histogram = entry.getValue();
+ Map<String, Object> entryMetricsMap = new HashMap<>();
+ entryMetricsMap.put(MetricsKeys.MAX_RESPONSE_TIME.name(),
+ histogram.getSnapshot().getMax());
+ entryMetricsMap.put(MetricsKeys.MEAN_RESPONSE_TIME.name(),
+ histogram.getSnapshot().getMean());
+
+ entryMetricsMap.put(MetricsKeys.TOTAL_REQUEST.name(),
+ totalCounter.getCount());
+
+ if (failedCounter == null) {
+ entryMetricsMap.put(MetricsKeys.FAILED_REQUEST.name(), 0);
+ } else {
+ entryMetricsMap.put(MetricsKeys.FAILED_REQUEST.name(),
+ failedCounter.getCount());
+ }
+
+ if (successCounter == null) {
+ entryMetricsMap.put(MetricsKeys.SUCCESS_REQUEST.name(), 0);
+ } else {
+ entryMetricsMap.put(MetricsKeys.SUCCESS_REQUEST.name(),
+ successCounter.getCount());
+ }
+
+ metricsMap.put(metricsName, entryMetricsMap);
+
+ }
+ return metricsMap;
+ }
+
+ private String statisticsProm(Map<String, Map<String, Object>> metricMap) {
+ StringBuilder promMetric = new StringBuilder();
+
+ //version
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]