-
Notifications
You must be signed in to change notification settings - Fork 431
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
base: main
Are you sure you want to change the base?
Unify builders across signals #2220
Conversation
3cdff17
to
8b09a51
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2220 +/- ##
=======================================
+ Coverage 79.3% 79.4% +0.1%
=======================================
Files 121 121
Lines 20944 20773 -171
=======================================
- Hits 16612 16499 -113
+ Misses 4332 4274 -58 ☔ View full report in Codecov by Sentry. |
There were some concerns about having |
@@ -170,11 +170,10 @@ where | |||
L: Logger + Send + Sync, | |||
{ | |||
pub fn new(provider: &P) -> Self { | |||
let library = | |||
Arc::new(InstrumentationLibrary::builder("opentelemetry-log-appender").build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep the with_version as before.
let library = Arc::new( | ||
InstrumentationLibrary::builder("basic") | ||
.with_version("1.0") | ||
.with_attributes(common_scope_attributes.clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.with_attributes(common_scope_attributes.clone()) | |
.with_attributes(common_scope_attributes) |
8b09a51
to
fc0d3c0
Compare
There was a problem hiding this 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.
let library = Arc::new( | ||
InstrumentationLibrary::builder("basic") | ||
.with_version("1.0") | ||
.with_attributes(common_scope_attributes.clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.with_attributes(common_scope_attributes.clone()) | |
.with_attributes(common_scope_attributes) |
); | ||
let tracer = global::tracer_provider().library_tracer(library.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering why tracing is done slightly differently than metric?
.with_schema_url("schema_url") | ||
.with_attributes([KeyValue::new("scope_key", "scope_value")]) | ||
.build(); | ||
let library = Arc::new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a useability standpoint, I think its best to not require Arc here. Cloning InstrumentationLibrary should be cheap anyway.
/// Some("https://opentelemetry.io/schemas/1.2.0"), | ||
/// Some(vec![KeyValue::new("key", "value")]), | ||
/// let library = Arc::new( | ||
/// InstrumentationLibrary::builder("io.opentelemetry") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename InstrumentationLibrary to InstrumentationScope everywhere, as Scope is what user provides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. InstrumentationScope
also matches the term used in proto file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for InstrumentationScope
, that's what is in Log data model too - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-instrumentationscope
yes I suggest to hide Arc inside. |
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 :
Logger
andTracer
builders that were only used to wrap theInstrumentationLibrary
builderversioned_
methods on providersProvider::signal(name: &str)
andProvider::library_signal(library: Arc<InstrumentationLibrary>)
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes