@@ -270,7 +270,8 @@ describe('Appsec Waf Telemetry metrics', () => {
270
270
271
271
describe ( 'WAF Truncation metrics' , ( ) => {
272
272
it ( 'should report truncated string metrics' , ( ) => {
273
- appsecTelemetry . updateWafRequestsMetricTags ( { maxTruncatedString : 5000 } , req )
273
+ const result = appsecTelemetry . updateWafRequestsMetricTags ( { maxTruncatedString : 5000 } , req )
274
+ expect ( result ) . to . have . property ( 'input_truncated' , true )
274
275
275
276
expect ( count ) . to . have . been . calledWith ( 'waf.input_truncated' , { truncation_reason : 1 } )
276
277
expect ( inc ) . to . have . been . calledWith ( 1 )
@@ -280,7 +281,8 @@ describe('Appsec Waf Telemetry metrics', () => {
280
281
} )
281
282
282
283
it ( 'should report truncated container size metrics' , ( ) => {
283
- appsecTelemetry . updateWafRequestsMetricTags ( { maxTruncatedContainerSize : 300 } , req )
284
+ const result = appsecTelemetry . updateWafRequestsMetricTags ( { maxTruncatedContainerSize : 300 } , req )
285
+ expect ( result ) . to . have . property ( 'input_truncated' , true )
284
286
285
287
expect ( count ) . to . have . been . calledWith ( 'waf.input_truncated' , { truncation_reason : 2 } )
286
288
expect ( inc ) . to . have . been . calledWith ( 1 )
@@ -290,7 +292,8 @@ describe('Appsec Waf Telemetry metrics', () => {
290
292
} )
291
293
292
294
it ( 'should report truncated container depth metrics' , ( ) => {
293
- appsecTelemetry . updateWafRequestsMetricTags ( { maxTruncatedContainerDepth : 20 } , req )
295
+ const result = appsecTelemetry . updateWafRequestsMetricTags ( { maxTruncatedContainerDepth : 20 } , req )
296
+ expect ( result ) . to . have . property ( 'input_truncated' , true )
294
297
295
298
expect ( count ) . to . have . been . calledWith ( 'waf.input_truncated' , { truncation_reason : 4 } )
296
299
expect ( inc ) . to . have . been . calledWith ( 1 )
@@ -300,11 +303,12 @@ describe('Appsec Waf Telemetry metrics', () => {
300
303
} )
301
304
302
305
it ( 'should combine truncation reasons when multiple truncations occur' , ( ) => {
303
- appsecTelemetry . updateWafRequestsMetricTags ( {
306
+ const result = appsecTelemetry . updateWafRequestsMetricTags ( {
304
307
maxTruncatedString : 5000 ,
305
308
maxTruncatedContainerSize : 300 ,
306
309
maxTruncatedContainerDepth : 20
307
310
} , req )
311
+ expect ( result ) . to . have . property ( 'input_truncated' , true )
308
312
309
313
expect ( count ) . to . have . been . calledWith ( 'waf.input_truncated' , { truncation_reason : 7 } )
310
314
expect ( distribution ) . to . have . been . calledWith ( 'waf.truncated_value_size' , { truncation_reason : 1 } )
@@ -313,7 +317,8 @@ describe('Appsec Waf Telemetry metrics', () => {
313
317
} )
314
318
315
319
it ( 'should not report truncation metrics when no truncation occurs' , ( ) => {
316
- appsecTelemetry . updateWafRequestsMetricTags ( metrics , req )
320
+ const result = appsecTelemetry . updateWafRequestsMetricTags ( metrics , req )
321
+ expect ( result ) . to . have . property ( 'input_truncated' , false )
317
322
318
323
expect ( count ) . to . not . have . been . calledWith ( 'waf.input_truncated' )
319
324
expect ( distribution ) . to . not . have . been . calledWith ( 'waf.truncated_value_size' )
0 commit comments