Table of Contents

Interface IProfilerExporter

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Sink for batches of trace records drained by the profiler consumer thread. Implementations receive batches on their own dedicated thread (one OS thread per attached exporter, owned by TyphonProfiler) and write them to a file, TCP socket, OTLP collector, in-memory list, etc.

public interface IProfilerExporter : IDisposable
Inherited Members

Remarks

Lifecycle:

  1. TyphonProfiler.AttachExporter(this) registers the exporter — does NOT start its thread yet.
  2. TyphonProfiler.Start() calls Initialize(ProfilerSessionMetadata) with session metadata, then spawns the dedicated exporter thread that iterates Queue's blocking enumerator.
  3. The exporter thread receives batches via Queue and calls ProcessBatch(TraceRecordBatch) for each. After processing, the thread calls batch.Release() to decrement the refcount and return the batch to the pool.
  4. TyphonProfiler.Stop() calls Queue.CompleteAdding so the exporter thread's foreach loop exits after draining what's already queued, then calls Flush() + Dispose().

Threading contract: Initialize(ProfilerSessionMetadata) runs on the caller of TyphonProfiler.Start before any batches arrive. ProcessBatch(TraceRecordBatch) and Flush() are called from the dedicated exporter thread only — implementations don't need internal synchronization on per-exporter state.

Properties

Name

Human-readable name for diagnostics and resource-tree display.

string Name { get; }

Property Value

string

Queue

The bounded handoff queue this exporter consumes from. Created by the implementation in its constructor.

ExporterQueue Queue { get; }

Property Value

ExporterQueue

Methods

Flush()

Called once at shutdown after the queue is drained. Flushes any pending state.

void Flush()

Initialize(ProfilerSessionMetadata)

Called once at session start, before any ProcessBatch(TraceRecordBatch) calls. Use it to write headers, open files, accept clients, etc.

void Initialize(ProfilerSessionMetadata metadata)

Parameters

metadata ProfilerSessionMetadata

ProcessBatch(TraceRecordBatch)

Process one batch of raw trace records. Called from the dedicated exporter thread. The exporter reads Payload and Offsets but must NOT call batch.Release() — the caller owns that.

void ProcessBatch(TraceRecordBatch batch)

Parameters

batch TraceRecordBatch