Skip to content

Commit f84cc18

Browse files
committed
Fix batch result
1 parent 8a1ea9a commit f84cc18

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docs/telemetry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following metrics are available:
2121
The following ingestion metrics with their corresponding dimensions are available:
2222

2323
- `sc.audit.ingestion.batch_duration_seconds` - Message batch processing duration in seconds
24-
- `result` - Indicates if the full batch size was used (batch size == max concurrency of the transport): `full` or `partial`
24+
- `result` - Indicates if the full batch size was used (batch size == max concurrency of the transport): `full`, `partial` or `failed`
2525
- `sc.audit.ingestion.message_duration_seconds` - Audit message processing duration in seconds
2626
- `message.category` - Indicates the category of the message ingested: `audit-message`, `saga-update` or `control-message`
2727
- `result` - Indicates the outcome of the operation: `success`, `failed` or `skipped` (if the message was filtered out and skipped)

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@ public record BatchMetrics(int MaxBatchSize, Histogram<double> BatchDuration, Ac
88
{
99
public void Dispose()
1010
{
11-
var tags = new TagList();
12-
1311
var isSuccess = actualBatchSize > 0;
1412

1513
IsSuccess(isSuccess);
1614

15+
string result;
16+
1717
if (isSuccess)
1818
{
19-
var result = actualBatchSize == MaxBatchSize ? "full" : "partial";
20-
tags.Add("result", result);
19+
result = actualBatchSize == MaxBatchSize ? "full" : "partial";
20+
}
21+
else
22+
{
23+
result = "failed";
2124
}
2225

23-
BatchDuration.Record(sw.Elapsed.TotalSeconds, tags);
26+
BatchDuration.Record(sw.Elapsed.TotalSeconds, new TagList { { "result", result } });
2427
}
2528

2629
public void Complete(int size) => actualBatchSize = size;

0 commit comments

Comments
 (0)