Skip to content

Commit 31550aa

Browse files
authored
Merge pull request #136 from vvanholl/es_5.6.0.0
Es 5.6.0.0
2 parents 1c24705 + a6be237 commit 31550aa

File tree

7 files changed

+39
-14
lines changed

7 files changed

+39
-14
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
image: gradle:4.10.2-jdk10
1+
image: gradle:4.10.2-jdk11
22

33
variables:
44
GRADLE_OPTS: "-Dorg.gradle.daemon=false"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ It collects all relevant metrics and makes them available to Prometheus via the
2626

2727
| Elasticsearch | Plugin | Release date |
2828
| -------------- | -------------- | ------------ |
29+
| 6.5.0 | 6.5.0.0 | Nov 19, 2018 |
2930
| 6.4.3 | 6.4.3.0 | Nov 07, 2018 |
3031
| 6.4.2 | 6.4.2.0 | Oct 08, 2018 |
3132
| 6.4.1 | 6.4.1.0 | Sep 24, 2018 |
@@ -102,7 +103,7 @@ It collects all relevant metrics and makes them available to Prometheus via the
102103
## Install
103104

104105
- Since Elasticsearch 6.0.0 :
105-
`./bin/elasticsearch-plugin install -b https://distfiles.compuscene.net/elasticsearch/elasticsearch-prometheus-exporter-6.4.3.0.zip`
106+
`./bin/elasticsearch-plugin install -b https://distfiles.compuscene.net/elasticsearch/elasticsearch-prometheus-exporter-6.5.0.0.zip`
106107

107108
- On Elasticsearch 5.x.x :
108109
`./bin/elasticsearch-plugin install -b https://distfiles.compuscene.net/elasticsearch/elasticsearch-prometheus-exporter-5.6.12.0.zip`

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath "org.elasticsearch.gradle:build-tools:6.4.3" // How can we use ${versions.elasticsearch} here ???
11+
classpath "org.elasticsearch.gradle:build-tools:6.5.0" // How can we use ${versions.elasticsearch} here ???
1212
classpath group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'
1313
classpath group: 'com.sun.xml.bind', name: 'jaxb-core', version: '2.3.0'
1414
classpath group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.0'

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group = org.elasticsearch.plugin.prometheus
22

3-
version = 6.4.3.1-SNAPSHOT
3+
version = 6.5.0.0
44

55
pluginName = prometheus-exporter
66
pluginClassname = org.elasticsearch.plugin.prometheus.PrometheusExporterPlugin

src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCatalog.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717

1818
package org.compuscene.metrics.prometheus;
1919

20+
import org.apache.logging.log4j.LogManager;
2021
import org.apache.logging.log4j.Logger;
21-
import org.elasticsearch.common.logging.ESLoggerFactory;
2222
import org.elasticsearch.rest.prometheus.RestPrometheusMetricsAction;
23+
2324
import java.io.IOException;
2425
import java.io.StringWriter;
2526
import java.io.Writer;
@@ -35,7 +36,7 @@
3536
* A class that describes a Prometheus metrics catalog.
3637
*/
3738
public class PrometheusMetricsCatalog {
38-
private static final Logger logger = ESLoggerFactory.getLogger(RestPrometheusMetricsAction.class.getSimpleName());
39+
private static final Logger logger = LogManager.getLogger(RestPrometheusMetricsAction.class);
3940

4041
private String clusterName;
4142
private String nodeName;

src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCollector.java

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@
3939
import org.elasticsearch.script.ScriptStats;
4040
import org.elasticsearch.threadpool.ThreadPoolStats;
4141
import org.elasticsearch.transport.TransportStats;
42+
4243
import java.util.HashMap;
44+
import java.util.List;
4345
import java.util.Map;
46+
4447
import io.prometheus.client.Summary;
4548

4649
/**
@@ -619,6 +622,7 @@ private void updateThreadPoolMetrics(ThreadPoolStats tps) {
619622
}
620623
}
621624

625+
@SuppressWarnings("checkstyle:LineLength")
622626
private void registerIngestMetrics() {
623627
catalog.registerNodeGauge("ingest_total_count", "Ingestion total number");
624628
catalog.registerNodeGauge("ingest_total_time_seconds", "Ingestion total time in seconds");
@@ -629,22 +633,40 @@ private void registerIngestMetrics() {
629633
catalog.registerNodeGauge("ingest_pipeline_total_time_seconds", "Ingestion total time in seconds", "pipeline");
630634
catalog.registerNodeGauge("ingest_pipeline_total_current", "Ingestion total current", "pipeline");
631635
catalog.registerNodeGauge("ingest_pipeline_total_failed_count", "Ingestion total failed", "pipeline");
636+
637+
catalog.registerNodeGauge("ingest_pipeline_processor_total_count", "Ingestion total number", "pipeline", "processor");
638+
catalog.registerNodeGauge("ingest_pipeline_processor_total_time_seconds", "Ingestion total time in seconds", "pipeline", "processor");
639+
catalog.registerNodeGauge("ingest_pipeline_processor_total_current", "Ingestion total current", "pipeline", "processor");
640+
catalog.registerNodeGauge("ingest_pipeline_processor_total_failed_count", "Ingestion total failed", "pipeline", "processor");
632641
}
633642

643+
@SuppressWarnings("checkstyle:LineLength")
634644
private void updateIngestMetrics(IngestStats is) {
635645
if (is != null) {
636646
catalog.setNodeGauge("ingest_total_count", is.getTotalStats().getIngestCount());
637647
catalog.setNodeGauge("ingest_total_time_seconds", is.getTotalStats().getIngestTimeInMillis() / 1000.0);
638648
catalog.setNodeGauge("ingest_total_current", is.getTotalStats().getIngestCurrent());
639649
catalog.setNodeGauge("ingest_total_failed_count", is.getTotalStats().getIngestFailedCount());
640650

641-
for (Map.Entry<String, IngestStats.Stats> entry : is.getStatsPerPipeline().entrySet()) {
642-
String pipeline = entry.getKey();
643-
catalog.setNodeGauge("ingest_pipeline_total_count", entry.getValue().getIngestCount(), pipeline);
644-
catalog.setNodeGauge("ingest_pipeline_total_time_seconds", entry.getValue().getIngestTimeInMillis() / 1000.0,
651+
for (IngestStats.PipelineStat st : is.getPipelineStats()) {
652+
String pipeline = st.getPipelineId();
653+
catalog.setNodeGauge("ingest_pipeline_total_count", st.getStats().getIngestCount(), pipeline);
654+
catalog.setNodeGauge("ingest_pipeline_total_time_seconds", st.getStats().getIngestTimeInMillis() / 1000.0,
645655
pipeline);
646-
catalog.setNodeGauge("ingest_pipeline_total_current", entry.getValue().getIngestCurrent(), pipeline);
647-
catalog.setNodeGauge("ingest_pipeline_total_failed_count", entry.getValue().getIngestFailedCount(), pipeline);
656+
catalog.setNodeGauge("ingest_pipeline_total_current", st.getStats().getIngestCurrent(), pipeline);
657+
catalog.setNodeGauge("ingest_pipeline_total_failed_count", st.getStats().getIngestFailedCount(), pipeline);
658+
659+
List<IngestStats.ProcessorStat> pss = is.getProcessorStats().get(pipeline);
660+
if (pss != null) {
661+
for (IngestStats.ProcessorStat ps : pss) {
662+
String processor = ps.getName();
663+
catalog.setNodeGauge("ingest_pipeline_processor_total_count", ps.getStats().getIngestCount(), pipeline, processor);
664+
catalog.setNodeGauge("ingest_pipeline_processor_total_time_seconds", ps.getStats().getIngestTimeInMillis() / 1000.0,
665+
pipeline, processor);
666+
catalog.setNodeGauge("ingest_pipeline_processor_total_current", ps.getStats().getIngestCurrent(), pipeline, processor);
667+
catalog.setNodeGauge("ingest_pipeline_processor_total_failed_count", ps.getStats().getIngestFailedCount(), pipeline, processor);
668+
}
669+
}
648670
}
649671
}
650672
}

src/main/java/org/elasticsearch/plugin/prometheus/PrometheusExporterPlugin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.elasticsearch.plugin.prometheus;
1919

20+
import org.apache.logging.log4j.LogManager;
2021
import org.apache.logging.log4j.Logger;
2122
import org.compuscene.metrics.prometheus.PrometheusMetricsCollector;
2223
import org.elasticsearch.action.ActionRequest;
@@ -25,13 +26,13 @@
2526
import org.elasticsearch.action.TransportNodePrometheusMetricsAction;
2627
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
2728
import org.elasticsearch.cluster.node.DiscoveryNodes;
28-
import org.elasticsearch.common.logging.Loggers;
2929
import org.elasticsearch.common.settings.*;
3030
import org.elasticsearch.plugins.ActionPlugin;
3131
import org.elasticsearch.plugins.Plugin;
3232
import org.elasticsearch.rest.RestController;
3333
import org.elasticsearch.rest.RestHandler;
3434
import org.elasticsearch.rest.prometheus.RestPrometheusMetricsAction;
35+
3536
import java.util.Arrays;
3637
import java.util.List;
3738
import java.util.function.Supplier;
@@ -40,7 +41,7 @@
4041
* Prometheus Exporter plugin main class.
4142
*/
4243
public class PrometheusExporterPlugin extends Plugin implements ActionPlugin {
43-
private static final Logger logger = Loggers.getLogger(PrometheusExporterPlugin.class);
44+
private static final Logger logger = LogManager.getLogger(PrometheusExporterPlugin.class);
4445

4546
public PrometheusExporterPlugin() {
4647
logger.info("starting Prometheus exporter plugin");

0 commit comments

Comments
 (0)