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/trace/api: normalize span name before remapping for OTLP #12176

Conversation

dragon3
Copy link

@dragon3 dragon3 commented May 27, 2022

What does this PR do?

This pull request adds span name normalization before remapping for OTLP.

Motivation

While trying open-telemetry/opentelemetry-collector-contrib#9693 I found that it will change the span_name_remappings's behavior.

For example, if we have the following setting in otel-collector config:

...
      span_name_remappings: 
        go.opentelemetry.io_contrib_instrumentation_net_http_otelhttp.client: http.client

...

and if the OpenTelemetry library is go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp, the current datadogexporter can properly remap the name to http.client.

However, if we use pkg/trace in datadogexporter (open-telemetry/opentelemetry-collector-contrib#9693), it doesn't remap because of missing the normalization.

I think span_name_remappings's behavior should be compatible after the change (open-telemetry/opentelemetry-collector-contrib#9693)

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Reviewer's Checklist

  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • Use the major_change label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.
  • A release note has been added or the changelog/no-changelog label has been applied.
  • Changed code has automated tests for its functionality.
  • Adequate QA/testing plan information is provided if the qa/skip-qa label is not applied.
  • At least one team/.. label has been applied, indicating the team(s) that should QA this change.
  • If applicable, docs team has been notified or an issue has been opened on the documentation repo.
  • If applicable, the need-change/operator and need-change/helm labels have been applied.
  • If applicable, the config template has been updated.

@bits-bot
Copy link
Collaborator

bits-bot commented May 27, 2022

CLA assistant check
All committers have signed the CLA.

@dragon3 dragon3 marked this pull request as ready for review May 27, 2022 04:21
@dragon3 dragon3 requested a review from a team as a code owner May 27, 2022 04:21
Copy link
Contributor

@apigirl apigirl left a comment

Choose a reason for hiding this comment

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

just a little nit and then looks good for docs

…ng-15fa7e8767cea706.yaml

Co-authored-by: Kaylyn <kaylyn.sigler@datadoghq.com>
@dragon3
Copy link
Author

dragon3 commented May 28, 2022

just a little nit and then looks good for docs

Thank you for reviewing the release note. I've applied your suggestion (2b6e573)

@@ -509,6 +509,13 @@ func (o *OTLPReceiver) convertSpan(rattr map[string]string, lib pcommon.Instrume
name = "opentelemetry." + name
}
}

normalized, err := traceutil.NormalizeName(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not convinced by this change. The remapping feature should remap the OpenTelemetry name to a new Datadog name, which gets normalised later on, if it has to. Doing this here will just create confusion and potential issues later on.

In my opinion, the current behaviour is better and the span name remappings should refer to the actual OpenTelemetry name, and not a Datadog normalized version of it.

Copy link
Author

Choose a reason for hiding this comment

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

@gbbr
Thank you for reviewing and the comment.

I got your point and yes, you're right.
Even though I created this pull request for the compatibility, I also think the current behavior is ideal.

So I'm happy to close this pull request, however it would be great if you mention the breaking change on the remapping feature and update the span_name_remappings example on in open-telemetry/opentelemetry-collector-contrib#9693

Thank you!

Copy link
Contributor

@gbbr gbbr May 31, 2022

Choose a reason for hiding this comment

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

Copy link
Author

@dragon3 dragon3 Jun 1, 2022

Choose a reason for hiding this comment

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

Thank you for adding to CHANGELOG.

If possible, I think it's better to update the example here as well:
https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/9693/files#diff-8c91465b7f1defd1410e697b702a817163bc88cee637ace3f202bb7f83321cb6

      #   go.opentelemetry.io_contrib_instrumentation_net_http_otelhttp.client: http.client

I'm closing this pull request.
Thank you!

@dragon3 dragon3 closed this Jun 1, 2022
@dragon3 dragon3 deleted the fix/pkg/trace/api/otlp/normalize-span-name-before-remapping branch June 1, 2022 00:56
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.

4 participants