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

Trace module exports #255

Merged
merged 3 commits into from
Oct 6, 2020
Merged

Conversation

awiede
Copy link

@awiede awiede commented Oct 6, 2020

Resolves #254 Resolves #249

  • Moves trace exports from api and sdk to api::trace and sdk::trace
  • Removes metrics from the default features

Flatten trace exports under the trace sub module.
@awiede awiede requested a review from a team October 6, 2020 17:44
@@ -32,22 +32,3 @@ pub use context::propagation::{
text_propagator::TextMapFormat, Extractor, Injector,
};
pub use context::Context;

Copy link
Author

Choose a reason for hiding this comment

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

So baggage and context are feature flagged to trace but not under the trace module. Is there a strong opinion about whether these should be reorganized under the trace mod?

Copy link
Member

Choose a reason for hiding this comment

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

Probably makes sense to keep the directory structure in line with https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/library-layout.md#api-package, but if features aren't used outside of trace then feature gating with trace probably makes sense. I think context is used by metrics though, so it should probably not be.

Copy link
Author

Choose a reason for hiding this comment

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

Ok - I'll leave baggage and context alone.

Clean up api/trace exports to be flattened under api/trace instead of
just api.
benches/trace.rs Outdated
@@ -64,13 +67,13 @@ fn criterion_benchmark(c: &mut Criterion) {
});
}

fn trace_benchmark_group<F: Fn(&sdk::Tracer)>(c: &mut Criterion, name: &str, f: F) {
fn trace_benchmark_group<F: Fn(&sdk::trace::Tracer)>(c: &mut Criterion, name: &str, f: F) {
Copy link
Member

Choose a reason for hiding this comment

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

These are kinda unergonomic now with the double module prefix, but not sure how to avoid that as they share names with the traits. Any ideas here? or is this the best we can do currently.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like go uses the equivalent of:

use opentelemetry::sdk::trace as sdktrace;
// ...
let tracer: sdktrace::Tracer;

// or
 
use opentelemetry::sdk::trace::Tracer as SdkTracer;
// ...
let tracer: SdkTracer;

Alternatively we could have a convention like our examples always import api::Tracer as _ and Tracer is always in reference to sdk, or vice versa.

Copy link
Author

Choose a reason for hiding this comment

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

I mean, we could pub use it in src/sdk/mod.rs, but then we go back to the inconsistency. It's weird, but if we flatten this into sdk, then do we do the same for any type that is prefixed with Trace*? And then we're back where we started. 🤷

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I think example aliases are probably good for now.

Copy link
Author

Choose a reason for hiding this comment

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

@jtescher updated examples, doc tests and tracing bench to use the alias.

Copy link
Member

Choose a reason for hiding this comment

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

Ok cool, the aliases are not breaking changes so looks good to me even if we want to experiment here

Alias sdk::trace and api::trace in examples and doc tests.
@jtescher jtescher merged commit b76e3fd into open-telemetry:master Oct 6, 2020
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.

Move trace exports to api/trace and sdk/trace level Remove metrics feature from default list
2 participants