Closed as not planned
Closed as not planned
Description
Component(s)
No response
What happened?
Description
Metric Filter using include/exclude syntax not filtering properly using metric labels/attributes
Steps to Reproduce
My config.yml
receivers:
hostmetrics:
collection_interval: 10s
scrapers:
cpu:
metrics:
system.cpu.time:
enabled: true
processors:
filter/metric_attr:
error_mode: ignore
metrics:
include:
match_type: expr
expressions:
- Label("cpu") == "^cpu0$"
exporters:
prometheus:
endpoint: localhost:8889
namespace: otel-host-metrics
service:
telemetry:
logs:
level: debug
pipelines:
metrics:
receivers: [hostmetrics]
processors: [filter/metric_attr]
exporters: [prometheus]
Expected Result
# HELP otel_host_metrics_system_cpu_time_seconds_total Total seconds each logical CPU spent on each mode.
# TYPE otel_host_metrics_system_cpu_time_seconds_total counter
otel_host_metrics_system_cpu_time_seconds_total{cpu="cpu0",state="idle"} 135036.14
otel_host_metrics_system_cpu_time_seconds_total{cpu="cpu0",state="interrupt"} 0
.
.
.
Actual Result
# HELP otel_host_metrics_system_cpu_time_seconds_total Total seconds each logical CPU spent on each mode.
# TYPE otel_host_metrics_system_cpu_time_seconds_total counter
otel_host_metrics_system_cpu_time_seconds_total{cpu="cpu0",state="idle"} 135036.14
otel_host_metrics_system_cpu_time_seconds_total{cpu="cpu0",state="interrupt"} 0
.
.
.
otel_host_metrics_system_cpu_time_seconds_total{cpu="cpu1",state="idle"} 135040.18
otel_host_metrics_system_cpu_time_seconds_total{cpu="cpu1",state="interrupt"} 0
.
.
.
Collector version
0.104.0
Environment information
Environment
OS: Amazon Linux 2023
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
receivers:
hostmetrics:
collection_interval: 10s
scrapers:
cpu:
metrics:
system.cpu.time:
enabled: true
processors:
filter/metric_attr:
error_mode: ignore
metrics:
include:
match_type: expr
expressions:
- Label("cpu") matches "^cpu0$"
exporters:
prometheus:
endpoint: localhost:8889
namespace: otel-host-metrics
service:
telemetry:
logs:
level: debug
pipelines:
metrics:
receivers: [hostmetrics]
processors: [filter/metric_attr]
exporters: [prometheus]
Log output
debug [email protected]/processor.go:306 Alpha component. May change in the future. {"kind": "processor", "name": "filter/metric_attr", "pipeline": "metrics"}
info [email protected]/metrics.go:98 Metric filter configured {"kind": "processor", "name": "filter/metric_attr", "pipeline": "metrics", "include match_type": "expr", "include expressions": [Label(\"cpu\") == \"cpu0\""], "include metric names": [], "include metrics with resource attributes": null, "exclude match_type": "", "exclude expressions": [], "exclude metric names": [], "exclude metrics with resource attributes": null}
Additional context
No response