Skip to content

Commit

Permalink
[8.x](backport #40411) {,x-pack/}metricbeat/module/prometheus/{collec…
Browse files Browse the repository at this point in the history
…tor,remote_write}: Add `metrics_count` to Prometheus module if `metrics_count` is `true` (#40784)

* {,x-pack/}metricbeat/module/prometheus/{collector,remote_write}: Add `metrics_count` to Prometheus module if `metrics_count` is `true` (#40411)

Co-authored-by: Ishleen Kaur <102962586+ishleenk17@users.noreply.github.com>
Co-authored-by: Aman <38116245+devamanv@users.noreply.github.com>
(cherry picked from commit 3c9563c)

* Update CHANGELOG.next.asciidoc

---------

Co-authored-by: subham sarkar <subham.sarkar@elastic.co>
  • Loading branch information
mergify[bot] and shmsr authored Sep 13, 2024
1 parent caccf51 commit 9136549
Show file tree
Hide file tree
Showing 36 changed files with 1,422 additions and 486 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Add new metricset network for the vSphere module. {pull}40559[40559]
- Add new metricset resourcepool for the vSphere module. {pull}40456[40456]
- Log the total time taken for GCP `ListTimeSeries` and `AggregatedList` requests {pull}40661[40661]
- Add `metrics_count` to Prometheus module if `metrics_count: true` is set. {pull}40411[40411]

*Metricbeat*

Expand Down
10 changes: 10 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -58258,6 +58258,16 @@ Stats scraped from a Prometheus endpoint.



*`metrics_count`*::
+
--
Number of metrics per Elasticsearch document.


type: long

--


*`prometheus.labels.*`*::
+
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/docs/modules/prometheus.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ metricbeat.modules:
#username: "user"
#password: "secret"
# Count number of metrics present in Elasticsearch document (default: false)
#metrics_count: false
# This can be used for service account based authorization:
#bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
#ssl.certificate_authorities:
Expand All @@ -62,6 +65,9 @@ metricbeat.modules:
# host: "localhost"
# port: "9201"
# Count number of metrics present in Elasticsearch document (default: false)
#metrics_count: false
# Secure settings for the server using TLS/SSL:
#ssl.certificate: "/etc/pki/server/cert.pem"
#ssl.key: "/etc/pki/server/cert.key"
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,9 @@ metricbeat.modules:
#username: "user"
#password: "secret"

# Count number of metrics present in Elasticsearch document (default: false)
#metrics_count: false

# This can be used for service account based authorization:
#bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
#ssl.certificate_authorities:
Expand All @@ -900,6 +903,9 @@ metricbeat.modules:
# host: "localhost"
# port: "9201"

# Count number of metrics present in Elasticsearch document (default: false)
#metrics_count: false

# Secure settings for the server using TLS/SSL:
#ssl.certificate: "/etc/pki/server/cert.pem"
#ssl.key: "/etc/pki/server/cert.key"
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/module/prometheus/_meta/config.epr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
username: "user"
password: "secret"

# Count number of metrics present in Elasticsearch document (default: false)
#metrics_count: false

# This can be used for service account based authorization:
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
ssl.certificate_authorities:
Expand All @@ -28,6 +31,9 @@
host: "localhost"
port: "9201"

# Count number of metrics present in Elasticsearch document (default: false)
metrics_count: false

# Secure settings for the server using TLS/SSL:
ssl.enabled: false
ssl.certificate: "/etc/pki/server/cert.pem"
Expand Down
6 changes: 6 additions & 0 deletions metricbeat/module/prometheus/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#username: "user"
#password: "secret"

# Count number of metrics present in Elasticsearch document (default: false)
#metrics_count: false

# This can be used for service account based authorization:
#bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
#ssl.certificate_authorities:
Expand All @@ -22,6 +25,9 @@
# host: "localhost"
# port: "9201"

# Count number of metrics present in Elasticsearch document (default: false)
#metrics_count: false

# Secure settings for the server using TLS/SSL:
#ssl.certificate: "/etc/pki/server/cert.pem"
#ssl.key: "/etc/pki/server/cert.key"
Expand Down
4 changes: 4 additions & 0 deletions metricbeat/module/prometheus/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
release: ga
settings: ["ssl", "http"]
fields:
- name: metrics_count
type: long
description: >
Number of metrics per Elasticsearch document.
- name: prometheus
type: group
fields:
Expand Down
9 changes: 6 additions & 3 deletions metricbeat/module/prometheus/collector/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@
"duration": 115000,
"module": "prometheus"
},
"metrics_count": 2,
"metricset": {
"name": "collector",
"period": 10000
},
"prometheus": {
"labels": {
"job": "prometheus"
"job": "prometheus",
"listener_name": "http"
},
"metrics": {
"up": 1
"net_conntrack_listener_conn_accepted_total": 3,
"net_conntrack_listener_conn_closed_total": 0
}
},
"service": {
"address": "127.0.0.1:55555",
"type": "prometheus"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ type: http
url: "/metrics"
suffix: plain
remove_fields_from_comparison: ["prometheus.labels.instance"]
module:
metrics_count: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
"duration": 115000,
"module": "prometheus"
},
"metrics_count": 2,
"metricset": {
"name": "collector",
"period": 10000
},
"prometheus": {
"labels": {
"instance": "127.0.0.1:41103",
"job": "prometheus"
"instance": "127.0.0.1:61483",
"job": "prometheus",
"listener_name": "http"
},
"metrics": {
"up": 1
"net_conntrack_listener_conn_accepted_total": 3,
"net_conntrack_listener_conn_closed_total": 0
}
},
"service": {
Expand All @@ -29,19 +32,18 @@
"duration": 115000,
"module": "prometheus"
},
"metrics_count": 1,
"metricset": {
"name": "collector",
"period": 10000
},
"prometheus": {
"labels": {
"instance": "127.0.0.1:41103",
"job": "prometheus",
"listener_name": "http"
"instance": "127.0.0.1:61483",
"job": "prometheus"
},
"metrics": {
"net_conntrack_listener_conn_accepted_total": 3,
"net_conntrack_listener_conn_closed_total": 0
"up": 1
}
},
"service": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
"duration": 115000,
"module": "prometheus"
},
"metrics_count": 1,
"metricset": {
"name": "collector",
"period": 10000
},
"prometheus": {
"labels": {
"instance": "127.0.0.1:44633",
"instance": "127.0.0.1:61485",
"job": "prometheus",
"name": "PS Scavenge"
"name": "PS MarkSweep"
},
"metrics": {
"base_gc_total_total": 34
"base_gc_total_total": 4
}
},
"service": {
Expand All @@ -30,18 +31,18 @@
"duration": 115000,
"module": "prometheus"
},
"metrics_count": 1,
"metricset": {
"name": "collector",
"period": 10000
},
"prometheus": {
"labels": {
"instance": "127.0.0.1:44633",
"job": "prometheus",
"name": "PS MarkSweep"
"instance": "127.0.0.1:61485",
"job": "prometheus"
},
"metrics": {
"base_gc_total_total": 4
"up": 1
}
},
"service": {
Expand All @@ -55,17 +56,19 @@
"duration": 115000,
"module": "prometheus"
},
"metrics_count": 1,
"metricset": {
"name": "collector",
"period": 10000
},
"prometheus": {
"labels": {
"instance": "127.0.0.1:44633",
"job": "prometheus"
"instance": "127.0.0.1:61485",
"job": "prometheus",
"name": "PS Scavenge"
},
"metrics": {
"up": 1
"base_gc_total_total": 34
}
},
"service": {
Expand Down
Loading

0 comments on commit 9136549

Please sign in to comment.