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
You can configure the monitoring stack to scrape OpenTelemetry Collector metrics endpoints and to remove duplicated labels that the monitoring stack has added during scraping.
9
+
You can configure the OpenTelemetry Collector custom resource (CR) to create a Prometheus `ServiceMonitor` CR to scrape the collector's pipeline metrics and the enabled Prometheus exporters.
10
+
11
+
.Example of the OpenTelemetry Collector custom resource with the Prometheus exporter
12
+
[source,yaml]
13
+
----
14
+
spec:
15
+
mode: deployment
16
+
observability:
17
+
metrics:
18
+
enableMetrics: true <1>
19
+
config: |
20
+
exporters:
21
+
prometheus:
22
+
endpoint: 0.0.0.0:8889
23
+
resource_to_telemetry_conversion:
24
+
enabled: true # by default resource attributes are dropped
25
+
service:
26
+
telemetry:
27
+
metrics:
28
+
address: ":8888"
29
+
pipelines:
30
+
metrics:
31
+
receivers: [otlp]
32
+
exporters: [prometheus]
33
+
----
34
+
<1> Configures the operator to create the Prometheus `ServiceMonitor` CR to scrape the collector's internal metrics endpoint and Prometheus exporter metric endpoints. The metrics will be stored in the OpenShift monitoring stack.
35
+
36
+
37
+
Alternatively, the Prometheus `PodMonitor` can be created manually, which offers more fine-grained control, for instance remove duplicated labels added during Prometheus scraping.
10
38
11
39
.Sample `PodMonitor` custom resource (CR) that configures the monitoring stack to scrape Collector metrics
12
40
[source,yaml]
@@ -18,7 +46,7 @@ metadata:
18
46
spec:
19
47
selector:
20
48
matchLabels:
21
-
app.kubernetes.io/name: otel-collector
49
+
app.kubernetes.io/name: `<cr-name>-collector` <1>
22
50
podMetricsEndpoints:
23
51
- port: metrics <1>
24
52
- port: promexporter <2>
@@ -35,5 +63,6 @@ spec:
35
63
- action: labeldrop
36
64
regex: job
37
65
----
38
-
<1> The name of the internal metrics port for the OpenTelemetry Collector. This port name is always `metrics`.
39
-
<2> The name of the Prometheus exporter port for the OpenTelemetry Collector. This port name is defined in the `.spec.ports` section of the `OpenTelemetryCollector` CR.
66
+
<1> The name of the OpenTelemetry custom resource.
67
+
<2> The name of the internal metrics port for the OpenTelemetry Collector. This port name is always `metrics`.
68
+
<3> The name of the Prometheus exporter port for the OpenTelemetry Collector.
0 commit comments