Sum Connector
contrib
Maintainers: @greatestusername, @shalper2, @crobert-1
Source: opentelemetry-collector-contrib
Overview
Thesum connector can be used to sum attribute values from spans, span events, metrics, data points, and log records.
Configuration
If you are not already familiar with connectors, you may find it helpful to first visit the Connectors README.Basic configuration
This example configuration will sum numerical values found within the attributeattribute.with.numerical.value of any span telemetry routed to the connector. It will then output a metric time series with the name my.example.metric.name with those summed values.
Note: Values found within an attribute will be converted into a float regardless of their original type before being summed and output as a metric value. Non-convertible strings will be dropped and not included.
Required Settings
The sum connector has three required configuration settings and numerous optional settings- Telemetry type: Nested below the
sum:connector declaration. Declared asspans:in the Basic Example.- Can be any of
spans,spanevents,datapoints, orlogs. - For metrics use
datapoints - For traces use
spansorspanevents
- Can be any of
- Metric name: Nested below the telemetry type; this is the metric name the sum connector will output summed values to. Declared as
my.example.metric.namein the Basic Example source_attribute: A specific attribute to search for within the source telemetry being fed to the connector. This attribute is where the connector will look for numerical values to sum into the output metric value. Declared asattribute.with.numerical.valuein the Basic Example
Optional Settings
conditions: OTTL syntax can be used to provide conditions for processing incoming telemetry. Conditions are ORed together, so if any condition is met the attribute’s value will be included in the resulting sum.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.key: (required forattributes) the attribute name to match againstdefault_value: (optional forattributes) a default value for the attribute when no matches are found. Thedefault_valuevalue can be of type string, integer, or float.
Detailed Example Configuration
This example declares that thesum connector is going to be ingesting logs and creating an output metric named checkout.total with numerical values found in the source_attribute total.payment.
It provides a condition to check that the attribute total.payment is not NULL. 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. Any logs without values in payment.processor will be included in a datapoint with the default_value of unspecified_processor.
body rather than in attributes (E.G. JSON payload) use a transform processor in your pipeline to upsert parsed key/value pairs (in this case from JSON) into attributes attached to the log.
Configuration
Example Configuration
Last generated: 2026-04-13