Class MetalProductionLogger
- Namespace
- DotCompute.Backends.Metal.Telemetry
- Assembly
- DotCompute.Backends.Metal.dll
Production-grade structured logging with correlation IDs and enterprise integration
public sealed class MetalProductionLogger : IDisposable
- Inheritance
-
MetalProductionLogger
- Implements
- Inherited Members
- Extension Methods
Constructors
MetalProductionLogger(ILogger<MetalProductionLogger>, MetalLoggingOptions)
public MetalProductionLogger(ILogger<MetalProductionLogger> logger, MetalLoggingOptions options)
Parameters
loggerILogger<MetalProductionLogger>optionsMetalLoggingOptions
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
EndContext(LogContext, bool, Dictionary<string, object>?)
Ends a logging context
public void EndContext(LogContext context, bool success = true, Dictionary<string, object>? additionalProperties = null)
Parameters
contextLogContextsuccessbooladditionalPropertiesDictionary<string, object>
GenerateCorrelationId()
Generates a new correlation ID for tracking related operations
public static string GenerateCorrelationId()
Returns
LogDeviceUtilization(Dictionary<string, object>, string?)
Logs device utilization metrics
public void LogDeviceUtilization(Dictionary<string, object> utilizationMetrics, string? correlationId = null)
Parameters
utilizationMetricsDictionary<string, object>correlationIdstring
LogError(string, MetalError, string, Dictionary<string, object>?)
Logs error with comprehensive context
public void LogError(string correlationId, MetalError error, string context, Dictionary<string, object>? additionalContext = null)
Parameters
correlationIdstringerrorMetalErrorcontextstringadditionalContextDictionary<string, object>
LogKernelExecution(string, string, TimeSpan, long, bool, Dictionary<string, object>?)
Logs kernel execution with comprehensive metrics
public void LogKernelExecution(string correlationId, string kernelName, TimeSpan duration, long dataSize, bool success, Dictionary<string, object>? additionalProperties = null)
Parameters
correlationIdstringkernelNamestringdurationTimeSpandataSizelongsuccessbooladditionalPropertiesDictionary<string, object>
LogMemoryAllocation(long, TimeSpan, bool, string?)
Logs memory allocation with structured data
public void LogMemoryAllocation(long sizeBytes, TimeSpan duration, bool success, string? correlationId = null)
Parameters
LogMemoryPressure(MemoryPressureLevel, double, string?)
Logs memory pressure events
public void LogMemoryPressure(MemoryPressureLevel level, double percentage, string? correlationId = null)
Parameters
levelMemoryPressureLevelpercentagedoublecorrelationIdstring
LogResourceUsage(ResourceType, long, long, long, double, string?)
Logs resource usage metrics
public void LogResourceUsage(ResourceType type, long currentUsage, long peakUsage, long limit, double utilizationPercentage, string? correlationId = null)
Parameters
typeResourceTypecurrentUsagelongpeakUsagelonglimitlongutilizationPercentagedoublecorrelationIdstring
PerformCleanup(DateTimeOffset)
Performs cleanup of old log contexts
public void PerformCleanup(DateTimeOffset cutoffTime)
Parameters
cutoffTimeDateTimeOffset
StartContext(string, string?)
Starts a new logging context with correlation ID
public LogContext StartContext(string operationType, string? correlationId = null)