influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.89k stars 5.6k forks source link

[plugins/outputs/opentelemetry] Allow specifiying tags to be exported as resource attributes #13508

Open mx-psi opened 1 year ago

mx-psi commented 1 year ago

Use Case

The OTLP metrics data model distinguishes between resource attributes and datapoint attributes; the former being a class of attributes common to all telemetry signals in OTLP that specify the resource that generate telemetry. The Telegraf data model does not seem to have these concepts instead having just tags/fields used at the datapoint level, and the current situation is to (except when the tag name is a resource semantic convention) is to map all tags as datapoint attributes.

When an user is exporting in the OTLP format, a user currently has no way to specify which tags should mapped to resource attributes. This is something that is supported by OpenTelemetry SDKs and the OpenTelemetry Collector and is allowed by the specification (with some guidance here), but is not currently possible through Telegraf.

Expected behavior

A new option is added to the Telegraf output plugin to specify which tags should be mapped as resource attributes instead of datapoint attributes.

Actual behavior

No option is available and no workaround exists: currently, if a tag's name matches that of an OpenTelemetry resource-level semantic convention it will be mapped as a resource attribute, otherwise it will be mapped as a datapoint attribute.

Additional info

cc @jacobmarble since you are probably the person with the most context here :)

powersj commented 1 year ago

@jacobmarble thoughts on the feature request? Assigning to you for now to get a set of next steps or questions. Thanks!