diff --git a/flint-core/src/main/java/org/opensearch/flint/core/RestHighLevelClientWrapper.java b/flint-core/src/main/java/org/opensearch/flint/core/RestHighLevelClientWrapper.java index 1ab72ad98..3556c7e24 100644 --- a/flint-core/src/main/java/org/opensearch/flint/core/RestHighLevelClientWrapper.java +++ b/flint-core/src/main/java/org/opensearch/flint/core/RestHighLevelClientWrapper.java @@ -138,7 +138,7 @@ private T execute(String metricNamePrefix, IOCallable operation) throws I * @param metricNamePrefix the prefix for the metric name which is used to construct the full metric name for success */ private void recordOperationSuccess(String metricNamePrefix) { - String successMetricName = metricNamePrefix + ".200.count"; + String successMetricName = metricNamePrefix + ".2xx.count"; MetricsUtil.incrementCounter(successMetricName); } diff --git a/flint-core/src/main/java/org/opensearch/flint/core/metrics/MetricsUtil.java b/flint-core/src/main/java/org/opensearch/flint/core/metrics/MetricsUtil.java index 11b5327eb..0edce3e36 100644 --- a/flint-core/src/main/java/org/opensearch/flint/core/metrics/MetricsUtil.java +++ b/flint-core/src/main/java/org/opensearch/flint/core/metrics/MetricsUtil.java @@ -24,6 +24,13 @@ public final class MetricsUtil { private MetricsUtil() { } + /** + * Increments the Counter metric associated with the given metric name. + * If the counter does not exist, it is created before being incremented. + * + * @param metricName The name of the metric for which the counter is incremented. + * This name is used to retrieve or create the counter. + */ public static void incrementCounter(String metricName) { Counter counter = getOrCreateCounter(metricName); if (counter != null) {