Skip to content

ChatCompletionCollectorHolder

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Diagnostics

ChatCompletionCollectorHolder Class

DI-registered singleton that holds the IChatCompletionCollector instance. The diagnostics middleware sets the real collector during factory construction; consumers resolve this to access it. Unlike a static holder, each DI container has its own instance, making it testable and thread-safe across containers.

public sealed class ChatCompletionCollectorHolder : NexusLabs.Needlr.AgentFramework.Diagnostics.IChatCompletionCollector

Inheritance System.Object 🡒 ChatCompletionCollectorHolder

Implements IChatCompletionCollector

Methods

ChatCompletionCollectorHolder.DrainCompletions() Method

Drains all captured completions since the last drain. Thread-safe. Returns an empty list if no completions have been recorded.

public System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.AgentFramework.Diagnostics.ChatCompletionDiagnostics> DrainCompletions();

Implements DrainCompletions()

Returns

System.Collections.Generic.IReadOnlyList<ChatCompletionDiagnostics>