Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
5 changes: 5 additions & 0 deletions packages/haproxy/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.19.0"
changes:
- description: Add Prometheus metric data stream
type: enhancement
link: https://github.com/elastic/integrations/pull/17270
- version: "1.18.0"
changes:
- description: Expose condition option in UI for metrics
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
service: haproxy
vars:
hosts:
- http://{{Hostname}}:8405
input: prometheus/metrics
data_stream:
vars:
period: 10s
metrics_path: /metrics
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
metricsets: ["collector"]
hosts:
{{#each hosts}}
- {{this}}
{{/each}}
metrics_path: {{metrics_path}}
period: {{period}}
{{#if username}}
username: "{{username}}"
{{/if}}
{{#if password}}
password: "{{password}}"
{{/if}}
{{#if ssl}}
{{ssl}}
{{/if}}
tags:
{{#each tags as |tag|}}
- {{tag}}
{{/each}}
{{#if processors}}
processors:
{{processors}}
{{/if}}

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
description: Pipeline for parsing HAProxy metrics.
processors:
- remove:
field: prometheus.metrics.up
ignore_missing: true
- remove:
field: prometheus.labels
ignore_missing: true
Comment on lines +7 to +9
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Critical ingest_pipeline/default.yml:7

The ingest pipeline unconditionally removes prometheus.labels at lines 7-9, but fields.yml defines prometheus.labels.instance, prometheus.labels.job, prometheus.labels.proxy, and prometheus.labels.state as dimension: true. Since this data stream uses index_mode: "time_series", removing these labels causes metrics from different HAProxy proxies, servers, and states to collapse into the same time series, resulting in silent data loss. Consider removing only unwanted labels while preserving the dimension-critical ones.

-  - remove:
-      field: prometheus.labels
-      ignore_missing: true
Also found in 1 other location(s)

packages/haproxy/data_stream/metrics/fields/fields.yml:5

The ingest pipeline in default.yml removes prometheus.labels entirely via a remove processor, but lines 5-24 of fields.yml define prometheus.labels.instance, prometheus.labels.job, prometheus.labels.proxy, and prometheus.labels.state as dimension: true fields. With index_mode: "time_series" configured in manifest.yml, these dimensions are critical for uniquely identifying time series. Because the pipeline deletes them before indexing, metrics from different HAProxy proxies, servers, and states will collapse into the same time series, causing data loss or incorrect metric values. For example, haproxy_backend_current_sessions for proxy "web" and proxy "api" would be indistinguishable.

🤖 Copy this AI Prompt to have your agent fix this:
In file packages/haproxy/data_stream/metrics/elasticsearch/ingest_pipeline/default.yml around lines 7-9:

The ingest pipeline unconditionally removes `prometheus.labels` at lines 7-9, but `fields.yml` defines `prometheus.labels.instance`, `prometheus.labels.job`, `prometheus.labels.proxy`, and `prometheus.labels.state` as `dimension: true`. Since this data stream uses `index_mode: "time_series"`, removing these labels causes metrics from different HAProxy proxies, servers, and states to collapse into the same time series, resulting in silent data loss. Consider removing only unwanted labels while preserving the dimension-critical ones.

Also found in 1 other location(s):
- packages/haproxy/data_stream/metrics/fields/fields.yml:5 -- The ingest pipeline in `default.yml` removes `prometheus.labels` entirely via a `remove` processor, but lines 5-24 of `fields.yml` define `prometheus.labels.instance`, `prometheus.labels.job`, `prometheus.labels.proxy`, and `prometheus.labels.state` as `dimension: true` fields. With `index_mode: "time_series"` configured in `manifest.yml`, these dimensions are critical for uniquely identifying time series. Because the pipeline deletes them before indexing, metrics from different HAProxy proxies, servers, and states will collapse into the same time series, causing data loss or incorrect metric values. For example, `haproxy_backend_current_sessions` for proxy "web" and proxy "api" would be indistinguishable.

- rename:
field: prometheus.metrics
target_field: haproxy.metrics
ignore_missing: true
on_failure:
- set:
field: error.message
value: "{{{_ingest.on_failure_message}}}"
12 changes: 12 additions & 0 deletions packages/haproxy/data_stream/metrics/fields/base-fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: data_stream.type
type: constant_keyword
description: Data stream type.
- name: data_stream.dataset
type: constant_keyword
description: Data stream dataset.
- name: data_stream.namespace
type: constant_keyword
description: Data stream namespace.
- name: '@timestamp'
type: date
description: Event timestamp.
27 changes: 27 additions & 0 deletions packages/haproxy/data_stream/metrics/fields/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- 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
Loading
Loading