Skip to content

Commit a9ed09c

Browse files
Apply suggestions from code review
Co-authored-by: Ramon Smits <[email protected]>
1 parent 72075b9 commit a9ed09c

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/ServiceControl.Audit/Auditing/Metrics/BatchMetrics.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ public void Dispose()
1212

1313
string result;
1414

15-
if (actualBatchSize <= 0)
16-
{
17-
result = "failed";
18-
IsSuccess(false);
19-
}
20-
else
21-
{
22-
result = actualBatchSize == MaxBatchSize ? "full" : "partial";
15+
var isSuccess = actualBatchSize > 0;
16+
17+
IsSuccess(isSuccess);
2318

24-
IsSuccess(true);
19+
if (isSuccess)
20+
{
21+
var result = actualBatchSize == MaxBatchSize ? "full" : "partial";
22+
tags.Add("result", result);
2523
}
26-
27-
tags.Add("result", result);
2824
BatchDuration.Record(sw.Elapsed.TotalSeconds, tags);
2925
}
3026

src/ServiceControl.Audit/Auditing/Metrics/IngestionMetrics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void RecordBatchOutcome(bool success)
5555
}
5656
}
5757

58-
static string CreateInstrumentName(string instrumentName) => $"sc.audit.ingestion.{instrumentName}".ToLower();
58+
static string CreateInstrumentName(string instrumentName) => $"sc.audit.ingestion.{instrumentName.ToLower()}";
5959

6060
long consecutiveBatchFailures;
6161

0 commit comments

Comments
 (0)