Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using resource attributes as tags in the dimensions #156

Closed
pedro-stanaka opened this issue Aug 16, 2023 · 4 comments
Closed

Using resource attributes as tags in the dimensions #156

pedro-stanaka opened this issue Aug 16, 2023 · 4 comments

Comments

@pedro-stanaka
Copy link

Summary

The metric translator has the option to use ResourceAttributesAsTags, but it is not using that option at all when converting metrics. Is that expected?

If it is a bug, would you be open to a PR?

@ringerc
Copy link

ringerc commented Dec 10, 2023

Where does this actually take effect?

I've traced resource_attributes_as_tags from the DD exporter code:

https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/50794afa6b2898515cdab0df2da976716f95e0dd/exporter/datadogexporter/config.go#L239

https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/50794afa6b2898515cdab0df2da976716f95e0dd/exporter/datadogexporter/metrics_exporter.go#L68

to this repo, where it's set as:

func WithResourceAttributesAsTags() TranslatorOption {

That sets

t.ResourceAttributesAsTags = true

t.ResourceAttributesAsTags on the translatorConfig struct. But this does not appear to be referenced anywhere.

So how does it have any effect?

@ringerc
Copy link

ringerc commented Dec 10, 2023

It looks like the work is really done by https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/resourcetotelemetry via factory.go in https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/50794afa6b2898515cdab0df2da976716f95e0dd/exporter/datadogexporter/factory.go#L297

so the code in this repo for ResourceAttributesAsTags is probably legacy/meaningless/unfinished.

@ringerc
Copy link

ringerc commented Dec 11, 2023

Datadog does have docs on these mappings, albeit outdated and incomplete:

They aren't easily found though, they're only linked in a "see also" down the bottom of a few of the other otel exporter articles. They're not linked in any of the tagging docs like:

so it's hard to figure out how the datadog exporter for the opentelemetry collector maps the attribute service.name to the datadog service tag, the cloud.availability_zone attribute to zone (not for some reason availability-zone), etc.

There is a mapping in this repo at https://github.com/DataDog/opentelemetry-mapping-go/tree/main/pkg/otlp/attributes/attributes.go ; it has a bunch of mappings not covered in the above docs, but that's where it's done.

@songy23
Copy link
Member

songy23 commented Dec 18, 2023

The particular config is removed in #219.

@songy23 songy23 closed this as completed Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants