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

fix: Backport opentelemetry 0.18 code from main repo #9

Merged
merged 3 commits into from
May 22, 2023

Conversation

jaysonsantos
Copy link
Contributor

Motivation

I noticed that this repo got the cut-off before opentelemetry 0.18 was committed into the main repo so I tried to backport what was there.

Solution

This is pretty much a backport from the code that @jtescher did on the main repo.

Let me know if you see something wrong, I tried to adapt the rejections the best way possible.

This fix #8

@jaysonsantos jaysonsantos changed the title fix: Backport code from main repo fix: Backport opentelemetry 0.18 code from main repo Mar 25, 2023
This is pretty much a backport from the code that @jtescher did on the main repo

Signed-off-by: Jayson Reis <santosdosreis@gmail.com>
Copy link
Contributor Author

@jaysonsantos jaysonsantos left a comment

Choose a reason for hiding this comment

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

I just left comments on parts of the code that seems that the current version should stay, would you mind taking a look at them?

@@ -1104,7 +1119,7 @@ mod tests {
let subscriber = tracing_subscriber::registry().with(layer().with_tracer(tracer.clone()));

tracing::subscriber::with_default(subscriber, || {
tracing::debug_span!("request", otel.kind = %SpanKind::Server);
tracing::debug_span!("request", otel.kind = "server");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
tracing::debug_span!("request", otel.kind = "server");
tracing::debug_span!("request", otel.kind = %SpanKind::Server);

Copy link
Collaborator

Choose a reason for hiding this comment

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

The spec doesn't define a Display impl so this was removed in the opentelemetry crate as it pushes for a 1.0 release, so we have to provide our own conventions in this crate for now.

@@ -1154,7 +1178,7 @@ mod tests {
let _g = existing_cx.attach();

tracing::subscriber::with_default(subscriber, || {
tracing::debug_span!("request", otel.kind = %SpanKind::Server);
tracing::debug_span!("request", otel.kind = "server");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
tracing::debug_span!("request", otel.kind = "server");
tracing::debug_span!("request", otel.kind = %SpanKind::Server);


// Sample or defer to existing sampling decisions
let (flags, trace_state) = if let Some(result) = &builder.sampling_result {
process_sampling_result(result, parent_trace_flags)
} else if no_parent || remote_parent {
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should the previous branch stay?

Copy link
Collaborator

Choose a reason for hiding this comment

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

no this is right

@@ -95,12 +95,6 @@ impl PreSampledTracer for Tracer {
builder.sampling_result.as_ref().unwrap(),
parent_trace_flags,
)
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this also stay?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This changed as well

@djc
Copy link
Collaborator

djc commented Mar 27, 2023

Note that opentelemetry 0.19 has been released yesterday.

@jaysonsantos
Copy link
Contributor Author

@djc I've tested 0.19 with this PR, and it seems to work fine but, as this is a backport from another author, I didn't want to change the code in this PR as I don't “own” it

@davidbarsky
Copy link
Member

davidbarsky commented Mar 28, 2023

Thanks for doing this PR! Sorry for the delay in reviewing this. I'll get on it shortly.

I've tested 0.19 with this PR, and it seems to work fine but, as this is a backport from another author, I didn't want to change the code in this PR as I don't “own” it

I think that for clarity of commit history, we should make upgrading to opentelemetry 0.19 a separate PR.


// Sample or defer to existing sampling decisions
let (flags, trace_state) = if let Some(result) = &builder.sampling_result {
process_sampling_result(result, parent_trace_flags)
} else if no_parent || remote_parent {
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

no this is right

@@ -95,12 +95,6 @@ impl PreSampledTracer for Tracer {
builder.sampling_result.as_ref().unwrap(),
parent_trace_flags,
)
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This changed as well

@RenanSFreitas
Copy link

RenanSFreitas commented Apr 26, 2023

Hey,

Any chances this gets merged soon? I'd like to use some features present in opentelemetry 0.19.0 together with tracing-opentelemetry. Thank you all o/

@shaun-cox
Copy link
Contributor

@jaysonsantos, looks like examples/opentelemetry.rs needs to be updated as well to use opentelemetry_jaeger::new_agent_pipeline() instead of opentelemetry_jaeger::new_pipeline() in order to fix the above checks?

I'm eager to see this merged too (as well as the update for opentelemetry 0.19). If there is anything I can do to help, please let me know... Thanks for shepherding this!

Signed-off-by: Jayson Reis <santosdosreis@gmail.com>
@jaysonsantos jaysonsantos requested a review from jtescher May 3, 2023 17:17
@jaysonsantos
Copy link
Contributor Author

@davidbarsky @jtescher do you mind taking a look on the latest commit?

@Dzejkop
Copy link

Dzejkop commented May 17, 2023

@davidbarsky @jtescher do you know when you'll be able to take a look at this? I'm wondering if I should wait or use a temporary fork

@jtescher jtescher merged commit a5c27f6 into tokio-rs:v0.1.x May 22, 2023
@jtescher
Copy link
Collaborator

Thanks @jaysonsantos!

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.

Update opentelemetry to 0.18
7 participants