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

[SDK] Add tracer scope configurator #3137

Merged
merged 40 commits into from
Jan 30, 2025

Conversation

psx95
Copy link
Contributor

@psx95 psx95 commented Nov 12, 2024

Contributes to #2641

Adds scope configurator for Tracers.

Changes

  • Updates the Trace SDK to add support for TracerConfigurator as per the spec changes.
  • Adds a TracerConfig class that can be used to configure a tracer's behavior as per spec.

Some optional, good-to-have convenience functions were recommended by the spec to accommodate common use-cases - these have not been added in this PR.

See the TracerConfigurator spec for these recommendations. They should be added in a future PR.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copy link

netlify bot commented Nov 12, 2024

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit 9452789
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/6799af80ef3d910008f4e14c

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.91%. Comparing base (6603c3a) to head (9452789).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3137      +/-   ##
==========================================
+ Coverage   87.80%   87.91%   +0.12%     
==========================================
  Files         198      201       +3     
  Lines        6324     6385      +61     
==========================================
+ Hits         5552     5613      +61     
  Misses        772      772              
Files with missing lines Coverage Δ
...etry/sdk/instrumentationscope/scope_configurator.h 100.00% <100.00%> (ø)
sdk/include/opentelemetry/sdk/trace/tracer.h 100.00% <ø> (ø)
...dk/include/opentelemetry/sdk/trace/tracer_config.h 100.00% <100.00%> (ø)
...k/include/opentelemetry/sdk/trace/tracer_context.h 100.00% <ø> (ø)
sdk/src/trace/tracer.cc 83.61% <100.00%> (+1.16%) ⬆️
sdk/src/trace/tracer_config.cc 100.00% <100.00%> (ø)
sdk/src/trace/tracer_context.cc 84.00% <100.00%> (+2.19%) ⬆️
sdk/src/trace/tracer_provider.cc 89.59% <100.00%> (+0.23%) ⬆️
sdk/src/trace/tracer_provider_factory.cc 92.69% <100.00%> (+3.03%) ⬆️

@psx95 psx95 force-pushed the add-scope-config branch 11 times, most recently from dd70641 to 0370722 Compare November 16, 2024 17:26
@psx95 psx95 changed the title Add scope config [WIP] Add scope config Nov 16, 2024
@psx95 psx95 force-pushed the add-scope-config branch 2 times, most recently from b82ea68 to f6ff444 Compare November 16, 2024 17:54
@psx95 psx95 changed the title [WIP] Add scope config [WIP] Add tracer scope configurator Nov 16, 2024
@psx95 psx95 force-pushed the add-scope-config branch 10 times, most recently from 93950bf to c77065e Compare November 18, 2024 20:02
@psx95 psx95 changed the title [WIP] Add tracer scope configurator [SDK] Add tracer scope configurator Nov 18, 2024
@psx95 psx95 marked this pull request as ready for review November 18, 2024 21:09
Copy link
Member

@marcalff marcalff 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 patch, this is making good progress.

See another round comments on the code and tests.

fix dangling pointer warnings & valgrind memcheck warnings
@psx95
Copy link
Contributor Author

psx95 commented Jan 24, 2025

Hi @marcalff,
I have addressed all your comments, please take a look.

@psx95 psx95 requested a review from marcalff January 24, 2025 19:52
psx95 added 2 commits January 27, 2025 17:33
Update string_view -> string for use within the function scope to ensure scope lifetime.
Update push_back -> emplace_back to construct directly within the vector container. Added a constructor to the Condition struct to enable emplace_back.
Making builder's methods return reference type prevents unneeded copies
of the object.
@psx95
Copy link
Contributor Author

psx95 commented Jan 27, 2025

Hi @chusitoo,
Thanks for the review! I have addressed your comments.

Please take a look.

Copy link
Contributor

@chusitoo chusitoo left a comment

Choose a reason for hiding this comment

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

@psx95 thanks for the fixes. These changes look good to me 👍

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the feature.

"accept_third_attr", 3};

static instrumentation_scope::InstrumentationScope test_scope_1 =
*instrumentation_scope::InstrumentationScope::Create("test_scope_1");
Copy link
Member

Choose a reason for hiding this comment

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

It is weird to invoke Create() and then use the object behind the unique ptr, but given how InstrumentationScope does not expose public constructors, this is the best the test can do.

Approved as is then.

@marcalff marcalff merged commit 52a80b5 into open-telemetry:main Jan 30, 2025
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:please-review This PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants