Class PrometheusExporter
- Namespace
- DotCompute.Core.Telemetry
- Assembly
- DotCompute.Core.dll
Production-grade Prometheus metrics exporter with real-time dashboard support and custom metric definitions. Provides comprehensive GPU compute metrics in Prometheus format for monitoring and alerting.
public sealed class PrometheusExporter : IDisposable
- Inheritance
-
PrometheusExporter
- Implements
- Inherited Members
- Extension Methods
Constructors
PrometheusExporter(ILogger<PrometheusExporter>, IOptions<PrometheusExporterOptions>, MetricsCollector)
Initializes a new instance of the PrometheusExporter class.
public PrometheusExporter(ILogger<PrometheusExporter> logger, IOptions<PrometheusExporterOptions> options, MetricsCollector metricsCollector)
Parameters
loggerILogger<PrometheusExporter>The logger.
optionsIOptions<PrometheusExporterOptions>The options.
metricsCollectorMetricsCollectorThe metrics collector.
Methods
Dispose()
Performs dispose.
public void Dispose()
ExportMetricsAsync(CancellationToken)
Exports current metrics in Prometheus text format.
public Task<string> ExportMetricsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token
Returns
ExportMetricsToFileAsync(string, CancellationToken)
Exports metrics to a file in Prometheus format.
public Task ExportMetricsToFileAsync(string filePath, CancellationToken cancellationToken = default)
Parameters
filePathstringPath to export file
cancellationTokenCancellationTokenCancellation token
Returns
GetMetricsStatistics()
Gets current metric statistics for monitoring.
public PrometheusMetricsStatistics GetMetricsStatistics()
Returns
- PrometheusMetricsStatistics
Metrics statistics
RecordDeviceMetrics(string, DevicePerformanceMetrics)
Records device health and utilization metrics.
public void RecordDeviceMetrics(string deviceId, DevicePerformanceMetrics metrics)
Parameters
deviceIdstringDevice identifier
metricsDevicePerformanceMetricsDevice performance metrics
RecordKernelCompilation(string, string, TimeSpan, bool)
Records kernel compilation events.
public void RecordKernelCompilation(string kernelName, string deviceId, TimeSpan compilationTime, bool success)
Parameters
kernelNamestringName of the compiled kernel
deviceIdstringTarget device
compilationTimeTimeSpanCompilation duration
successboolWhether compilation was successful
RecordKernelExecution(string, string, TimeSpan, KernelExecutionMetrics, bool)
Records kernel execution metrics in Prometheus format.
public void RecordKernelExecution(string kernelName, string deviceId, TimeSpan executionTime, KernelExecutionMetrics metrics, bool success)
Parameters
kernelNamestringName of the executed kernel
deviceIdstringDevice identifier
executionTimeTimeSpanKernel execution duration
metricsKernelExecutionMetricsDetailed execution metrics
successboolWhether the execution was successful
RecordMemoryOperation(string, string, long, TimeSpan, MemoryOperationMetrics, bool)
Records memory operation metrics in Prometheus format.
public void RecordMemoryOperation(string operationType, string deviceId, long bytes, TimeSpan duration, MemoryOperationMetrics metrics, bool success)
Parameters
operationTypestringType of memory operation
deviceIdstringDevice identifier
byteslongNumber of bytes transferred
durationTimeSpanTransfer duration
metricsMemoryOperationMetricsDetailed memory metrics
successboolWhether the operation was successful
RecordProfileMetrics(string, PerformanceProfile)
Records performance profiling metrics.
public void RecordProfileMetrics(string correlationId, PerformanceProfile profile)
Parameters
correlationIdstringProfile correlation ID
profilePerformanceProfilePerformance profile data