Skip to content

Commit 7d33689

Browse files
Israel Blancasmax-cx
authored andcommitted
OBSDOCS-1405: Add docs for the Count Connector
Signed-off-by: Israel Blancas <iblancas@redhat.com>
1 parent 61c22bb commit 7d33689

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

observability/otel/otel-collector/otel-collector-connectors.adoc

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,104 @@ toc::[]
88

99
A connector connects two pipelines. It consumes data as an exporter at the end of one pipeline and emits data as a receiver at the start of another pipeline. It can consume and emit data of the same or different data type. It can generate and emit data to summarize the consumed data, or it can merely replicate or route data.
1010

11+
[id="count-connector_{context}"]
12+
== Count Connector
13+
14+
The Count Connector counts trace spans, trace span events, metrics, metric data points, and log records in exporter pipelines.
15+
16+
:FeatureName: The Count Connector
17+
include::snippets/technology-preview.adoc[]
18+
19+
The following are the default metric names:
20+
21+
* `trace.span.count`
22+
* `trace.span.event.count`
23+
* `metric.count`
24+
* `metric.datapoint.count`
25+
* `log.record.count`
26+
27+
You can also expose custom metric names.
28+
29+
.OpenTelemetry Collector custom resource (CR) with an enabled Count Connector
30+
[source,yaml]
31+
----
32+
# ...
33+
config: |
34+
receivers:
35+
otlp:
36+
protocols:
37+
grpc:
38+
endpoint: 0.0.0.0:4317
39+
exporters:
40+
prometheus:
41+
endpoint: 0.0.0.0:8889
42+
connectors:
43+
count:
44+
service:
45+
pipelines: # <1>
46+
traces/in:
47+
receivers: [otlp]
48+
exporters: [count] # <2>
49+
metrics/out:
50+
receivers: [count] # <3>
51+
exporters: [prometheus]
52+
# ...
53+
----
54+
<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.
55+
<2> The Count Connector is configured to receive spans as an exporter.
56+
<3> The Count Connector is configured to emit generated metrics as a receiver.
57+
+
58+
[TIP]
59+
====
60+
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.
61+
====
62+
63+
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.
64+
65+
.Example OpenTelemetry Collector CR for the Count Connector to count spans by conditions
66+
[source,yaml]
67+
----
68+
# ...
69+
config: |
70+
connectors:
71+
count:
72+
spans: # <1>
73+
<custom_metric_name>: # <2>
74+
description: "<custom_metric_description>"
75+
conditions:
76+
- 'attributes["env"] == "dev"'
77+
- 'name == "devevent"'
78+
# ...
79+
----
80+
<1> In this example, the exposed metric counts spans with the specified conditions.
81+
<2> You can specify a custom metric name such as `cluster.prod.event.count`.
82+
+
83+
[TIP]
84+
====
85+
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.
86+
====
87+
88+
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.
89+
90+
.Example OpenTelemetry Collector CR for the Count Connector to count logs by attributes
91+
[source,yaml]
92+
----
93+
# ...
94+
config: |
95+
connectors:
96+
count:
97+
logs: # <1>
98+
<custom_metric_name>: # <2>
99+
description: "<custom_metric_description>"
100+
attributes:
101+
- key: env
102+
default_value: unknown # <3>
103+
# ...
104+
----
105+
<1> Specifies attributes for logs.
106+
<2> You can specify a custom metric name such as `my.log.count`.
107+
<3> Defines a default value when the attribute is not set.
108+
11109
[id="routing-connector_{context}"]
12110
== Routing Connector
13111

0 commit comments

Comments
 (0)