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

[pkg/otlp/attributes] Handle literal 'host' tag #65

Merged
merged 1 commit into from
May 4, 2023
Merged

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented May 4, 2023

What does this PR do?

Handle literal 'host' attribute when determining the host tag value.

Motivation

Not doing so causes two host tags/attributes to be present on all signal types under certain conditions.

@mx-psi mx-psi marked this pull request as ready for review May 4, 2023 10:59
@mx-psi mx-psi requested a review from a team as a code owner May 4, 2023 10:59
@mx-psi mx-psi requested a review from songy23 May 4, 2023 10:59
Comment on lines -51 to +64
// 1. a custom Datadog hostname provided by the "datadog.host.name" attribute
// 1. the "host" attribute to avoid double tagging if present.
//
// 2. cloud provider specific hostname for AWS, Azure or GCP,
// 2. a custom Datadog hostname provided by the "datadog.host.name" attribute
//
// 3. the Kubernetes node name (and cluster name if available),
// 3. cloud provider specific hostname for AWS, Azure or GCP,
//
// 4. the cloud provider host ID and
// 4. the Kubernetes node name (and cluster name if available),
//
// 5. the host.name attribute.
// 5. the cloud provider host ID and
//
// 6. the host.name attribute.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is just adding the top line and bumping the numbers on the rest of items, but the resulting diff is not very readable

@@ -29,6 +29,9 @@ const (
AttributeDatadogHostname = "datadog.host.name"
// AttributeK8sNodeName the datadog k8s node name attribute
AttributeK8sNodeName = "k8s.node.name"
// Attribute host is a literal host tag.
// We check for this to avoid double tagging.
AttributeHost = "host"
Copy link
Member

Choose a reason for hiding this comment

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

IMO it is very confusing that we treat host, host.name and datadog.host.name in subtly different order. This has led to several customer issues.

(Not suggesting to fix it in this PR, but something that needs better documentation)

Copy link
Member Author

Choose a reason for hiding this comment

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

That's fair, I think some subtlety is required here but maybe we can do better. For this PR, I am convinced that host needs to go first, since otherwise you get double tagging in some cases, so I will merge, but we should discuss how to improve the situation for the rest.

@mx-psi mx-psi merged commit a80b7a7 into main May 4, 2023
@mx-psi mx-psi deleted the mx-psi/literal-host branch May 4, 2023 15:41
codeboten pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request May 5, 2023
…o v0.2.0 (#21507)

Bump DataDog/opentelemetry-mapping-go to v0.2.0, to include DataDog/opentelemetry-mapping-go#65 in the next release.
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

Successfully merging this pull request may close these issues.

None yet

3 participants