Skip to content

Commit 7ca64d8

Browse files
committed
Add exponential histogram buckets for test duration metrics
Implements histogram buckets following a 1-3-10 exponential pattern: [0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100] seconds
1 parent e2e0e74 commit 7ca64d8

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/metrics-generator.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ describe('generateMetrics', () => {
125125
)
126126

127127
expect(testDuration?.buckets).toEqual([
128-
0.1, 0.5, 1, 5, 10, 30, 60, 120, 300, 600
128+
0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100
129129
])
130130
expect(suiteDuration?.buckets).toEqual([
131-
0.1, 0.5, 1, 5, 10, 30, 60, 120, 300, 600
131+
0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100
132132
])
133133
})
134134

src/metrics-generator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const generateSuiteMetrics = (
5454
attributes: suiteAttributes,
5555
description: 'Test suite execution time (from XML time attribute)',
5656
unit: 's',
57-
buckets: [0.1, 0.5, 1, 5, 10, 30, 60, 120, 300, 600]
57+
buckets: [0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100]
5858
})
5959

6060
metrics.push({
@@ -64,7 +64,7 @@ const generateSuiteMetrics = (
6464
attributes: suiteAttributes,
6565
description: 'Test suite cumulative time (calculated from child elements)',
6666
unit: 's',
67-
buckets: [0.1, 0.5, 1, 5, 10, 30, 60, 120, 300, 600]
67+
buckets: [0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100]
6868
})
6969

7070
const statusCounts = [
@@ -124,7 +124,7 @@ const generateTestCaseMetrics = (
124124
attributes: testAttributes,
125125
description: 'Individual test execution time',
126126
unit: 's',
127-
buckets: [0.1, 0.5, 1, 5, 10, 30, 60, 120, 300, 600]
127+
buckets: [0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30, 100]
128128
})
129129

130130
metrics.push({

0 commit comments

Comments
 (0)