Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 34 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b7741c6
Add metrics_count to Prometheus module
shmsr Aug 1, 2024
c311957
Merge branch 'main' into prometheus_count_metrics
shmsr Aug 13, 2024
c6d6e3c
Merge branch 'main' into prometheus_count_metrics
shmsr Aug 20, 2024
f2e735e
Fix CI
shmsr Aug 20, 2024
f16c8bf
Fix CI
shmsr Aug 20, 2024
ce6c25f
Merge branch 'main' into prometheus_count_metrics
shmsr Aug 22, 2024
86540f1
Add NOTE and all remove pre-alloc of 1
shmsr Aug 27, 2024
d732d5d
Update metricbeat/module/prometheus/_meta/fields.yml
shmsr Aug 28, 2024
db10067
Update generated data
shmsr Aug 28, 2024
0268126
Update generated data and do some cleanup
shmsr Aug 28, 2024
5c89dbf
Address review comments
shmsr Aug 28, 2024
914febc
Address review comments
shmsr Aug 28, 2024
3d93923
Add UT
shmsr Aug 28, 2024
1017006
Merge branch 'main' into prometheus_count_metrics
shmsr Aug 29, 2024
48ff2a6
Add Changelog entry
shmsr Aug 29, 2024
cd0b6de
Improve metrics_count calculation for Histogram and Summaries
shmsr Aug 31, 2024
97023db
Fix CI
shmsr Sep 1, 2024
0263eb0
Merge branch 'main' into prometheus_count_metrics
shmsr Sep 1, 2024
0f0e8a7
Remove duplicate
shmsr Sep 1, 2024
78a4bba
Update files
shmsr Sep 1, 2024
72122b1
Update files
shmsr Sep 1, 2024
42df557
Fix tests
shmsr Sep 1, 2024
e33a800
Fix metric_count when there are duplicates
shmsr Sep 1, 2024
d3f9e1e
Fix tests
shmsr Sep 2, 2024
d3b54f5
Merge branch 'main' into prometheus_count_metrics
shmsr Sep 2, 2024
237dcfa
Merge branch 'main' into prometheus_count_metrics
shmsr Sep 5, 2024
5ea8d13
Use FO pattern for remote_write
shmsr Sep 10, 2024
875f8b6
Merge branch 'main' into prometheus_count_metrics
shmsr Sep 10, 2024
b1408a7
Address review comments
shmsr Sep 10, 2024
85d0738
Merge branch 'main' into prometheus_count_metrics
shmsr Sep 11, 2024
2936ea2
Address review comments
shmsr Sep 11, 2024
274f104
Address review comments
shmsr Sep 11, 2024
142b79d
Rename vars
shmsr Sep 11, 2024
4c43a9e
Update metricbeat/module/prometheus/remote_write/remote_write_test.go
shmsr Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Add support for snapshot in vSphere virtualmachine metricset {pull}40683[40683]
- Update fields to use mapstr in vSphere virtualmachine metricset {pull}40707[40707]
- Add support for period based intervalID in vSphere host and datastore metricsets {pull}40678[40678]
- 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
shmsr marked this conversation as resolved.
Show resolved Hide resolved
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
Loading