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

[chore]: datadog receiver: Tags translation #33922

Merged

Conversation

jesusvazquez
Copy link
Contributor

@jesusvazquez jesusvazquez commented Jul 4, 2024

Description:
This PR is a follow up to the former #33631 extending the existing tags translation structure. This will be required for the follow up PRs adding support for v1 and v2 series endpoints, service checks, as well as sketches.

The full version of the code can be found in the cedwards/datadog-metrics-receiver-full branch, or in Grafana Alloy: https://github.com/grafana/alloy/tree/main/internal/etc/datadogreceiver

Link to tracking Issue:
#18278

Testing:
Unit tests have been added. More thorough tests will be included in follow-up PRs as the remaining functionality is added.

Notes:

@jesusvazquez jesusvazquez requested a review from a team July 4, 2024 15:01
@jesusvazquez jesusvazquez changed the title datadog receiver: Tags translation [chore]: datadog receiver: Tags translation Jul 4, 2024
@jesusvazquez jesusvazquez force-pushed the jvp/datadog-receiver-tags-translation branch 2 times, most recently from ff93214 to 37f9b03 Compare July 4, 2024 15:21
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
@jesusvazquez jesusvazquez force-pushed the jvp/datadog-receiver-tags-translation branch from 37f9b03 to e114373 Compare July 4, 2024 15:25
receiver/datadogreceiver/tags.go Outdated Show resolved Hide resolved
receiver/datadogreceiver/tags_test.go Outdated Show resolved Hide resolved
// to only support key:value pairs.
// The following is a workaround to map unnamed inputTags to key:value pairs and its subject to future
// changes if OTel supports unnamed inputTags in the future or if there is a better way to do this.
key = fmt.Sprintf("unnamed_%s", tag)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this common practice elsewhere as well? As a user that tagged something with "foo", I'd probably expect to see it translated to foo=foo or foo=true, or even just "foo=" (empty value).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem doing that is that perhaps there was already a label name called foo?

Because we don't know in advance, I thought about prefixing the label with something that is not common, such as unnamed_.

I particularly don't make use of unnamed tags so I wonder what would be the best approach here too. We can always change it when some users try it out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with changing it later is that we'd break users who start depending on the behavior introduced on this PR here. I don't have a good solution for the moment, and I think it would be OK to add a note to the readme stating that it currently is "unnamed_" and might change later, and that the appropriate solution is to perhaps be more explicit (foo:foo, foo:, :foo, foo:true).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change to the readme can be done on a subsequent PR. I'm merging this.

@jpkrohling jpkrohling merged commit 6f2e20d into open-telemetry:main Jul 8, 2024
154 checks passed
@github-actions github-actions bot added this to the next release milestone Jul 8, 2024
jpkrohling pushed a commit that referenced this pull request Jul 17, 2024
**Description:**
This PR adds support for V1 series, as well as batches the metrics by
resource, scope, and datapoint attributes. The batching code will also
be required for future PRs which will add support for v2 series
endpoints, service checks, and sketches.

Follow up of #33631 and #33922.

The full version of the code can be found in the
`cedwards/datadog-metrics-receiver-full` branch, or in Grafana Alloy:
https://github.com/grafana/alloy/tree/main/internal/etc/datadogreceiver

**Link to tracking Issue:** 
#18278 

**Testing:** 
Unit tests, as well as an end-to-end test, have been added.

---------

Co-authored-by: Federico Torres <federico.sa.torres@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants