Skip to content

Commit 5dc985a

Browse files
authored
Merge pull request #101764 from openshift/OBSDOCS-2516
OBSDOCS-2516: Modularize otel-collector-connectors.adoc
2 parents c86ef50 + 929329f commit 5dc985a

File tree

5 files changed

+236
-212
lines changed

5 files changed

+236
-212
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * observability/otel/otel-collector/otel-collector-connectors.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="otel-connectors-count-connector_{context}"]
7+
= Count Connector
8+
9+
[role="_abstract"]
10+
The Count Connector counts trace spans, trace span events, metrics, metric data points, and log records in exporter pipelines.
11+
12+
:FeatureName: The Count Connector
13+
include::snippets/technology-preview.adoc[]
14+
15+
The following are the default metric names:
16+
17+
* `trace.span.count`
18+
* `trace.span.event.count`
19+
* `metric.count`
20+
* `metric.datapoint.count`
21+
* `log.record.count`
22+
23+
You can also expose custom metric names.
24+
25+
.OpenTelemetry Collector custom resource (CR) with an enabled Count Connector
26+
[source,yaml]
27+
----
28+
# ...
29+
config:
30+
receivers:
31+
otlp:
32+
protocols:
33+
grpc:
34+
endpoint: 0.0.0.0:4317
35+
exporters:
36+
prometheus:
37+
endpoint: 0.0.0.0:8889
38+
connectors:
39+
count: {}
40+
service:
41+
pipelines: # <1>
42+
traces/in:
43+
receivers: [otlp]
44+
exporters: [count] # <2>
45+
metrics/out:
46+
receivers: [count] # <3>
47+
exporters: [prometheus]
48+
# ...
49+
----
50+
<1> It is important to correctly configure the Count Connector as an exporter or receiver in the pipeline and to export the generated metrics to the correct exporter.
51+
<2> The Count Connector is configured to receive spans as an exporter.
52+
<3> The Count Connector is configured to emit generated metrics as a receiver.
53+
+
54+
[TIP]
55+
====
56+
If the Count Connector is not generating the expected metrics, you can check whether the OpenTelemetry Collector is receiving the expected spans, metrics, and logs, and whether the telemetry data flow through the Count Connector as expected. You can also use the Debug Exporter to inspect the incoming telemetry data.
57+
====
58+
59+
The Count Connector can count telemetry data according to defined conditions and expose those data as metrics when configured by using such fields as `spans`, `spanevents`, `metrics`, `datapoints`, or `logs`. See the next example.
60+
61+
.Example OpenTelemetry Collector CR for the Count Connector to count spans by conditions
62+
[source,yaml]
63+
----
64+
# ...
65+
config:
66+
connectors:
67+
count:
68+
spans: # <1>
69+
<custom_metric_name>: # <2>
70+
description: "<custom_metric_description>"
71+
conditions:
72+
- 'attributes["env"] == "dev"'
73+
- 'name == "devevent"'
74+
# ...
75+
----
76+
<1> In this example, the exposed metric counts spans with the specified conditions.
77+
<2> You can specify a custom metric name such as `cluster.prod.event.count`.
78+
+
79+
[TIP]
80+
====
81+
Write conditions correctly and follow the required syntax for attribute matching or telemetry field conditions. Improperly defined conditions are the most likely sources of errors.
82+
====
83+
84+
The Count Connector can count telemetry data according to defined attributes when configured by using such fields as `spans`, `spanevents`, `metrics`, `datapoints`, or `logs`. See the next example. The attribute keys are injected into the telemetry data. You must define a value for the `default_value` field for missing attributes.
85+
86+
.Example OpenTelemetry Collector CR for the Count Connector to count logs by attributes
87+
[source,yaml]
88+
----
89+
# ...
90+
config:
91+
connectors:
92+
count:
93+
logs: # <1>
94+
<custom_metric_name>: # <2>
95+
description: "<custom_metric_description>"
96+
attributes:
97+
- key: env
98+
default_value: unknown # <3>
99+
# ...
100+
----
101+
<1> Specifies attributes for logs.
102+
<2> You can specify a custom metric name such as `my.log.count`.
103+
<3> Defines a default value when the attribute is not set.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * observability/otel/otel-collector/otel-collector-connectors.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="otel-connectors-forward-connector_{context}"]
7+
= Forward Connector
8+
9+
[role="_abstract"]
10+
The Forward Connector merges two pipelines of the same type.
11+
12+
:FeatureName: The Forward Connector
13+
include::snippets/technology-preview.adoc[]
14+
15+
.OpenTelemetry Collector custom resource with an enabled Forward Connector
16+
[source,yaml]
17+
----
18+
# ...
19+
config:
20+
receivers:
21+
otlp:
22+
protocols:
23+
grpc:
24+
jaeger:
25+
protocols:
26+
grpc:
27+
processors:
28+
batch:
29+
exporters:
30+
otlp:
31+
endpoint: tempo-simplest-distributor:4317
32+
tls:
33+
insecure: true
34+
connectors:
35+
forward: {}
36+
service:
37+
pipelines:
38+
traces/regiona:
39+
receivers: [otlp]
40+
processors: []
41+
exporters: [forward]
42+
traces/regionb:
43+
receivers: [jaeger]
44+
processors: []
45+
exporters: [forward]
46+
traces:
47+
receivers: [forward]
48+
processors: [batch]
49+
exporters: [otlp]
50+
# ...
51+
----
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * observability/otel/otel-collector/otel-collector-connectors.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="otel-connectors-routing-connector_{context}"]
7+
= Routing Connector
8+
9+
[role="_abstract"]
10+
The Routing Connector routes logs, metrics, and traces to specified pipelines according to resource attributes and their routing conditions, which are written as OpenTelemetry Transformation Language (OTTL) statements.
11+
12+
:FeatureName: The Routing Connector
13+
include::snippets/technology-preview.adoc[]
14+
15+
.OpenTelemetry Collector custom resource with an enabled Routing Connector
16+
[source,yaml]
17+
----
18+
# ...
19+
config:
20+
connectors:
21+
routing:
22+
table: # <1>
23+
- statement: route() where attributes["X-Tenant"] == "dev" # <2>
24+
pipelines: [traces/dev] # <3>
25+
- statement: route() where attributes["X-Tenant"] == "prod"
26+
pipelines: [traces/prod]
27+
default_pipelines: [traces/dev] # <4>
28+
error_mode: ignore # <5>
29+
match_once: false # <6>
30+
service:
31+
pipelines:
32+
traces/in:
33+
receivers: [otlp]
34+
exporters: [routing]
35+
traces/dev:
36+
receivers: [routing]
37+
exporters: [otlp/dev]
38+
traces/prod:
39+
receivers: [routing]
40+
exporters: [otlp/prod]
41+
# ...
42+
----
43+
<1> Connector routing table.
44+
<2> Routing conditions written as OTTL statements.
45+
<3> Destination pipelines for routing the matching telemetry data.
46+
<4> Destination pipelines for routing the telemetry data for which no routing condition is satisfied.
47+
<5> Error-handling mode: The `propagate` value is for logging an error and dropping the payload. The `ignore` value is for ignoring the condition and attempting to match with the next one. The `silent` value is the same as `ignore` but without logging the error. The default is `propagate`.
48+
<6> When set to `true`, the payload is routed only to the first pipeline whose routing condition is met. The default is `false`.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * observability/otel/otel-collector/otel-collector-connectors.adoc
4+
5+
:_mod-docs-content-type: REFERENCE
6+
[id="otel-connectors-spanmetrics-connector_{context}"]
7+
= Spanmetrics Connector
8+
9+
[role="_abstract"]
10+
The Spanmetrics Connector aggregates Request, Error, and Duration (R.E.D) OpenTelemetry metrics from span data.
11+
12+
.OpenTelemetry Collector custom resource with an enabled Spanmetrics Connector
13+
[source,yaml]
14+
----
15+
# ...
16+
config:
17+
connectors:
18+
spanmetrics:
19+
metrics_flush_interval: 15s # <1>
20+
service:
21+
pipelines:
22+
traces:
23+
exporters: [spanmetrics]
24+
metrics:
25+
receivers: [spanmetrics]
26+
# ...
27+
----
28+
<1> Defines the flush interval of the generated metrics. Defaults to `15s`.

0 commit comments

Comments
 (0)