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

Upgrade to tracing-subscriber 0.3 #13

Merged
merged 1 commit into from
Dec 14, 2021
Merged

Upgrade to tracing-subscriber 0.3 #13

merged 1 commit into from
Dec 14, 2021

Conversation

bertof
Copy link
Contributor

@bertof bertof commented Dec 7, 2021

Updated the library to use the newer tracing-subscriber traits.
Changed the least amount of code possible and tested checking for regression.
Bumped the library version as the interfaces have changed.

@hlb8122
Copy link
Collaborator

hlb8122 commented Dec 7, 2021

Thanks very much. Aiming for a release sometime this week. Will make sure to include this.

@bertof
Copy link
Contributor Author

bertof commented Dec 7, 2021

You're welcome! Thank you for this library, it's really easy to use.

Cargo.toml Outdated Show resolved Hide resolved
}

spans
let span = ctx.current_span().id().and_then(|id| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I did a little jiggle around before 0.6. Do you mind rebasing against lastest master, this should work

            let span = ctx.current_span().id().and_then(|id| {
                ctx.span_scope(id).map(|scope| {
                    scope.from_root().fold(String::new(), |mut spans, span| {
                        // Add span fields to the base object
                        if let Some(span_object) = span.extensions().get::<HashMap<Cow<'static, str>, Value>>() {
                            object.extend(span_object.clone());
                        }
                        if spans != String::new() {
                            spans = format!("{}:{}", spans, span.name());
                        } else {
                            spans = span.name().to_string();
                        }

                        spans
                    })
                })
            });

            if let Some(span) = span {
                object.insert("_span".into(), span.into());
            }

Updated the library to use the newer tracing-subscriber traits.
Changed the least amount of code possible and tested checking for regression.
Bumped the library version as the interfaces have changed.
@bertof
Copy link
Contributor Author

bertof commented Dec 13, 2021

I've updated my PR.

@hlb8122
Copy link
Collaborator

hlb8122 commented Dec 13, 2021

@bertof Thanks

@hlb8122 hlb8122 merged commit 4737817 into hlbarber:master Dec 14, 2021
@hlb8122
Copy link
Collaborator

hlb8122 commented Dec 14, 2021

@bertof Released in 0.6 👍

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.

2 participants