Skip to content

Commit 5f25b40

Browse files
committed
S3UTILS-207: Fix scuba metrics string concatenation bug
Parse objectsTotal and bytesTotal as integers before aggregation. These values are read as strings from metadata, causing JavaScript's + operator to concatenate instead of add.
1 parent 805a6e9 commit 5f25b40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

service-level-sidecar/report.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ async function getMetricsForBucket(sessionIds, timestamp, bucket, log) {
7373
return logResults
7474
.filter(result => result !== null)
7575
.reduce((acc, result) => ({
76-
count: acc.count + result.value.metrics.objectsTotal,
77-
bytes: acc.bytes + result.value.metrics.bytesTotal,
76+
count: acc.count + parseInt(result.value.metrics.objectsTotal, 10),
77+
bytes: acc.bytes + parseInt(result.value.metrics.bytesTotal, 10),
7878
}), { count: 0, bytes: 0 });
7979
}
8080
return warp10.getMetricsForBucket(timestamp, bucket.name, log);

0 commit comments

Comments
 (0)