@@ -24,8 +24,8 @@ describe("formatMetricsForContainer", () => {
2424 TEST_TIMESTAMP ,
2525 ) ;
2626
27- // 4 CPU + 4 Memory + 3 Disk + 2 Bandwidth = 13 metrics per group
28- expect ( metrics ) . toHaveLength ( 13 ) ;
27+ // 4 CPU + 4 Memory + 4 Disk + 2 Bandwidth = 14 metrics per group
28+ expect ( metrics ) . toHaveLength ( 14 ) ;
2929 } ) ;
3030
3131 it ( "formats multiple metrics groups" , ( ) => {
@@ -37,8 +37,8 @@ describe("formatMetricsForContainer", () => {
3737 TEST_TIMESTAMP ,
3838 ) ;
3939
40- // 2 groups * 13 metrics = 26 metrics
41- expect ( metrics ) . toHaveLength ( 26 ) ;
40+ // 2 groups * 14 metrics = 28 metrics
41+ expect ( metrics ) . toHaveLength ( 28 ) ;
4242 } ) ;
4343
4444 it ( "includes correct tags" , ( ) => {
@@ -61,7 +61,7 @@ describe("formatMetricsForContainer", () => {
6161
6262 const cpuMetric = metrics . find (
6363 ( m ) =>
64- m . metric === "cloudflare.containers.cpu" && m . tags . includes ( "stat:avg " ) ,
64+ m . metric === "cloudflare.containers.cpu" && m . tags . includes ( "stat:p50 " ) ,
6565 ) ;
6666
6767 expect ( cpuMetric ) . toBeDefined ( ) ;
@@ -99,8 +99,8 @@ describe("formatContainerMetrics", () => {
9999 TEST_TIMESTAMP ,
100100 ) ;
101101
102- // 4 CPU + 4 Memory + 3 Disk + 2 Bandwidth = 13 metrics per group
103- expect ( metrics ) . toHaveLength ( 13 ) ;
102+ // 4 CPU + 4 Memory + 4 Disk + 2 Bandwidth = 14 metrics per group
103+ expect ( metrics ) . toHaveLength ( 14 ) ;
104104 } ) ;
105105
106106 it ( "formats metrics for multiple containers with multiple groups" , ( ) => {
@@ -121,8 +121,8 @@ describe("formatContainerMetrics", () => {
121121 TEST_TIMESTAMP ,
122122 ) ;
123123
124- // 3 groups * 13 metrics = 39 metrics
125- expect ( metrics ) . toHaveLength ( 39 ) ;
124+ // 3 groups * 14 metrics = 42 metrics
125+ expect ( metrics ) . toHaveLength ( 42 ) ;
126126 } ) ;
127127
128128 it ( "includes correct tags for each metric" , ( ) => {
@@ -150,7 +150,7 @@ describe("formatContainerMetrics", () => {
150150
151151 const cpuMetric = metrics . find (
152152 ( m ) =>
153- m . metric === "cloudflare.containers.cpu" && m . tags . includes ( "stat:avg " ) ,
153+ m . metric === "cloudflare.containers.cpu" && m . tags . includes ( "stat:p50 " ) ,
154154 ) ;
155155
156156 expect ( cpuMetric ) . toBeDefined ( ) ;
@@ -161,20 +161,14 @@ describe("formatContainerMetrics", () => {
161161 ) ;
162162 expect ( cpuMetric ?. tags ) . toContain ( "deployment_id:deploy-test" ) ;
163163 expect ( cpuMetric ?. tags ) . toContain ( "placement_id:place-test" ) ;
164- expect ( cpuMetric ?. tags ) . toContain ( "stat:avg " ) ;
164+ expect ( cpuMetric ?. tags ) . toContain ( "stat:p50 " ) ;
165165 } ) ;
166166
167167 it ( "uses correct metric values from the group" , ( ) => {
168168 const group = createMockMetricsGroup ( {
169- avg : {
170- cpuLoad : 0.42 ,
171- memory : 123456789 ,
172- rxBandwidthBps : 0 ,
173- txBandwidthBps : 0 ,
174- } ,
175169 max : { cpuLoad : 0.99 , memory : 999999999 , diskUsage : 5000000000 } ,
176170 quantiles : {
177- cpuLoadP50 : 0.3 ,
171+ cpuLoadP50 : 0.42 ,
178172 cpuLoadP90 : 0.8 ,
179173 cpuLoadP99 : 0.95 ,
180174 memoryP50 : 100000000 ,
@@ -200,12 +194,12 @@ describe("formatContainerMetrics", () => {
200194 TEST_TIMESTAMP ,
201195 ) ;
202196
203- // Check CPU avg
204- const cpuAvg = metrics . find (
197+ // Check CPU p50
198+ const cpuP50 = metrics . find (
205199 ( m ) =>
206- m . metric === "cloudflare.containers.cpu" && m . tags . includes ( "stat:avg " ) ,
200+ m . metric === "cloudflare.containers.cpu" && m . tags . includes ( "stat:p50 " ) ,
207201 ) ;
208- expect ( cpuAvg ?. points [ 0 ] ) . toEqual ( [ TEST_TIMESTAMP , 0.42 ] ) ;
202+ expect ( cpuP50 ?. points [ 0 ] ) . toEqual ( [ TEST_TIMESTAMP , 0.42 ] ) ;
209203
210204 // Check CPU max
211205 const cpuMax = metrics . find (
0 commit comments