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

Unify builders across signals #2220

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

stormshield-fabs
Copy link
Contributor

@stormshield-fabs stormshield-fabs commented Oct 18, 2024

Fixes #1527 #2164

Changes

The consensus reached during the SIG meeting is that we'd like to unify the builder APIs across signals, limit duplication and keep our traits object-safe. Proposed changed :

  • remove the Logger and Tracer builders that were only used to wrap the InstrumentationLibrary builder
  • remove the deprecated versioned_ methods on providers
  • reduce the public API to Provider::signal(name: &str) and Provider::library_signal(library: Arc<InstrumentationLibrary>)

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 78.52349% with 32 lines in your changes missing coverage. Please review.

Project coverage is 79.2%. Comparing base (ea4b5e4) to head (a6bd2db).

Files with missing lines Patch % Lines
opentelemetry-zipkin/src/exporter/mod.rs 0.0% 10 Missing ⚠️
opentelemetry-stdout/src/trace/exporter.rs 0.0% 4 Missing ⚠️
opentelemetry/src/global/trace.rs 57.1% 3 Missing ⚠️
opentelemetry-proto/src/transform/trace.rs 60.0% 2 Missing ⚠️
opentelemetry-sdk/src/logs/log_emitter.rs 83.3% 2 Missing ⚠️
opentelemetry-sdk/src/logs/log_processor.rs 88.2% 2 Missing ⚠️
opentelemetry-sdk/src/trace/tracer.rs 66.6% 2 Missing ⚠️
opentelemetry/src/global/metrics.rs 0.0% 2 Missing ⚠️
opentelemetry-proto/src/transform/common.rs 50.0% 1 Missing ⚠️
opentelemetry-proto/src/transform/logs.rs 66.6% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2220     +/-   ##
=======================================
+ Coverage   79.1%   79.2%   +0.1%     
=======================================
  Files        121     121             
  Lines      21082   20849    -233     
=======================================
- Hits       16680   16522    -158     
+ Misses      4402    4327     -75     

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

@stormshield-fabs
Copy link
Contributor Author

There were some concerns about having Arc in the library_signal APIs, but someone also mentioned we want to avoid unnecessary copies. We could hide the Arc inside the InstrumentationLibrary if needed.

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Left few comments but looks good overall.
Please check the comments and see if they make sense.

opentelemetry-otlp/examples/basic-otlp/src/main.rs Outdated Show resolved Hide resolved
opentelemetry-otlp/examples/basic-otlp/src/main.rs Outdated Show resolved Hide resolved
opentelemetry-stdout/examples/basic.rs Outdated Show resolved Hide resolved
opentelemetry/src/global/metrics.rs Outdated Show resolved Hide resolved
@cijothomas
Copy link
Member

There were some concerns about having Arc in the library_signal APIs, but someone also mentioned we want to avoid unnecessary copies. We could hide the Arc inside the InstrumentationLibrary if needed.

yes I suggest to hide Arc inside.

opentelemetry/src/common.rs Outdated Show resolved Hide resolved
opentelemetry/src/common.rs Outdated Show resolved Hide resolved
@cijothomas
Copy link
Member

@stormshield-fabs Thanks a lot! I think the following are to be addressed before merge. We also need to write a migration guide in the PR description showing before/after, so users can easily (relatively) react to this.

Lets keep InstrumentationScope simple, and accept the perf cost now, given it is infrequent operation.
#2220 (comment)

Rename library-signal to something like signal_with_scope/better names.
#2220 (comment)

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.

Instrumentation scope - move to builder pattern?
4 participants