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
Copy file name to clipboardExpand all lines: gdi/opentelemetry/components/sum-connector.rst
+169-2
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,174 @@ Sum connector
7
7
.. meta::
8
8
:description: Sums attribute values from spans, span events, metrics, data points, and log records.
9
9
10
-
The Splunk Distribution of the OpenTelemetry Collector supports the Sum connector. Documentation is planned for a future release.
10
+
The Splunk Distribution of the OpenTelemetry Collector uses the Sum connector to sum attribute values from spans, span events, metrics, data points, and log records.
11
+
12
+
As a receiver, the supported pipeline types are ``metrics``, ``traces`` and ``logs``. As an exporter, the supported pipeline type is ``metrics``. See :ref:`otel-data-processing` for more information.
13
+
14
+
.. note:: Values found within an attribute are converted into a float regardless of their original type before being summed and output as a metric value. Non-convertible strings are dropped and not included.
15
+
16
+
Get started
17
+
======================
18
+
19
+
Follow these steps to configure and activate the component:
20
+
21
+
1. Deploy the Splunk Distribution of the OpenTelemetry Collector to your host or container platform:
22
+
23
+
- :ref:`otel-install-linux`
24
+
- :ref:`otel-install-windows`
25
+
- :ref:`otel-install-k8s`
26
+
27
+
2. Configure the connector as described in the next section.
28
+
3. Restart the Collector.
29
+
30
+
Sample configuration
31
+
--------------------------------------------
32
+
33
+
To activate the connector, add ``sum`` to the ``connectors`` section of your configuration file.
34
+
35
+
For example:
36
+
37
+
.. code-block:: yaml
38
+
39
+
connectors:
40
+
sum:
41
+
42
+
To complete the configuration, add the connector in the ``service`` section of your configuration file according to the pipelines you want to use, for example:
43
+
44
+
.. code-block:: yaml
45
+
46
+
service:
47
+
pipelines:
48
+
metrics/sum:
49
+
receivers: [sum]
50
+
traces:
51
+
exporters: [sum]
52
+
53
+
Configuration options
54
+
----------------------------------
55
+
56
+
The following settings are required:
57
+
58
+
* Telemetry type. Nested below the ``sum:`` connector declaration. Can be any of ``spans`` or ``spanevents`` for ``traces``, ``datapoints`` for ``metrics``, or ``logs``.
59
+
60
+
* In :ref:`sum-connector-example-sum`, it's declared as ``spans``.
61
+
62
+
* Metric name. Nested below the telemetry type; this is the metric name the sum connector will output summed values to.
63
+
64
+
* In :ref:`sum-connector-example-sum`, it's declared as ``my.example.metric.name``.
65
+
66
+
* ``source_attribute``. A specific attribute to search for within the source telemetry being fed to the connector. This attribute is where the connector looks for numerical values to sum into the output metric value.
67
+
68
+
* In :ref:`sum-connector-example-sum`, it's declared as ``attribute.with.numerical.value``.
69
+
70
+
The following settings can be optionally configured:
71
+
72
+
* ``conditions``. You can use OTTL syntax to provide conditions for processing incoming telemetry. Conditions are ORed together, so if any condition is met the attribute's value is included in the resulting sum. For more information see :new-page:`OTTL grammar <https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/LANGUAGE.md>` in GitHub.
73
+
74
+
* ``attributes``. Declaration of attributes to include. Any of these attributes found will generate a separate sum for each set of unique combination of attribute values and output as its own datapoint in the metric time series.
75
+
76
+
* ``key``. Required for ``attributes``. The attribute name to match against.
77
+
78
+
* ``default_value``. Optional for ``attributes``. A default value for the attribute when no matches are found. The ``default_value`` value can be a string, integer, or float.
79
+
80
+
.. _sum-connector-example-sum:
81
+
82
+
Configuration example: Sum attribute values
83
+
--------------------------------------------
84
+
85
+
This example configuration sums numerical values found within the attribute ``attribute.with.numerical.value`` of any span telemetry routed to the connector and outputs a metric time series with the name ``my.example.metric.name`` with those summed values.
86
+
87
+
.. code-block:: yaml
88
+
89
+
receivers:
90
+
foo:
91
+
connectors:
92
+
sum:
93
+
spans:
94
+
my.example.metric.name:
95
+
source_attribute: attribute.with.numerical.value
96
+
97
+
exporters:
98
+
bar:
99
+
100
+
service:
101
+
pipelines:
102
+
metrics/sum:
103
+
receivers: [sum]
104
+
exporters: [bar]
105
+
traces:
106
+
receivers: [foo]
107
+
exporters: [sum]
108
+
109
+
Configuration example: Check payment logs
110
+
--------------------------------------------
111
+
112
+
In this example the Sum connector ingests logs and creates an output metric named ``checkout.total`` with numerical values found in the ``source_attribute`` ``total.payment``. It also checks any incoming log telemetry for values present in the attribute ``payment.processor`` and creates a datapoint within the metric time series for each unique value.
113
+
114
+
It also makes sure that:
115
+
116
+
* The attribute ``total.payment`` is not ``NULL``.
117
+
* Any logs without values in ``payment.processor`` are included in a datapoint with the ``default_value`` of ``unspecified_processor``.
118
+
119
+
.. code-block:: yaml
120
+
121
+
receivers:
122
+
foo:
123
+
connectors:
124
+
sum:
125
+
logs:
126
+
checkout.total:
127
+
source_attribute: total.payment
128
+
conditions:
129
+
- attributes["total.payment"] != "NULL"
130
+
attributes:
131
+
- key: payment.processor
132
+
default_value: unspecified_processor
133
+
exporters:
134
+
bar:
135
+
136
+
service:
137
+
pipelines:
138
+
metrics/sum:
139
+
receivers: [sum]
140
+
exporters: [bar]
141
+
logs:
142
+
receivers: [foo]
143
+
exporters: [sum]
144
+
145
+
Logs to metrics
146
+
--------------------------------------------
147
+
148
+
For log-to-metrics connection, if your logs contain all values in their body rather than in attributes, use a :ref:`transform-processor` in your pipeline to upsert parsed key/value pairs into attributes attached to the log.
To find information about this component in the meantime, see :new-page:`Sum connector <https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/connector/sumconnector>` on GitHub.
0 commit comments