You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scrape_configs:
- job_name: kubernetes-services[...]relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_metrics_prefix]target_label: metrics_prefixaction: replace# This does not workmetric_relabel_configs:
- source_labels: [metrics_prefix, __name__]regex: (.+);(.+)target_label: __name__replacement: $1_$2action: replace# But this worksmetric_relabel_configs:
- source_labels: [metrics_prefix, __name__]regex: (.+);(.+)target_label: __name__replacement: foo_$2action: replace
NOTES: I've also tried replacement with values ${1}_${2} and $$1_$$2 but it still doesn't work. I wrote the metrics to file using file exporter and I did see that metrics_prefix label does have the value testprefix in the file.
Expected Result
Each metric name, except for up, should be prefixed with testprefix_.
Component(s)
cmd/otelcontribcol
What happened?
Description
When using the
metric_relabel_configs
to rename metrics using value from annotation it doesn't work. It does work when using string literal.Steps to Reproduce
Service
NOTES: I've also tried
replacement
with values${1}_${2}
and$$1_$$2
but it still doesn't work. I wrote the metrics to file usingfile
exporter and I did see thatmetrics_prefix
label does have the valuetestprefix
in the file.Expected Result
Each metric name, except for
up
, should be prefixed withtestprefix_
.Actual Result
All metrics names stay the same.
Collector version
v0.95.0
Environment information
Environment
OS: ContainerOS
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Provided above.
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: