From b4ea22f022415fdee9d5c11a4c49ed02107238e7 Mon Sep 17 00:00:00 2001 From: Abdullah Islam <31964511+abdullah248@users.noreply.github.com> Date: Wed, 5 Jan 2022 15:15:24 -0600 Subject: [PATCH] cleanup dicom cast logging to match dicom service (#1258) --- .../Features/Worker/ChangeFeedProcessor.cs | 8 +++---- .../Features/Storage/TableExceptionStore.cs | 24 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/converter/dicom-cast/src/Microsoft.Health.DicomCast.Core/Features/Worker/ChangeFeedProcessor.cs b/converter/dicom-cast/src/Microsoft.Health.DicomCast.Core/Features/Worker/ChangeFeedProcessor.cs index 49a80feefe..0a2516f95a 100644 --- a/converter/dicom-cast/src/Microsoft.Health.DicomCast.Core/Features/Worker/ChangeFeedProcessor.cs +++ b/converter/dicom-cast/src/Microsoft.Health.DicomCast.Core/Features/Worker/ChangeFeedProcessor.cs @@ -92,9 +92,9 @@ public async Task ProcessAsync(TimeSpan pollIntervalDuringCatchup, CancellationT { if (ex is FhirNonRetryableException || ex is DicomTagException || ex is TimeoutRejectedException) { - string studyUid = changeFeedEntry.StudyInstanceUid; - string seriesUid = changeFeedEntry.SeriesInstanceUid; - string instanceUid = changeFeedEntry.SopInstanceUid; + string studyInstanceUid = changeFeedEntry.StudyInstanceUid; + string seriesInstanceUid = changeFeedEntry.SeriesInstanceUid; + string sopInstanceUid = changeFeedEntry.SopInstanceUid; long changeFeedSequence = changeFeedEntry.Sequence; ErrorType errorType = ErrorType.FhirError; @@ -114,7 +114,7 @@ await _exceptionStore.WriteExceptionAsync( errorType, cancellationToken); - _logger.LogError("Failed to process DICOM event with SequenceID: {SequenceId}, StudyUid: {StudyUid}, SeriesUid: {SeriesUid}, instanceUid: {InstanceUid} and will not be retried further. Continuing to next event.", changeFeedEntry.Sequence, studyUid, seriesUid, instanceUid); + _logger.LogError("Failed to process DICOM event with SequenceID: {SequenceId}, StudyUid: {StudyInstanceUid}, SeriesUid: {SeriesInstanceUid}, instanceUid: {SopInstanceUid} and will not be retried further. Continuing to next event.", changeFeedEntry.Sequence, studyInstanceUid, seriesInstanceUid, sopInstanceUid); } else { diff --git a/converter/dicom-cast/src/Microsoft.Health.DicomCast.TableStorage/Features/Storage/TableExceptionStore.cs b/converter/dicom-cast/src/Microsoft.Health.DicomCast.TableStorage/Features/Storage/TableExceptionStore.cs index fee657b24a..5583e0e0d8 100644 --- a/converter/dicom-cast/src/Microsoft.Health.DicomCast.TableStorage/Features/Storage/TableExceptionStore.cs +++ b/converter/dicom-cast/src/Microsoft.Health.DicomCast.TableStorage/Features/Storage/TableExceptionStore.cs @@ -54,22 +54,22 @@ public async Task WriteExceptionAsync(ChangeFeedEntry changeFeedEntry, Exception } DicomDataset dataset = changeFeedEntry.Metadata; - string studyUid = dataset.GetSingleValue(DicomTag.StudyInstanceUID); - string seriesUid = dataset.GetSingleValue(DicomTag.SeriesInstanceUID); - string instanceUid = dataset.GetSingleValue(DicomTag.SOPInstanceUID); + string studyInstanceUid = dataset.GetSingleValue(DicomTag.StudyInstanceUID); + string seriesInstanceUid = dataset.GetSingleValue(DicomTag.SeriesInstanceUID); + string sopInstanceUid = dataset.GetSingleValue(DicomTag.SOPInstanceUID); long changeFeedSequence = changeFeedEntry.Sequence; var tableClient = _tableServiceClient.GetTableClient(tableName); - var entity = new IntransientEntity(studyUid, seriesUid, instanceUid, changeFeedSequence, exceptionToStore); + var entity = new IntransientEntity(studyInstanceUid, seriesInstanceUid, sopInstanceUid, changeFeedSequence, exceptionToStore); try { await tableClient.UpsertEntityAsync(entity, cancellationToken: cancellationToken); - _logger.LogInformation("Error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyUID}, SeriesUID: {SeriesUID}, InstanceUID: {InstanceUID}. Stored into table: {Table} in table storage.", changeFeedSequence, studyUid, seriesUid, instanceUid, tableName); + _logger.LogInformation("Error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyInstanceUid}, SeriesUID: {SeriesInstanceUid}, InstanceUID: {SopInstanceUid}. Stored into table: {Table} in table storage.", changeFeedSequence, studyInstanceUid, seriesInstanceUid, sopInstanceUid, tableName); } catch { - _logger.LogInformation("Error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyUID}, SeriesUID: {SeriesUID}, InstanceUID: {InstanceUID}. Failed to store to table storage.", changeFeedSequence, studyUid, seriesUid, instanceUid); + _logger.LogInformation("Error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyInstanceUid}, SeriesUID: {SeriesInstanceUid}, InstanceUID: {SopInstanceUid}. Failed to store to table storage.", changeFeedSequence, studyInstanceUid, seriesInstanceUid, sopInstanceUid); throw; } } @@ -80,22 +80,22 @@ public async Task WriteRetryableExceptionAsync(ChangeFeedEntry changeFeedEntry, EnsureArg.IsNotNull(changeFeedEntry, nameof(changeFeedEntry)); DicomDataset dataset = changeFeedEntry.Metadata; - string studyUid = dataset.GetSingleValue(DicomTag.StudyInstanceUID); - string seriesUid = dataset.GetSingleValue(DicomTag.SeriesInstanceUID); - string instanceUid = dataset.GetSingleValue(DicomTag.SOPInstanceUID); + string studyInstanceUid = dataset.GetSingleValue(DicomTag.StudyInstanceUID); + string seriesInstanceUid = dataset.GetSingleValue(DicomTag.SeriesInstanceUID); + string sopInstanceUid = dataset.GetSingleValue(DicomTag.SOPInstanceUID); long changeFeedSequence = changeFeedEntry.Sequence; var tableClient = _tableServiceClient.GetTableClient(Constants.TransientRetryTableName); - var entity = new RetryableEntity(studyUid, seriesUid, instanceUid, changeFeedSequence, retryNum, exceptionToStore); + var entity = new RetryableEntity(studyInstanceUid, seriesInstanceUid, sopInstanceUid, changeFeedSequence, retryNum, exceptionToStore); try { await tableClient.UpsertEntityAsync(entity, cancellationToken: cancellationToken); - _logger.LogInformation("Retryable error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyUID}, SeriesUID: {SeriesUID}, InstanceUID: {InstanceUID}. Tried {RetryNum} time(s). Waiting {Milliseconds} milliseconds . Stored into table: {Table} in table storage.", changeFeedSequence, studyUid, seriesUid, instanceUid, retryNum, nextDelayTimeSpan.TotalMilliseconds, Constants.TransientRetryTableName); + _logger.LogInformation("Retryable error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyInstanceUid}, SeriesUID: {SeriesInstanceUid}, InstanceUID: {SopInstanceUid}. Tried {RetryNum} time(s). Waiting {Milliseconds} milliseconds . Stored into table: {Table} in table storage.", changeFeedSequence, studyInstanceUid, seriesInstanceUid, sopInstanceUid, retryNum, nextDelayTimeSpan.TotalMilliseconds, Constants.TransientRetryTableName); } catch { - _logger.LogInformation("Retryable error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyUID}, SeriesUID: {SeriesUID}, InstanceUID: {InstanceUID}. Tried {RetryNum} time(s). Failed to store to table storage.", changeFeedSequence, studyUid, seriesUid, instanceUid, retryNum); + _logger.LogInformation("Retryable error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyInstanceUid}, SeriesUID: {SeriesInstanceUid}, InstanceUID: {SopInstanceUid}. Tried {RetryNum} time(s). Failed to store to table storage.", changeFeedSequence, studyInstanceUid, seriesInstanceUid, sopInstanceUid, retryNum); throw; } }