From eac001ac189d0b89e55c6fd54667e15e610589bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Vl=C4=8Dek?= Date: Fri, 18 Nov 2022 20:47:03 +0100 Subject: [PATCH] Add missing JAVADOC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #113 Signed-off-by: Lukáš Vlček --- .../prometheus/PrometheusMetricsCatalog.java | 92 ++++++++++++++++++- .../PrometheusMetricsCollector.java | 18 ++++ .../prometheus/PrometheusSettings.java | 41 ++++++++- .../opensearch/action/ClusterStatsData.java | 34 +++++++ .../action/NodePrometheusMetricsAction.java | 7 ++ .../action/NodePrometheusMetricsRequest.java | 13 +++ .../action/NodePrometheusMetricsResponse.java | 45 ++++++++- .../TransportNodePrometheusMetricsAction.java | 8 ++ .../prometheus/PrometheusExporterPlugin.java | 3 + .../plugin/prometheus/RenamePlugin.java | 4 +- .../RestPrometheusMetricsAction.java | 9 ++ 11 files changed, 265 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCatalog.java b/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCatalog.java index a2e4790..747156d 100644 --- a/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCatalog.java +++ b/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCatalog.java @@ -87,7 +87,7 @@ private String[] getExtendedNodeLabelNames(String... labelNames) { } /** - * @param nodeInfo {@link Tuple} holding [nodeName, nodeID] + * @param nodeInfo A {@link Tuple} holding [nodeName, nodeID] * @param labelValues Prometheus label values * @return Prometheus label values extended with cluster and specific node context */ @@ -104,6 +104,33 @@ private String[] getExtendedNodeLabelValues( return extended; } + /** + *

+ * Register a new metric in the catalog. The metric is registered using the metric name, a help text and optional + * set of labels. The metric prefix is configured via {@link RestPrometheusMetricsAction#METRIC_PREFIX}. + *

+ * Example: + *

{@code
+     *   // Register new metric for cluster shards:
+     *   //   The metric will be called opensearch_cluster_shards_number (the opensearch_ is the default metric prefix),
+     *   //   then the help text will be "Number of shards", and finally we expect that the prometheus metric will
+     *   //   carry various shard count for different types of shards (initializing, active, ... etc).
+     *   catalog.registerClusterGauge("cluster_shards_number", "Number of shards", "type");
+     *
+     *   // ... later in the code:
+     *   private void populateClusterShards(ClusterHealthResponse chr) {
+     *     catalog.setClusterGauge("cluster_shards_number", chr.getActiveShards(), "active");
+     *     catalog.setClusterGauge("cluster_shards_number", chr.getActivePrimaryShards(), "active_primary");
+     *     catalog.setClusterGauge("cluster_shards_number", chr.getDelayedUnassignedShards(), "unassigned");
+     *     catalog.setClusterGauge("cluster_shards_number", chr.getInitializingShards(), "initializing");
+     *     catalog.setClusterGauge("cluster_shards_number", chr.getRelocatingShards(), "relocating");
+     *     catalog.setClusterGauge("cluster_shards_number", chr.getUnassignedShards(), "unassigned");
+     *   }
+     * }
+ * @param metric Metric name without the metric prefix + * @param help Help text for the metric + * @param labels Optional set of labels + */ public void registerClusterGauge(String metric, String help, String... labels) { Gauge gauge = Gauge.build(). name(metricPrefix + metric). @@ -116,11 +143,45 @@ public void registerClusterGauge(String metric, String help, String... labels) { logger.debug(String.format(Locale.ENGLISH, "Registered new cluster gauge %s", metric)); } + /** + * Set a value for cluster metric that has been previously registered using {@link #registerClusterGauge(String, String, String...)}. + * @see #registerClusterGauge(String, String, String...) + * @param metric Metric name without the metric prefix + * @param value Value of the metric + * @param labelValues Optional set of label values + */ public void setClusterGauge(String metric, double value, String... labelValues) { Gauge gauge = (Gauge) metrics.get(metric); gauge.labels(getExtendedClusterLabelValues(labelValues)).set(value); } + /** + *

+ * Register a new metric in the catalog. This is similar to {@link #registerClusterGauge(String, String, String...)} + * except using this method means that we are registering a metric at the cluster node level. + *

+ * Example: + *

{@code
+     *   // Register new metric for cluster node:
+     *   //   The metric will be called opensearch_threadpool_threads_count (the opensearch_ is the default metric prefix),
+     *   //   then the help text will be "Number of shards", and finally we expect that the prometheus metric will
+     *   //   carry threadpool name and type.
+     *   catalog.registerNodeGauge("threadpool_threads_count", "Count of threads in thread pool", "name", "type");
+     *
+     *   // ... later in the code:
+     *   private void updateThreadPoolMetrics(Tuple nodeInfo, ThreadPoolStats tps) {
+     *     if (tps != null) {
+     *       for (ThreadPoolStats.Stats st : tps) {
+     *         catalog.setNodeGauge(nodeInfo, "threadpool_threads_count", st.getCompleted(), st.getName(), "completed");
+     *         catalog.setNodeGauge(nodeInfo, "threadpool_threads_count", st.getRejected(), st.getName(), "rejected");
+     *       }
+     *     }
+     *   }
+     * }
+ * @param metric Metric name without the metric prefix + * @param help Help text for the metric + * @param labels Optional set of labels + */ public void registerNodeGauge(String metric, String help, String... labels) { Gauge gauge = Gauge.build(). name(metricPrefix + metric). @@ -133,6 +194,14 @@ public void registerNodeGauge(String metric, String help, String... labels) { logger.debug(String.format(Locale.ENGLISH, "Registered new node gauge %s", metric)); } + /** + * Set a value for cluster node metric that has been previously registered using {@link #registerNodeGauge(String, String, String...)}. + * @see #registerNodeGauge(String, String, String...) + * @param nodeInfo A {@link Tuple} holding [nodeName, nodeID] + * @param metric Metric name without the metric prefix + * @param value Value of the metric + * @param labelValues Optional set of label values + */ public void setNodeGauge(Tuple nodeInfo, String metric, double value, String... labelValues) { @@ -140,6 +209,13 @@ public void setNodeGauge(Tuple nodeInfo, gauge.labels(getExtendedNodeLabelValues(nodeInfo, labelValues)).set(value); } + /** + * Registers a new summary metric. + * @see Summary + * @param metric Metric name + * @param help Help text for the metric + * @param labels Optional set of labels + */ public void registerSummaryTimer(String metric, String help, String... labels) { Summary summary = Summary.build(). name(metricPrefix + metric). @@ -152,12 +228,26 @@ public void registerSummaryTimer(String metric, String help, String... labels) { logger.debug(String.format(Locale.ENGLISH, "Registered new summary %s", metric)); } + /** + * Start specific summary metric. + * @see Summary + * @param nodeInfo A {@link Tuple} holding [nodeName, nodeID] + * @param metric Metric name + * @param labelValues Optional set of label values + * @return Summary timer + */ public Summary.Timer startSummaryTimer(Tuple nodeInfo, String metric, String... labelValues) { Summary summary = (Summary) metrics.get(metric); return summary.labels(getExtendedNodeLabelValues(nodeInfo, labelValues)).startTimer(); } + /** + * Returns all the metrics from the catalog formatted in UTF-8 plain/text. + * More specifically as {@link TextFormat#CONTENT_TYPE_004}. + * @return Text representation of the metric from the catalog + * @throws IOException If creating the text representation goes wrong + */ public String toTextFormat() throws IOException { Writer writer = new StringWriter(); TextFormat.write004(writer, registry.metricFamilySamples()); diff --git a/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCollector.java b/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCollector.java index 880f33c..9b59876 100644 --- a/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCollector.java +++ b/src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCollector.java @@ -56,6 +56,12 @@ public class PrometheusMetricsCollector { private boolean isPrometheusIndices; private PrometheusMetricsCatalog catalog; + /** + * A constructor. + * @param catalog {@link PrometheusMetricsCatalog} + * @param isPrometheusIndices boolean flag for index level metric + * @param isPrometheusClusterSettings boolean flag cluster settings metrics + */ public PrometheusMetricsCollector(PrometheusMetricsCatalog catalog, boolean isPrometheusIndices, boolean isPrometheusClusterSettings) { @@ -64,6 +70,9 @@ public PrometheusMetricsCollector(PrometheusMetricsCatalog catalog, this.catalog = catalog; } + /** + * Call this method to register all the metrics that we want to capture. + */ public void registerMetrics() { catalog.registerSummaryTimer("metrics_generate_time_seconds", "Time spent while generating metrics"); @@ -951,10 +960,19 @@ public void updateMetrics(String originNodeName, String originNodeId, timer.observeDuration(); } + /** + * Get the metric catalog. + * @return The catalog + */ public PrometheusMetricsCatalog getCatalog() { return catalog; } + /** + * @see PrometheusMetricsCatalog#toTextFormat() + * @return A text representation of the catalog + * @throws IOException If creating the text representation goes wrong + */ public String getTextContent() throws IOException { return this.catalog.toTextFormat(); } diff --git a/src/main/java/org/compuscene/metrics/prometheus/PrometheusSettings.java b/src/main/java/org/compuscene/metrics/prometheus/PrometheusSettings.java index 9505e5b..dddc653 100644 --- a/src/main/java/org/compuscene/metrics/prometheus/PrometheusSettings.java +++ b/src/main/java/org/compuscene/metrics/prometheus/PrometheusSettings.java @@ -31,20 +31,43 @@ */ public class PrometheusSettings { + static String PROMETHEUS_CLUSTER_SETTINGS_KEY = "prometheus.cluster.settings"; + static String PROMETHEUS_INDICES_KEY = "prometheus.indices"; + static String PROMETHEUS_NODES_FILTER_KEY = "prometheus.nodes.filter"; + + /** + * This setting is used configure weather to expose cluster settings metrics or not. The default value is true. + * Can be configured in opensearch.yml file or update dynamically under key {@link #PROMETHEUS_CLUSTER_SETTINGS_KEY}. + */ public static final Setting PROMETHEUS_CLUSTER_SETTINGS = - Setting.boolSetting("prometheus.cluster.settings", true, + Setting.boolSetting(PROMETHEUS_CLUSTER_SETTINGS_KEY, true, Setting.Property.Dynamic, Setting.Property.NodeScope); + + /** + * This setting is used configure weather to expose low level index metrics or not. The default value is true. + * Can be configured in opensearch.yml file or update dynamically under key {@link #PROMETHEUS_INDICES_KEY}. + */ public static final Setting PROMETHEUS_INDICES = - Setting.boolSetting("prometheus.indices", true, + Setting.boolSetting(PROMETHEUS_INDICES_KEY, true, Setting.Property.Dynamic, Setting.Property.NodeScope); + + /** + * This setting is used configure which cluster nodes to gather metrics from. The default value is _local. + * Can be configured in opensearch.yml file or update dynamically under key {@link #PROMETHEUS_NODES_FILTER_KEY}. + */ public static final Setting PROMETHEUS_NODES_FILTER = - Setting.simpleString("prometheus.nodes.filter", "_local", + Setting.simpleString(PROMETHEUS_NODES_FILTER_KEY, "_local", Setting.Property.Dynamic, Setting.Property.NodeScope); private volatile boolean clusterSettings; private volatile boolean indices; private volatile String nodesFilter; + /** + * A constructor. + * @param settings Settings + * @param clusterSettings Cluster settings + */ public PrometheusSettings(Settings settings, ClusterSettings clusterSettings) { setPrometheusClusterSettings(PROMETHEUS_CLUSTER_SETTINGS.get(settings)); setPrometheusIndices(PROMETHEUS_INDICES.get(settings)); @@ -64,13 +87,25 @@ private void setPrometheusIndices(boolean flag) { private void setPrometheusNodesFilter(String filter) { this.nodesFilter = filter; } + /** + * Get value of settings key {@link #PROMETHEUS_CLUSTER_SETTINGS_KEY}. + * @return boolean value of the key + */ public boolean getPrometheusClusterSettings() { return this.clusterSettings; } + /** + * Get value of settings key {@link #PROMETHEUS_INDICES_KEY}. + * @return boolean value of the key + */ public boolean getPrometheusIndices() { return this.indices; } + /** + * Get value of settings key {@link #PROMETHEUS_NODES_FILTER_KEY}. + * @return boolean value of the key + */ public String getNodesFilter() { return this.nodesFilter; } } diff --git a/src/main/java/org/opensearch/action/ClusterStatsData.java b/src/main/java/org/opensearch/action/ClusterStatsData.java index 3ce9d0f..cbc042f 100644 --- a/src/main/java/org/opensearch/action/ClusterStatsData.java +++ b/src/main/java/org/opensearch/action/ClusterStatsData.java @@ -67,6 +67,11 @@ public class ClusterStatsData extends ActionResponse { private Double[] diskHighInPctRef = new Double[]{diskHighInPct}; private Double[] floodStageInPctRef = new Double[]{floodStageInPct}; + /** + * A constructor. + * @param in A streamInput to materialize the instance from + * @throws IOException if reading from streamInput is not successful + */ public ClusterStatsData(StreamInput in) throws IOException { super(in); thresholdEnabled = in.readOptionalBoolean(); @@ -87,6 +92,7 @@ public ClusterStatsData(StreamInput in) throws IOException { // There are several layers of cluster settings in Elasticsearch each having different priority. // We need to traverse them from the top priority down to find relevant value of each setting. // See https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html#_order_of_precedence + // TODO[lukas-vlcek]: update to OpenSearch referenced for (Settings s : new Settings[]{ // See: RestClusterGetSettingsAction#response // or: https://github.com/elastic/elasticsearch/pull/33247/files @@ -152,35 +158,63 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalDouble(floodStageInPct); } + /** + * Get value of setting controlled by {@link org.opensearch.cluster.routing.allocation.DiskThresholdSettings#CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING}. + * @return A Boolean value of the setting. + */ public Boolean getThresholdEnabled() { return thresholdEnabled; } + /** + * Get value of setting controlled by {@link org.opensearch.cluster.routing.allocation.DiskThresholdSettings#CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING}. + * @return A Long value of the setting. + */ @Nullable public Long getDiskLowInBytes() { return diskLowInBytes; } + /** + * Get value of setting controlled by {@link org.opensearch.cluster.routing.allocation.DiskThresholdSettings#CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING}. + * @return A Long value of the setting. + */ @Nullable public Long getDiskHighInBytes() { return diskHighInBytes; } + /** + * Get value of setting controlled by {@link org.opensearch.cluster.routing.allocation.DiskThresholdSettings#CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING}. + * @return A Long value of the setting. + */ @Nullable public Long getFloodStageInBytes() { return floodStageInBytes; } + /** + * Get value of setting controlled by {@link org.opensearch.cluster.routing.allocation.DiskThresholdSettings#CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING}. + * @return A Double value of the setting. + */ @Nullable public Double getDiskLowInPct() { return diskLowInPct; } + /** + * Get value of setting controlled by {@link org.opensearch.cluster.routing.allocation.DiskThresholdSettings#CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING}. + * @return A Double value of the setting. + */ @Nullable public Double getDiskHighInPct() { return diskHighInPct; } + /** + * Get value of setting controlled by {@link org.opensearch.cluster.routing.allocation.DiskThresholdSettings#CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING}. + * @return A Double value of the setting. + */ @Nullable public Double getFloodStageInPct() { return floodStageInPct; diff --git a/src/main/java/org/opensearch/action/NodePrometheusMetricsAction.java b/src/main/java/org/opensearch/action/NodePrometheusMetricsAction.java index 29490a7..b30a6bb 100644 --- a/src/main/java/org/opensearch/action/NodePrometheusMetricsAction.java +++ b/src/main/java/org/opensearch/action/NodePrometheusMetricsAction.java @@ -21,7 +21,14 @@ */ public class NodePrometheusMetricsAction extends ActionType { + /** + * An action singleton instance at the node level. + */ public static final NodePrometheusMetricsAction INSTANCE = new NodePrometheusMetricsAction(); + + /** + * A privilege that users need to have to be allowed to request metrics from plugin REST endpoint. + */ public static final String NAME = "cluster:monitor/prometheus/metrics"; private NodePrometheusMetricsAction() { diff --git a/src/main/java/org/opensearch/action/NodePrometheusMetricsRequest.java b/src/main/java/org/opensearch/action/NodePrometheusMetricsRequest.java index c37f8bb..6f8ac16 100644 --- a/src/main/java/org/opensearch/action/NodePrometheusMetricsRequest.java +++ b/src/main/java/org/opensearch/action/NodePrometheusMetricsRequest.java @@ -27,14 +27,27 @@ */ public class NodePrometheusMetricsRequest extends ClusterManagerNodeReadRequest { + /** + * A constructor. + */ public NodePrometheusMetricsRequest() { super(); } + /** + * A constructor that utilizes the inputStream. + * @param in inputStream + * @throws IOException if there is an exception reading from inputStream + */ public NodePrometheusMetricsRequest(StreamInput in) throws IOException { super(in); } + /** + * A validation of the request. + * Currently, no validations are needed, thus this method always returns null. + * @return null + */ @Override public ActionRequestValidationException validate() { return null; diff --git a/src/main/java/org/opensearch/action/NodePrometheusMetricsResponse.java b/src/main/java/org/opensearch/action/NodePrometheusMetricsResponse.java index cd9fa6b..de6852a 100644 --- a/src/main/java/org/opensearch/action/NodePrometheusMetricsResponse.java +++ b/src/main/java/org/opensearch/action/NodePrometheusMetricsResponse.java @@ -33,14 +33,21 @@ /** * Action response class for Prometheus Exporter plugin. + * This class a container of other responses that are needed to construct list of all required metrics. It knows how to + * prepare all data for wire transport by writing it into outputStream. */ public class NodePrometheusMetricsResponse extends ActionResponse { - private ClusterHealthResponse clusterHealth; - private NodesInfoResponse nodesInfoResponse; - private NodeStats[] nodeStats; - @Nullable private IndicesStatsResponse indicesStats; + private final ClusterHealthResponse clusterHealth; + private final NodesInfoResponse nodesInfoResponse; + private final NodeStats[] nodeStats; + @Nullable private final IndicesStatsResponse indicesStats; private ClusterStatsData clusterStatsData = null; + /** + * A constructor that materialize the instance from inputStream. + * @param in inputStream + * @throws IOException if there is an exception reading from inputStream + */ public NodePrometheusMetricsResponse(StreamInput in) throws IOException { super(in); clusterHealth = new ClusterHealthResponse(in); @@ -50,6 +57,16 @@ public NodePrometheusMetricsResponse(StreamInput in) throws IOException { clusterStatsData = new ClusterStatsData(in); } + /** + * A constructor. + * @param clusterHealth ClusterHealthResponse + * @param localNodesInfoResponse NodesInfoResponse + * @param nodesStats NodesStats + * @param indicesStats IndicesStats + * @param clusterStateResponse ClusterStateResponse + * @param settings Settings + * @param clusterSettings ClusterSettings + */ public NodePrometheusMetricsResponse(ClusterHealthResponse clusterHealth, NodesInfoResponse localNodesInfoResponse, NodeStats[] nodesStats, @@ -66,21 +83,41 @@ public NodePrometheusMetricsResponse(ClusterHealthResponse clusterHealth, } } + /** + * Get internal {@link ClusterHealthResponse} object. + * @return ClusterHealthResponse object + */ public ClusterHealthResponse getClusterHealth() { return this.clusterHealth; } + /** + * Get internal {@link NodesInfoResponse} object. + * @return NodesInfoResponse object + */ public NodesInfoResponse getLocalNodesInfoResponse() { return this.nodesInfoResponse; } + /** + * Get internal {@link NodeStats} array. + * @return NodeStats array + */ public NodeStats[] getNodeStats() { return this.nodeStats; } + /** + * Get internal {@link IndicesStatsResponse} object. + * @return IndicesStatsResponse object + */ @Nullable public IndicesStatsResponse getIndicesStats() { return this.indicesStats; } + /** + * Get internal {@link ClusterStatsData} object. + * @return ClusterStatsData object + */ @Nullable public ClusterStatsData getClusterStatsData() { return this.clusterStatsData; diff --git a/src/main/java/org/opensearch/action/TransportNodePrometheusMetricsAction.java b/src/main/java/org/opensearch/action/TransportNodePrometheusMetricsAction.java index 531112d..236d63c 100644 --- a/src/main/java/org/opensearch/action/TransportNodePrometheusMetricsAction.java +++ b/src/main/java/org/opensearch/action/TransportNodePrometheusMetricsAction.java @@ -58,6 +58,14 @@ public class TransportNodePrometheusMetricsAction extends HandledTransportAction private final PrometheusSettings prometheusSettings; private final Logger logger = LogManager.getLogger(getClass()); + /** + * A constructor. + * @param settings Settings + * @param client Cluster client + * @param transportService Transport service + * @param actionFilters Action filters + * @param clusterSettings Cluster settings + */ @Inject public TransportNodePrometheusMetricsAction(Settings settings, Client client, TransportService transportService, ActionFilters actionFilters, diff --git a/src/main/java/org/opensearch/plugin/prometheus/PrometheusExporterPlugin.java b/src/main/java/org/opensearch/plugin/prometheus/PrometheusExporterPlugin.java index e3f1c74..d3ce53f 100644 --- a/src/main/java/org/opensearch/plugin/prometheus/PrometheusExporterPlugin.java +++ b/src/main/java/org/opensearch/plugin/prometheus/PrometheusExporterPlugin.java @@ -46,6 +46,9 @@ public class PrometheusExporterPlugin extends Plugin implements ActionPlugin { private static final Logger logger = LogManager.getLogger(PrometheusExporterPlugin.class); + /** + * A constructor. + */ public PrometheusExporterPlugin() { logger.info("starting Prometheus exporter plugin"); } diff --git a/src/main/java/org/opensearch/plugin/prometheus/RenamePlugin.java b/src/main/java/org/opensearch/plugin/prometheus/RenamePlugin.java index ec93cd6..c58b00e 100644 --- a/src/main/java/org/opensearch/plugin/prometheus/RenamePlugin.java +++ b/src/main/java/org/opensearch/plugin/prometheus/RenamePlugin.java @@ -9,7 +9,9 @@ import org.opensearch.plugins.Plugin; - +/** + * TODO[lukas-vlcek]: Remove this class. It is not needed, it is a relict from OpenSearch Plugin template. + */ public class RenamePlugin extends Plugin { // Implement the relevant Plugin Interfaces here } diff --git a/src/main/java/org/opensearch/rest/prometheus/RestPrometheusMetricsAction.java b/src/main/java/org/opensearch/rest/prometheus/RestPrometheusMetricsAction.java index d978906..55247de 100644 --- a/src/main/java/org/opensearch/rest/prometheus/RestPrometheusMetricsAction.java +++ b/src/main/java/org/opensearch/rest/prometheus/RestPrometheusMetricsAction.java @@ -54,6 +54,10 @@ public class RestPrometheusMetricsAction extends BaseRestHandler { ); } }; + + /** + * A metric prefix. Can be configured in opensearch.yml file under key {@link #METRIC_PREFIX_KEY}. + */ public static final Setting METRIC_PREFIX = Setting.simpleString(METRIC_PREFIX_KEY, "opensearch_", indexPrefixValidator, Setting.Property.NodeScope); @@ -61,6 +65,11 @@ public class RestPrometheusMetricsAction extends BaseRestHandler { private final PrometheusSettings prometheusSettings; private final Logger logger = LogManager.getLogger(getClass()); + /** + * A constructor. + * @param settings Settings + * @param clusterSettings Cluster settings + */ public RestPrometheusMetricsAction(Settings settings, ClusterSettings clusterSettings) { this.prometheusSettings = new PrometheusSettings(settings, clusterSettings); this.metricPrefix = METRIC_PREFIX.get(settings);