GenAIMainAgentSpanProcessor class
Propagates microsoft.gen_ai.main_agent.* attributes onto spans.
onStart: copies main-agent attributes from the parent span (or falls back to the parent'sgen_ai.agent.*/gen_ai.conversation.idattributes) onto the new span.onEnd: when the span is itself aninvoke_agentoperation and has not already been enriched, copies its owngen_ai.agent.*/gen_ai.conversation.idattributes ontomicrosoft.gen_ai.main_agent.*so the top-level agent identifies itself as the main agent.
Methods
| force |
Flushes pending work. No-op for this processor. |
| on |
When a span is itself a top-level |
| on |
Copies main-agent attributes from the parent span (or its |
| shutdown() | Shuts down the processor. No-op for this processor. |
Method Details
forceFlush()
Flushes pending work. No-op for this processor.
function forceFlush(): Promise<void>
Returns
Promise<void>
onEnd(ReadableSpan)
When a span is itself a top-level invoke_agent operation that has not
already been enriched, copies its gen_ai.agent.* / gen_ai.conversation.id
attributes onto the microsoft.gen_ai.main_agent.* keys.
function onEnd(span: ReadableSpan)
Parameters
- span
-
ReadableSpan
The span that has ended.
onStart(Span, Context)
Copies main-agent attributes from the parent span (or its gen_ai.agent.*
fallbacks) onto a span when it starts.
function onStart(span: Span, parentContext: Context)
Parameters
- span
-
Span
The span that is starting.
- parentContext
-
Context
The context containing the parent span, if any.
shutdown()
Shuts down the processor. No-op for this processor.
function shutdown(): Promise<void>
Returns
Promise<void>