Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 7. Configuring metrics for the monitoring stack
As a cluster administrator, you can configure the OpenTelemetry Collector custom resource (CR) to perform the following tasks:
-
Create a Prometheus
ServiceMonitor
CR for scraping the Collector’s pipeline metrics and the enabled Prometheus exporters. - Configure the Prometheus receiver to scrape metrics from the in-cluster monitoring stack.
7.1. Configuration for sending metrics to the monitoring stack Copier lienLien copié sur presse-papiers!
You can configure the OpenTelemetryCollector
custom resource (CR) to create a Prometheus ServiceMonitor
CR or a PodMonitor
CR for a sidecar deployment. A ServiceMonitor
can scrape Collector’s internal metrics endpoint and Prometheus exporter metrics endpoints.
Example of the OpenTelemetry Collector CR with the Prometheus exporter
- 1
- Configures the Red Hat build of OpenTelemetry Operator to create the Prometheus
ServiceMonitor
CR orPodMonitor
CR to scrape the Collector’s internal metrics endpoint and the Prometheus exporter metrics endpoints.
Setting enableMetrics
to true
creates the following two ServiceMonitor
instances:
-
One
ServiceMonitor
instance for the<instance_name>-collector-monitoring
service. ThisServiceMonitor
instance scrapes the Collector’s internal metrics. -
One
ServiceMonitor
instance for the<instance_name>-collector
service. ThisServiceMonitor
instance scrapes the metrics exposed by the Prometheus exporter instances.
Alternatively, a manually created Prometheus PodMonitor
CR can provide fine control, for example removing duplicated labels added during Prometheus scraping.
Example of the PodMonitor
CR that configures the monitoring stack to scrape the Collector metrics
7.2. Configuration for receiving metrics from the monitoring stack Copier lienLien copié sur presse-papiers!
A configured OpenTelemetry Collector custom resource (CR) can set up the Prometheus receiver to scrape metrics from the in-cluster monitoring stack.
Example of the OpenTelemetry Collector CR for scraping metrics from the in-cluster monitoring stack
- 1
- Assigns the
cluster-monitoring-view
cluster role to the service account of the OpenTelemetry Collector so that it can access the metrics data. - 2
- Injects the OpenShift service CA for configuring the TLS in the Prometheus receiver.
- 3
- Configures the Prometheus receiver to scrape the federate endpoint from the in-cluster monitoring stack.
- 4
- Uses the Prometheus query language to select the metrics to be scraped. See the in-cluster monitoring documentation for more details and limitations of the federate endpoint.
- 5
- Configures the debug exporter to print the metrics to the standard output.