Count Connector
contrib, k8s
Maintainers: @akats7
Source: opentelemetry-collector-contrib
Overview
Thecount connector can be used to count 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.Default Configuration
Thecount connector may be used without any configuration settings. The following table describes the
default behavior of the connector.
For example, in the following configuration the connector will count spans and span events from the
traces/in
pipeline and emit metrics called trace.span.count and trace.span.event.count onto the metrics/out pipeline.
Custom Counts
Optionally, emit custom counts by defining metrics under one or more of the following sections:spansspaneventsmetricsdatapointslogs
Conditions
Conditions may be specified for custom metrics. If specified, data that matches any one of the conditions will be counted. i.e. Conditions are ORed together.Attributes
spans, spanevents, datapoints, and logs may be counted according to attributes. In such cases, attribute precedence follows this order:
span(logRecord, DataPoint, profile) attributes > scope attributes > resource attributes.
If attributes are specified for custom metrics, a separate count will be generated for each unique
set of attribute values. Each count will be emitted as a data point on the same metric.
Optionally, include a default_value for an attribute, to count data that does not contain the attribute. The default_value value can be of type string, integer, or float.
Example Usage
Count spans and span events, only exporting the count metrics.env attribute.
Configuration
Example Configuration
Last generated: 2026-10-05