Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ThomWright
Copy link
Contributor

@ThomWright ThomWright commented Oct 6, 2025

Fixes #444

This way, we don't keep the application's connect span alive for the lifetime of the connection, but we do keep the same log level.

@Keruspe
Copy link
Collaborator

Keruspe commented Oct 6, 2025

Thanks for looking into it!
Could you split the typo fix in a separate commit?

@ThomWright
Copy link
Contributor Author

Ha, yes sorry 🙈

@ThomWright
Copy link
Contributor Author

Done!

@ThomWright
Copy link
Contributor Author

Also, is there any chance we could get this backported to 2.x and/or 3.x?

tracing::span!(Level::TRACE, "io_loop")
};
span.follows_from(&connect_span);
span
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe all of this could be replaced with something like

let span_level = connect_span.metadata().map_or(Level::TRACE, |metadata| metadata.level());
tracing::span!(parent: connect_span, span_level, "io_loop")

Also, if you target the lapin-2.x branch instead, I'll cut a release for it, then merge in newer branch and cut 3.x and 4.x releases

Copy link
Contributor Author

@ThomWright ThomWright Oct 8, 2025

Choose a reason for hiding this comment

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

A few things:

  1. Span level – This can't be dynamic, otherwise yeah that approach would be better! You get this error:

    attempt to use a non-constant value in a constant non-constant value

    Which has serious "how much wood would a woodchuck chuck..." vibes.

    Yeah, this is a kind of annoying limitation of tracing.

  2. Relationship with connect span – I decided not to set the connect span as the parent. See the docs from tracing:

    In addition to having zero or one parent, a span may also follow from any number of other spans. This indicates a causal relationship between the span and the spans that it follows from, but a follower is not typically considered part of the duration of the span it follows.

    Which seems to match what we're trying to represent here.

  3. Branch target – Grand, I can change that 👍

@ThomWright ThomWright changed the base branch from main to lapin-2.x October 8, 2025 13:15
@ThomWright
Copy link
Contributor Author

Oh good lord changing the target in GitHub did horrible things. Let me fix that 😅

So it doesn't keep the current span alive for the lifetime of the
connection.
@Keruspe Keruspe merged commit d316bb0 into amqp-rs:lapin-2.x Oct 12, 2025
3 of 8 checks passed
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.

Span captured by IO loop

2 participants