Skip to content

Commit 8541093

Browse files
authored
Merge pull request openshift#10 from pavolloffay/distributed-tracing-3.0-prometheus-podmonitor
TRACING-3513 | Document that OTEL operator can create service monitors
2 parents 26b645b + 4548ff9 commit 8541093

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed

modules/distr-tracing-otel-config-collector.adoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ metadata:
2626
namespace: tracing-system
2727
spec:
2828
mode: deployment
29-
ports:
30-
- name: promexporter
31-
port: 8889
32-
protocol: TCP
29+
observability:
30+
metrics:
31+
enableMetrics: true
3332
config: |
3433
receivers:
3534
otlp:

modules/distr-tracing-otel-config-send-metrics-monitoring-stack.adoc

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,35 @@ This module is included in the following assemblies:
66
[id="distr-tracing-send-metrics-monitoring-stack_{context}"]
77
= Sending metrics to the monitoring stack
88

9-
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.
1038

1139
.Sample `PodMonitor` custom resource (CR) that configures the monitoring stack to scrape Collector metrics
1240
[source,yaml]
@@ -18,7 +46,7 @@ metadata:
1846
spec:
1947
selector:
2048
matchLabels:
21-
app.kubernetes.io/name: otel-collector
49+
app.kubernetes.io/name: `<cr-name>-collector` <1>
2250
podMetricsEndpoints:
2351
- port: metrics <1>
2452
- port: promexporter <2>
@@ -35,5 +63,6 @@ spec:
3563
- action: labeldrop
3664
regex: job
3765
----
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

Comments
 (0)