Skip to content

Conversation

oliviaBahr
Copy link

I find myself often wanting to interact with spans created by the instrument decorator.

I've done two implementations: one adding an optional param to the decorator, the other using a context var on the logfire instance.
I prefer the context var impl because the usage is nicer but I'm not sure about the overhead.

Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@alexmojaki
Copy link
Contributor

  1. A function called logfire.current_span() can't just work for instrument, it at least needs to work for logfire.span, it should probably return something useful for all OTel spans. We've wanted to implement a function like this, with this name, for a while but haven't had time. It would wrap arbitrary spans while allowing things like setting complex attributes.
  2. This absolutely can't depend on whether logfire.current_span appears somewhere in the body of the decorated function.

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