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

docs: Modify examples to show best practices - reuse tracer #2709

Merged

Conversation

cijothomas
Copy link
Member

One of many with the goal of showcasing best practices in all examples maintained in this repo.
This PR shows how to re-use Tracer instead of repeatedly obtaining it from provider/global which involve at-least one atomic check and an Arc clone internally.
A simple benchmark was added to show the impact of Tracer creation.

If the direction is agreed, we need to review every examples and make sure they show best practices for all signals.

@cijothomas cijothomas requested a review from a team as a code owner February 26, 2025 04:01
@cijothomas cijothomas changed the title Modify examples to show best practices - reuse tracer perf, docs - Modify examples to show best practices - reuse tracer Feb 26, 2025
@cijothomas cijothomas changed the title perf, docs - Modify examples to show best practices - reuse tracer perf docs - Modify examples to show best practices - reuse tracer Feb 26, 2025
@cijothomas cijothomas changed the title perf docs - Modify examples to show best practices - reuse tracer Modify examples to show best practices - reuse tracer Feb 26, 2025
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.3%. Comparing base (11ed8e0) to head (dd61331).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2709   +/-   ##
=====================================
  Coverage   79.3%   79.3%           
=====================================
  Files        123     123           
  Lines      22670   22670           
=====================================
  Hits       17986   17986           
  Misses      4684    4684           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cijothomas cijothomas changed the title Modify examples to show best practices - reuse tracer docs: Modify examples to show best practices - reuse tracer Feb 26, 2025
Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

Nice.

@cijothomas cijothomas merged commit edb0d58 into open-telemetry:main Feb 26, 2025
23 checks passed
@cijothomas cijothomas deleted the cijothomas/example-tracer-reuse branch February 26, 2025 20:08
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.

2 participants