open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.71k stars 2.14k forks source link

32669 wireframe sum connector #33759

Open greatestusername opened 3 days ago

greatestusername commented 3 days ago

Description: Initial wireframe PR for a new sum connector (as described in #32669) Provides bare minimum to start developing a new connector (config, factory, integration test stubs for connector lifecycle, etc)

Sum Connector takes in logs, metrics, or traces and matches an attribute then allows summing numerical values present in that attribute and sending those sums as a time series metric along with any attributes defined within the connector config.

E.G. Log contains a field for total_price of a payment. Matching on total_price as the source_attribute will take numerical values from this attributte and emit a time series metric (checkout.total) of the sums along with any other attributes defined in the connector config.

Example config:

receivers:
  foo:
connectors:
  sum:
    logs:
      checkout.total:
        source_attribute: 
          - attributes["total_price"]
        conditions:
          - attributes["total_price"] != "NULL"
        attributes:
          - key: payment.processor
            default_value: unspecified_processor
          - key: env
            default_value: no_env
exporters:
  bar:

service:
  pipelines:
    metrics/sum:
       receivers: [sum]
       exporters: [bar]
    logs:
       receivers: [foo]
       exporters: [sum]

Link to tracking Issue: 32669

Testing: Generated component and package tests

Documentation: README and issue #32669 provide current documentation of projected future state.