opentelemetry-collector-contrib
opentelemetry-collector-contrib copied to clipboard
[prometheusremotewriteexporter] don't add target info when it would only contain job and instance
Description:
The intention of the check for no resource attributes was to only produce the target_info metric when it provides meaningful additional attributes. However, we currently (without this change) will still emit the metric when target_info only has job and instance labels, which are already present on all other metrics. This change moves the check to after we filter out those attributes so we don't produce a useless metric.
Link to tracking Issue:
Addresses https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/12724#issuecomment-1197269139
Testing:
Added a unit test
cc @jmacd