Skip to content

Commit 2299ad1

Browse files
authored
rewrite metrics CW to leverage dimensions and be compatible with meta infra (#999)
1 parent e32b496 commit 2299ad1

File tree

2 files changed

+483
-154
lines changed

2 files changed

+483
-154
lines changed

terraform-aws-github-runner/modules/runners/lambdas/runners/src/scale-runners/metrics.test.ts

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,48 @@ describe('./metrics', () => {
4444
m.runRepo({ owner: 'o', repo: 'r' });
4545
m.runRepo({ owner: 'o', repo: 'r' });
4646
m.runRepo({ owner: 'o', repo: 'r' });
47+
m.runRepo({ owner: 'o', repo: 'r1' });
48+
m.runRepo({ owner: 'o', repo: 'r1' });
4749
await m.sendMetrics();
4850

4951
expect(mockCloudWatch.putMetricData).toBeCalledWith({
5052
MetricData: [
5153
{
5254
Counts: [1],
53-
MetricName: 'run.o.r.process',
55+
Dimensions: [
56+
{
57+
Name: 'Owner',
58+
Value: 'o',
59+
},
60+
{
61+
Name: 'Repo',
62+
Value: 'r',
63+
},
64+
],
65+
MetricName: 'run.process',
5466
Timestamp: spyDate.mock.instances[0],
5567
Unit: 'Count',
5668
Values: [3],
5769
},
70+
{
71+
Counts: [1],
72+
Dimensions: [
73+
{
74+
Name: 'Owner',
75+
Value: 'o',
76+
},
77+
{
78+
Name: 'Repo',
79+
Value: 'r1',
80+
},
81+
],
82+
MetricName: 'run.process',
83+
Timestamp: spyDate.mock.instances[0],
84+
Unit: 'Count',
85+
Values: [2],
86+
},
5887
],
59-
Namespace: 'environ-scaleUp',
88+
Namespace: 'environ-scaleUp-dim',
6089
});
6190
});
6291

@@ -107,7 +136,7 @@ describe('./metrics', () => {
107136
Values: [1],
108137
},
109138
],
110-
Namespace: 'environ-scaleUp',
139+
Namespace: 'environ-scaleUp-dim',
111140
});
112141
});
113142

0 commit comments

Comments
 (0)