feat: support metric name filtering in OpenTelemetry exporter - #2344
feat: support metric name filtering in OpenTelemetry exporter#2344subhramit wants to merge 5 commits into
Conversation
Signed-off-by: subhramit <subhramit.bb@live.in>
|
cc @zeitlinger :) |
zeitlinger
left a comment
There was a problem hiding this comment.
The filtering implementation is consistent with PrometheusScrapeHandler: it builds the same MetricNameFilter from all four ExporterFilterProperties fields and uses registry.scrape(predicate). I ran the exporter module test reactor locally and it passed (including all 35 exporter-module tests). The two new tests cover exact-name exclusion and allowed-prefix filtering; please also add coverage through the user-facing configuration path (OtelAutoConfig) rather than only constructing PrometheusMetricProducer directly, so the wiring itself is protected against regression.
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
This is also added now. |
zeitlinger
left a comment
There was a problem hiding this comment.
Could you add a short note to docs/content/otel/otlp.md that the OpenTelemetry exporter now honors the shared io.prometheus.exporter.filter.* metric-name filter properties, with a link to the existing “Exporter Filter Properties” section in docs/content/config/config.md? The property keys are already documented there, so a separate page is not needed.
Signed-off-by: subhramit <subhramit.bb@live.in>
Added. |
Closes the last pending high-priority item in #1816 (as all others have already been addressed).
Currently,
PrometheusMetricProduceralways exported all metrics in the registry unconditionally. The code already had a TODO sketching how filtering could be added:client_java/prometheus-metrics-exporter-opentelemetry/src/main/java/io/prometheus/metrics/exporter/opentelemetry/PrometheusMetricProducer.java
Lines 47 to 54 in 9432fdc
this PR implements that by reusing
ExporterFilterPropertiesandMetricNameFilter, as already done byPrometheusScrapeHandler.As a result, the OpenTelemetry exporter now honors the shared
io.prometheus.exporter.filter.*configuration, making its behavior consistent with the HTTP/Servlet exporters.