Hi, I'm currently using a global trace provider to instrument my llama-index application (image). Is there a way of instead of using global instrumentation, do targeted instrumentation? example: I have 2 separate llama-index workflows, but I want only one to send spans to phoenix.
To achieve targeted instrumentation for specific workflows in your LlamaIndex application, you can use the OpenInferenceTraceCallbackHandler to instrument only the parts you want. Instead of setting a global handler, attach handlers to specific workflows. This allows you to selectively send spans to Phoenix for only the desired workflows.Here's a basic example of how you might set this up: ```from openinference.instrumentation.llama_index._callback import OpenInferenceTraceCallbackHandler# Initialize the handler for the specific workflow
handler = OpenInferenceTraceCallbackHandler()# Attach the handler to the specific workflow you want to instrument
workflow_1.attach_handler(handler)# Do not attach the handler to the other workflow
馃挕聽Hint: Mention RunLLM in the thread for followups.
I don鈥檛 think this is possible right now, but it鈥檚 something we can investigate. Would you mind opening an enhancement request to provide some details for us to track?
Leaving this here for future slack searchers. There's a way of accomplish this today. https://github.com/Arize-ai/phoenix/issues/5293#issuecomment-2467460740 Thanks Roger Y.
