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

[etcd] Use prometheus metricset for etcd v3 metrics #8438

Merged
merged 28 commits into from Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/etcd/_dev/deploy/docker/Dockerfile
@@ -1,2 +1,3 @@
ARG SERVICE_VERSION=${SERVICE_VERSION:-3.5.1}
FROM bitnami/etcd:${SERVICE_VERSION}
HEALTHCHECK --interval=15s --retries=90 CMD curl -f http://localhost:2379/metrics
5 changes: 5 additions & 0 deletions packages/etcd/changelog.yml
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.0.0"
agithomas marked this conversation as resolved.
Show resolved Hide resolved
changes:
- description: Use prometheus metricset instead of etcd metricset. Add ECS fields. Add dimensions mappings and metric types.
gpop63 marked this conversation as resolved.
Show resolved Hide resolved
type: enhancement
link: https://github.com/elastic/integrations/pull/8438
- version: 0.6.0
changes:
- description: Update the package format_version to 3.0.0.
Expand Down
@@ -1,6 +1,3 @@
vars:
hosts:
- http://{{Hostname}}:2379
data_stream:
vars:
server_status_path: /metrics
- http://{{Hostname}}:2379/metrics
12 changes: 8 additions & 4 deletions packages/etcd/data_stream/metrics/agent/stream/stream.yml.hbs
@@ -1,9 +1,13 @@
metricsets: ["metrics"]
metricsets: ["collector"]
hosts:
{{#each hosts}}
- {{this}}
{{/each}}
metrics_filters.include:
{{#each metrics_filters.include}}
- {{this}}
{{/each}}
metrics_path: {{metrics_path}}
period: {{period}}
{{#if server_status_path}}
server_status_path: {{server_status_path}}
{{/if}}
use_types: true
rate_counters: false
@@ -0,0 +1,86 @@
---
description: Pipeline for processing etcd v3 metrics.
processors:
- set:
field: event.module
value: etcd
- rename:
field: prometheus.etcd_mvcc_db_total_size_in_bytes.value
target_field: etcd.disk.mvcc_db_total_size.bytes
ignore_missing: true
- rename:
field: prometheus.etcd_disk_wal_fsync_duration_seconds.histogram
target_field: etcd.disk.wal_fsync_duration_seconds.histogram
ignore_missing: true
- rename:
field: prometheus.etcd_disk_backend_commit_duration_seconds.histogram
target_field: etcd.disk.backend_commit_duration_seconds.histogram
ignore_missing: true
- rename:
field: prometheus.go_memstats_alloc_bytes.value
target_field: etcd.memory.go_memstats_alloc.bytes
ignore_missing: true
- rename:
field: prometheus.go_memstats_alloc_bytes_total.counter
target_field: etcd.memory.go_memstats_alloc.total.bytes
ignore_missing: true
- rename:
field: prometheus.etcd_network_client_grpc_sent_bytes_total.counter
target_field: etcd.network.client_grpc_sent.bytes
ignore_missing: true
- rename:
field: prometheus.etcd_network_client_grpc_received_bytes_total.counter
target_field: etcd.network.client_grpc_received.bytes
ignore_missing: true
- rename:
field: prometheus.etcd_server_has_leader.value
target_field: etcd.server.has_leader.count
ignore_missing: true
- rename:
field: prometheus.etcd_server_leader_changes_seen_total.counter
target_field: etcd.server.leader_changes.count
ignore_missing: true
- rename:
field: prometheus.etcd_server_proposals_committed_total.value
target_field: etcd.server.proposals_committed.count
ignore_missing: true
- rename:
field: prometheus.etcd_server_proposals_pending.value
target_field: etcd.server.proposals_pending.count
ignore_missing: true
- rename:
field: prometheus.etcd_server_proposals_failed_total.counter
target_field: etcd.server.proposals_failed.count
ignore_missing: true
- rename:
field: prometheus.grpc_server_started_total.counter
target_field: etcd.server.grpc_started.count
ignore_missing: true
- rename:
field: prometheus.grpc_server_handled_total.counter
target_field: etcd.server.grpc_handled.count
ignore_missing: true
- rename:
field: prometheus.labels
target_field: etcd.labels
ignore_missing: true
ignore_failure: true
- fingerprint:
fields: ["etcd.labels"]
target_field: "etcd.labels.fingerprint"
ignore_missing: true
- remove:
field: prometheus
ignore_missing: true
- set:
field: event.kind
value: pipeline_error
if: ctx.error?.message != null
on_failure:
- set:
field: error.message
value: "{{{_ingest.on_failure_message}}}"
- append:
field: event.kind
value: pipeline_error
allow_duplicates: false
43 changes: 35 additions & 8 deletions packages/etcd/data_stream/metrics/fields/ecs.yml
@@ -1,8 +1,35 @@
- external: ecs
name: host.ip
- external: ecs
name: ecs.version
- external: ecs
name: service.address
- external: ecs
name: service.type
- name: ecs.version
external: ecs
- name: event.duration
external: ecs
- name: event.kind
external: ecs
- name: service.type
external: ecs
- name: service.address
dimension: true
external: ecs
- name: agent.id
dimension: true
external: ecs
- name: cloud.account.id
dimension: true
external: ecs
- name: cloud.region
dimension: true
external: ecs
- name: cloud.availability_zone
dimension: true
external: ecs
- name: cloud.instance.id
dimension: true
external: ecs
- name: cloud.provider
dimension: true
external: ecs
- name: container.id
dimension: true
external: ecs
- name: host.name
dimension: true
external: ecs
141 changes: 57 additions & 84 deletions packages/etcd/data_stream/metrics/fields/fields.yml
Expand Up @@ -6,105 +6,78 @@
fields:
- name: mvcc_db_total_size.bytes
type: long
metric_type: gauge
description: |
Size of stored data at MVCC
- name: wal_fsync_duration.ns.bucket.*
type: long
- name: wal_fsync_duration_seconds.histogram
agithomas marked this conversation as resolved.
Show resolved Hide resolved
type: histogram
description: |
Latency for writing ahead logs to disk
- name: wal_fsync_duration.ns.count
type: long
description: |
Write ahead logs count
- name: wal_fsync_duration.ns.sum
type: long
description: |
Write ahead logs latency sum
- name: backend_commit_duration.ns.bucket.*
type: long
- name: backend_commit_duration_seconds.histogram
type: histogram
description: |
Latency for writing backend changes to disk
- name: backend_commit_duration.ns.count
- name: memory
type: group
fields:
- name: go_memstats_alloc.bytes
type: long
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you want to put unit: byte and similar for field mappings?

metric_type: gauge
description: |
Backend commits count
- name: backend_commit_duration.ns.sum
Memory allocated bytes as of MemStats Go
- name: go_memstats_alloc.total.bytes
type: long
metric_type: counter
description: |
Backend commits latency sum
- name: memory
type: group
fields:
- name: go_memstats_alloc
type: group
fields:
- name: bytes
type: long
description: |
Memory allocated bytes as of MemStats Go
Memory allocated bytes as of MemStats Go
ritalwar marked this conversation as resolved.
Show resolved Hide resolved
- name: network
type: group
fields:
- name: client_grpc_sent
type: group
fields:
- name: bytes
type: long
description: |
gRPC sent bytes total
- name: client_grpc_received
type: group
fields:
- name: bytes
type: long
description: |
gRPC received bytes total
- name: client_grpc_sent.bytes
type: long
metric_type: counter
description: |
gRPC sent bytes total
- name: client_grpc_received.bytes
type: long
metric_type: counter
description: |
gRPC received bytes total
- name: server
type: group
fields:
- name: has_leader
type: byte
- name: has_leader.count
type: long
metric_type: gauge
description: |
Whether a leader exists in the cluster
- name: leader_changes
type: group
fields:
- name: count
type: long
description: |
Number of leader changes seen at the cluster
- name: proposals_committed
type: group
fields:
- name: count
type: long
description: |
Number of consensus proposals commited
- name: proposals_pending
type: group
fields:
- name: count
type: long
description: |
Number of consensus proposals pending
- name: proposals_failed
type: group
fields:
- name: count
type: long
description: |
Number of consensus proposals failed
- name: grpc_started
type: group
fields:
- name: count
type: long
description: |
Number of sent gRPC requests
- name: grpc_handled
type: group
fields:
- name: count
type: long
description: |
Number of received gRPC requests
- name: leader_changes.count
type: long
metric_type: counter
description: |
Number of leader changes seen at the cluster
- name: proposals_committed.count
type: long
metric_type: gauge
description: |
Number of consensus proposals commited
- name: proposals_pending.count
type: long
metric_type: gauge
description: |
Number of consensus proposals pending
- name: proposals_failed.count
type: long
metric_type: counter
description: |
Number of consensus proposals failed
- name: grpc_started.count
type: long
metric_type: counter
description: |
Number of sent gRPC requests
- name: grpc_handled.count
type: long
metric_type: counter
description: |
Number of received gRPC requests
12 changes: 9 additions & 3 deletions packages/etcd/data_stream/metrics/fields/package-fields.yml
@@ -1,7 +1,13 @@
- name: etcd
type: group
fields:
- name: api_version
- name: labels.*
type: keyword
ritalwar marked this conversation as resolved.
Show resolved Hide resolved
description: |
Etcd API version for metrics retrieval
object_type_mapping_type: "*"
description: >-
etcd labels.
- name: labels.fingerprint
agithomas marked this conversation as resolved.
Show resolved Hide resolved
type: keyword
dimension: true
description: >-
Unique fingerprint of the etcd labels.
23 changes: 15 additions & 8 deletions packages/etcd/data_stream/metrics/manifest.yml
@@ -1,7 +1,9 @@
title: etcd metrics v3
title: etcd v3 metrics
type: metrics
streams:
- input: etcd/metrics
- input: prometheus/metrics
title: etcd v3 metrics
description: Collect etcd v3 metrics.
vars:
- name: period
type: text
Expand All @@ -10,12 +12,17 @@ streams:
required: true
show_user: true
default: 10s
- name: server_status_path
- name: metrics_path
type: text
title: Server Status Path
title: Metrics Path
multi: false
required: true
show_user: false
required: false
show_user: true
default: /metrics
title: etcd metrics v3
description: Collect etcd metrics v3
- name: metrics_filters.include
type: text
title: Metrics Filters Include
multi: true
required: false
show_user: true
default: ["etcd_server_has_leader", "etcd_server_leader_changes_seen_total", "etcd_server_proposals_committed_total", "etcd_server_proposals_pending", "etcd_server_proposals_failed_total", "grpc_server_started_total", "grpc_server_handled_total", "etcd_mvcc_db_total_size_in_bytes", "etcd_disk_wal_fsync_duration_seconds", "etcd_disk_backend_commit_duration_seconds", "go_memstats_alloc_bytes", "etcd_network_client_grpc_sent_bytes_total", "etcd_network_client_grpc_received_bytes_total"]