File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,7 +175,19 @@ class CustomsClient {
175175 }
176176
177177 if ( this . statsd ) {
178- const tags = { action, block : options . block , ...options } ;
178+ const tags = { action } ;
179+ if ( options . block != null ) {
180+ tags . block = options . block ;
181+ }
182+ if ( options . suspect != null ) {
183+ tags . suspect = options . suspect ;
184+ }
185+ if ( options . unblock != null ) {
186+ tags . unblock = options . unblock ;
187+ }
188+ if ( options . blockReason != null ) {
189+ tags . blockReason = options . blockReason ;
190+ }
179191 this . statsd . increment ( `${ serviceName } .${ name } ` , tags ) ;
180192 }
181193 }
Original file line number Diff line number Diff line change @@ -726,6 +726,15 @@ describe('Customs', () => {
726726 suspect : true ,
727727 unblock : true ,
728728 blockReason : 'other' ,
729+ // Important! Values with high cardinality like retryAfter
730+ // should be sent to statsd!
731+ retryAfter : 1111 ,
732+ } ;
733+ const validTags = {
734+ block : true ,
735+ suspect : true ,
736+ unblock : true ,
737+ blockReason : 'other' ,
729738 } ;
730739
731740 beforeEach ( ( ) => {
@@ -739,10 +748,10 @@ describe('Customs', () => {
739748 await customsWithUrl . check ( request , email , action ) ;
740749 assert . fail ( 'should have failed' ) ;
741750 } catch ( err ) {
742- assert . isTrue (
751+ assert . isTrue (
743752 statsd . increment . calledWithExactly ( 'customs.request.check' , {
744753 action,
745- ...tags ,
754+ ...validTags ,
746755 } )
747756 ) ;
748757 assert . isTrue ( statsd . timing . calledWithMatch ( 'customs.check.success' ) ) ;
@@ -765,7 +774,7 @@ describe('Customs', () => {
765774 assert . isTrue (
766775 statsd . increment . calledWithExactly ( 'customs.request.checkIpOnly' , {
767776 action,
768- ...tags ,
777+ ...validTags ,
769778 } )
770779 ) ;
771780 assert . isTrue (
You can’t perform that action at this time.
0 commit comments