emit telemetry on exception path and include durationMs in failure emits
This commit is contained in:
@@ -91,6 +91,7 @@ public class PrinterQueue
|
|||||||
("printer", PrinterIp),
|
("printer", PrinterIp),
|
||||||
("receiptType", job.Document?.ReceiptType.ToString()),
|
("receiptType", job.Document?.ReceiptType.ToString()),
|
||||||
("retry", job.RetryCount.ToString()),
|
("retry", job.RetryCount.ToString()),
|
||||||
|
("durationMs", stopwatch.ElapsedMilliseconds.ToString()),
|
||||||
("error", result.ErrorType.ToString())));
|
("error", result.ErrorType.ToString())));
|
||||||
|
|
||||||
if (result.ErrorType == PrintErrorType.ConversionError)
|
if (result.ErrorType == PrintErrorType.ConversionError)
|
||||||
@@ -128,8 +129,15 @@ public class PrinterQueue
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
stopwatch.Stop();
|
||||||
_logger.LogError(ex, "Error processing job");
|
_logger.LogError(ex, "Error processing job");
|
||||||
await _statusReporter.ReportStatusAsync(job, PrintJobStatus.Failed);
|
await _statusReporter.ReportStatusAsync(job, PrintJobStatus.Failed);
|
||||||
|
SafeEmit(InsinEventKinds.MapErrorTypeToKind(PrintErrorType.Other), InsinMessageFormatter.Format(
|
||||||
|
("printer", PrinterIp),
|
||||||
|
("receiptType", job.Document?.ReceiptType.ToString()),
|
||||||
|
("retry", job.RetryCount.ToString()),
|
||||||
|
("durationMs", stopwatch.ElapsedMilliseconds.ToString()),
|
||||||
|
("error", ex.GetType().Name)));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user