How can I capture external (off-process) telemetries in my otel span?

2 hours ago 1
ARTICLE AD BOX

I am developing a framework for running LLM-based agents, and I am collecting telemetry from my framework via otel. I have a central function where the agent functionality is being intercepted step by step:

def run(agent): run_span = otel_tracer.start_span('run-span') while agent.working(): agent_span = otel_tracer.start_span('agent-span') agent.run_step() # agent emits otel telemetries here agent_span.end() run_span.end()

As it stands now, I am able to emit telemetries from the agent via my collector. The issue is that the telemetries are part of their own trace and aren't being associated with the agent_span. (Right now the agent happens to use litellm which is emitting via litellm.callbacks=['otel'])

I need to be completely agnostic to the agent implementation other than it upholding a very basic interface, including the potential for the agent to run in a separate process. Still, I would like to capture its potential otel emissions correctly within my defined span hierarchy. How should this be done?

Read Entire Article