I'm looking for an example of Instrumentation with a custom Span. I'd like to create a custom span instance with a few properties and then enter that span at a specific point in our RAG pipeline, where I can assign values to those properties, and then exit it while updating some properties. I've read
https://docs.llamaindex.ai/en/stable/module_guides/observability/instrumentation and looked at the linked notebooks, but it's unclear to me how we're meant to have our specific custom span used at a specific point in time. For example, when calling
dispatcher.span_enter(...)
, I do not understand what values I'm meant to provide for
id_
or
bounded_args
and I'm only guessing that
instance
is meant to be the instance of the span I want to use. Futhermore, I can't clearly see how my custom span is the one used when I use the
@dispatcher.span
decorator. I have placed breakpoints inside the
new_span
,
prepare_to_exit_span
, and
prepare_to_drop_span
functions inside my custom span but it doesn't look like they are called. An example would be helpful. Thanks.