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

Update gettracer #1854

Merged
merged 8 commits into from
May 20, 2021
Merged

Update gettracer #1854

merged 8 commits into from
May 20, 2021

Conversation

eddyleelin
Copy link
Contributor

@eddyleelin eddyleelin commented May 15, 2021

Description

Specification change #1654 requires invalid names to be converted to an empty string, as described in the tracer specification below. Passing None or the empty string "" as the name parameter to trace.get_tracer(name, version) will now return a tracer with an empty string for tracer.instrumentation_info.name. Full details available in the Trace API specifications.

Fixes #1849

How Has This Been Tested?

  • The test_invalid_instrumentation_info unit test has been updated to expect an empty string output of get_tracer for the given invalid inputs, and the tox -e test-core-sdk tests passed.

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been updated

Hooray for my first PR!

@eddyleelin eddyleelin requested review from a team, codeboten and ocelotl and removed request for a team May 15, 2021 01:51
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 15, 2021

CLA Signed

The committers are authorized under a signed CLA.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, nice work! Please update the changelog and i'll approve.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
@@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1809])(https://github.com/open-telemetry/opentelemetry-python/pull/1809)
- Fixed sequence values in OTLP exporter not translating
([#1818](https://github.com/open-telemetry/opentelemetry-python/pull/1818))
- Update get_tracer to return an empty string when passed an invalid name
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be added to the "Unreleased" section of the changelog

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just did it. Thanks!

self.assertEqual(
tracer1.instrumentation_info, tracer2.instrumentation_info
)

Copy link
Contributor

Choose a reason for hiding this comment

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

any reason for this test to be moved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believed that having the more granular tests for the individual tracer would provide more information upon failing; then, this test just makes sure that the two tracers created are identical, which is asserted after each individual attribute is checked. I'm not sure if that's good practice, though, so I'd appreciate the feedback!

@codeboten
Copy link
Contributor

Code looks good, please update the branch so we can merge it.

@codeboten
Copy link
Contributor

@eddyleelin please fix the linting issues.

@eddyleelin
Copy link
Contributor Author

Thanks so much to everyone for the patience, support, and helpful feedback! I really appreciate this community!! @codeboten @owais @lzchen

@codeboten codeboten merged commit 7e1f247 into open-telemetry:main May 20, 2021
@eddyleelin eddyleelin deleted the update-gettracer branch May 21, 2021 16:01
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.

Get Tracer operation should use an empty string if the specified name is null
4 participants