feat: update metric agent to expose prometheus scrape metrics - #3647
Open
jeffreylimnardy wants to merge 5 commits into
Open
feat: update metric agent to expose prometheus scrape metrics#3647jeffreylimnardy wants to merge 5 commits into
jeffreylimnardy wants to merge 5 commits into
Conversation
Contributor
Control PanelHi, I'm an AI-powered Review Bot that helps you with summarizing and reviewing pull requests.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
The metric agent OTel Collector now exposes Prometheus scrape health metrics (such as
up,scrape_duration_seconds, andscrape_body_size_bytes) on a dedicated port so cluster operators can monitor scraping health without routing those metrics through user pipelines.Affected Signal Types
Metrics
Key Changes
internal/otelcollector/config/metricagent: Adds a newmetrics/ops-scrape-metricsinternal pipeline that keeps only the scrape health metric subset (opsScrapeMetricNames), drops healthy entries (whereup == 1andscrape_body_size_bytes > 0), and exports the remainder via a Prometheus exporter on port 9090. The pipeline is activated only when Prometheus or Istio input is enabled.internal/otelcollector/config/metricagent: Extends theenrichmentRoutingConnectorto forward Prometheus- and Istio-sourced metrics to the new ops pipeline in addition to the per-user-pipeline outputs, using a newincludeOpsScrapeMetricsflag.internal/otelcollector/config/metricagent: Enablesextra_scrape_metrics: trueon all Prometheus scrape jobs (pods, services, Istio proxy) and expandsdiagnosticMetricNameswithscrape_timeout_seconds,scrape_sample_limit, andscrape_body_size_bytes.internal/otelcollector/config/common: Adds component ID constantsComponentIDOpsKeepScrapeMetricsProcessor,ComponentIDOpsDropHealthyScrapeMetricsProcessor, andComponentIDOpsScrapeMetricsExporter, plus thePrometheusExporterConfigandResourceToTelemetryConversiontypes.internal/otelcollector/ports: Adds the constantOpsScrapeMetrics = 9090for the new Prometheus exporter endpoint.internal/resources/otelcollector: Opens port 9090 in the metric agent NetworkPolicy ingress rules and excludes port 9090 from Istio sidecar interception via thetraffic.sidecar.istio.io/excludeInboundPortsannotation.Notes for Reviewers
The ops pipeline drops metrics where
up == 1(healthy) andscrape_body_size_bytes > 0before exporting, so only failed or anomalous scrape targets appear in the Prometheus endpoint by default. Thescrape_timeout_secondsandscrape_sample_limitmetrics are intentionally excluded from the ops pipeline (opsScrapeMetricNames) because they are static per-job values that add no per-target health signal. TheResourceToTelemetryConversionis enabled on the Prometheus exporter so resource attributes become Prometheus labels.Release Notes Input
Recommended Action: If you scrape the metric agent's Prometheus endpoint (port 9090), you will now find scrape health metrics there for all active Prometheus and Istio scrape targets.
Metrics: The metric agent now exposes a Prometheus endpoint on port 9090 that reports scrape health metrics (
up,scrape_duration_seconds,scrape_samples_scraped,scrape_samples_post_metric_relabeling,scrape_series_added,scrape_body_size_bytes) for Prometheus and Istio input sources. Only non-healthy entries (failed scrapes or zero-byte responses) are reported. This endpoint is active whenever at least one MetricPipeline has Prometheus or Istio input enabled.PR Bot Information
Version:
1.23.0issue_comment.editeda5446bb3-d5eb-4356-8216-f455c4cec416