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
enabledbool
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
limitintMaximum 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
Returns
RecordError(string, string, Exception)
Records an error.
public void RecordError(string modelName, string version, Exception exception)
Parameters
RecordEvent(string, Dictionary<string, object>)
Records a telemetry event.
public void RecordEvent(string eventName, Dictionary<string, object> properties)
Parameters
eventNamestringpropertiesDictionary<string, object>
RecordInference(string, string, long, bool)
Records an inference execution.
public void RecordInference(string modelName, string version, long latencyMs, bool fromCache)