Accessing Immediate Context for Manual Spans in OpenTelemetry
I think it’s more of a question about OpenTelemetry than Phoenix, but I’m still not sure how to wire a manual span with auto-instrumented span. I want to access the immediate context so that my manual span can be shown as a child of an auto-instrumented span. For example, in the picture, there’s TransformChain just above a LLMChain and what happens inside of it is actually retrieval but it’s not auto-instrumented and thus not captured. But when I attempt to grab the immediate context from my custom retriever via get_current() I only get {} What will be an proper way to access the immediate context so that I can set correct parent for my manual span? The end result I expect is the second picture which I photoshopped.
from opentelemetry.context import get_current
def do_retrieval():
current_context = get_current()
print("current_context", current_context) # prints 'current_context {}'