Hi,
I'm trying to use the new Instrumentation module, but having difficulty adding a
@dispatcher.span
decorator to a generator function since the span ends as soon as a value is yielded.
I started to implement my custom span without the decorator, as shown in the module guide here
https://docs.llamaindex.ai/en/stable/module_guides/observability/instrumentation/#enteringexiting-a-spanbut looking at the source code, it seems some extra logic was added to the decorator for handling threads, and I'm not sure if I need to rewrite those locks in my code
https://github.com/run-llama/llama_index/blob/baa3e82e56a647d0281135c8c279fa1c386e8f6c/llama-index-core/llama_index/core/instrumentation/dispatcher.py#L261-L265It would be nice if LlamaIndex had a context manager for creating spans or if the decorator worked with generator functions.