Table of Contents

Class TelemetryCollector

Namespace
AiDotNet.Deployment.Runtime
Assembly
AiDotNet.dll

Collects telemetry data for deployed models.

public class TelemetryCollector
Inheritance
TelemetryCollector
Inherited Members

Constructors

TelemetryCollector(bool)

public TelemetryCollector(bool enabled = true)

Parameters

enabled bool

Methods

Clear()

Clears all telemetry data. Note: While ConcurrentBag.Clear() is thread-safe in .NET 5+, it may lose events added concurrently during clear.

public void Clear()

GetEvents(int)

Gets the most recent recorded events ordered by timestamp descending.

public List<TelemetryEvent> GetEvents(int limit = 100)

Parameters

limit int

Maximum number of events to return (default: 100)

Returns

List<TelemetryEvent>

List of telemetry events ordered from most recent to oldest

GetStatistics(string, string?)

Gets statistics for a model. Note: This method reads from metrics that may be concurrently updated. Results provide a snapshot view.

public ModelStatistics GetStatistics(string modelName, string? version = null)

Parameters

modelName string
version string

Returns

ModelStatistics

RecordError(string, string, Exception)

Records an error.

public void RecordError(string modelName, string version, Exception exception)

Parameters

modelName string
version string
exception Exception

RecordEvent(string, Dictionary<string, object>)

Records a telemetry event.

public void RecordEvent(string eventName, Dictionary<string, object> properties)

Parameters

eventName string
properties Dictionary<string, object>

RecordInference(string, string, long, bool)

Records an inference execution.

public void RecordInference(string modelName, string version, long latencyMs, bool fromCache)

Parameters

modelName string
version string
latencyMs long
fromCache bool