Package ai.acolite.agentsdk.core.tracing
Class MultiTracingProcessor
java.lang.Object
ai.acolite.agentsdk.core.tracing.MultiTracingProcessor
- All Implemented Interfaces:
TraceProcessor,AutoCloseable
MultiTracingProcessor
Composite processor that delegates trace/span events to multiple processors. Allows combining multiple tracing backends (console, cloud, custom).
Thread-safe: Uses CopyOnWriteArrayList for processor list.
Example:
MultiTracingProcessor multi = new MultiTracingProcessor(); multi.addTraceProcessor(new ConsoleTraceProcessor()); multi.addTraceProcessor(new BatchTraceProcessor(...));Ported from TypeScript OpenAI Agents SDK Source: https://github.com/openai/openai-agents-js/blob/main/packages/agents-core/src/tracing/processor.ts
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTraceProcessor(TraceProcessor processor) Add a processor to the list.voidclear()Remove all processors.Flush all pending traces/spans.Get all registered processors (immutable copy).voidCalled when a span ends.voidonSpanStart(Span<?> span) Called when a span starts.voidonTraceEnd(Trace trace) Called when a trace ends.voidonTraceStart(Trace trace) Called when a trace starts.voidsetProcessors(List<TraceProcessor> newProcessors) Replace all processors with a new list.shutdown(long timeoutMs) Shutdown the processor gracefully.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.acolite.agentsdk.core.tracing.TraceProcessor
close, shutdown
-
Constructor Details
-
MultiTracingProcessor
public MultiTracingProcessor()
-
-
Method Details
-
addTraceProcessor
Add a processor to the list. Each processor will receive all trace/span events. -
setProcessors
Replace all processors with a new list. -
getProcessors
Get all registered processors (immutable copy). -
clear
public void clear()Remove all processors. -
onTraceStart
Description copied from interface:TraceProcessorCalled when a trace starts. Processors can export the trace immediately or buffer it.- Specified by:
onTraceStartin interfaceTraceProcessor
-
onTraceEnd
Description copied from interface:TraceProcessorCalled when a trace ends.- Specified by:
onTraceEndin interfaceTraceProcessor
-
onSpanStart
Description copied from interface:TraceProcessorCalled when a span starts.- Specified by:
onSpanStartin interfaceTraceProcessor
-
onSpanEnd
Description copied from interface:TraceProcessorCalled when a span ends. Most processors export spans on end to capture complete data.- Specified by:
onSpanEndin interfaceTraceProcessor
-
shutdown
Description copied from interface:TraceProcessorShutdown the processor gracefully. Flushes pending data and releases resources.- Specified by:
shutdownin interfaceTraceProcessor- Parameters:
timeoutMs- Maximum time to wait for shutdown (milliseconds)
-
forceFlush
Description copied from interface:TraceProcessorFlush all pending traces/spans. Blocks until all data is exported.- Specified by:
forceFlushin interfaceTraceProcessor
-