@@ -759,7 +759,8 @@ async fn add_dsd_pipeline_to_blueprint(
759759 let dsd_mapper_config = DogStatsDMapperConfiguration :: from_configuration ( config) ?;
760760 let dsd_enrich_config =
761761 ChainedConfiguration :: default ( ) . with_transform_builder ( "dogstatsd_mapper" , dsd_mapper_config) ;
762- let dsd_tag_filterlist_config = TagFilterlistConfiguration :: from_configuration ( config)
762+ let dogstatsd_config = config_system. live ( |config| & config. domains . dogstatsd ) ;
763+ let dsd_tag_filterlist_config = TagFilterlistConfiguration :: from_configuration ( dogstatsd_config)
763764 . error_context ( "Failed to configure metric tag filterlist transform." ) ?;
764765 let dsd_agg_config =
765766 AggregateConfiguration :: from_configuration ( config) . error_context ( "Failed to configure aggregate transform." ) ?;
@@ -934,6 +935,13 @@ fn write_sizing_guide(bounds: ComponentBounds) -> Result<(), GenericError> {
934935mod tests {
935936 use std:: { path:: Path , sync:: Mutex , time:: Duration } ;
936937
938+ use agent_data_plane_config:: {
939+ domains:: dogstatsd:: {
940+ Domain as DogStatsDDomain , FilterAction , MetricTagFilterEntry , MetricTagValueAllowlistEntry ,
941+ TagValueMismatchAction ,
942+ } ,
943+ Live ,
944+ } ;
937945 use async_trait:: async_trait;
938946 use http:: { Request , StatusCode } ;
939947 use http_body_util:: { BodyExt as _, Empty } ;
@@ -991,11 +999,6 @@ mod tests {
991999 "statsd_metric_namespace_blocklist" : [ ] ,
9921000 "metric_filterlist" : [ "tenant.raw.blocked" ] ,
9931001 "metric_filterlist_match_prefix" : false ,
994- "metric_tag_filterlist" : [ {
995- "metric_name" : "tenant.mapped.requests" ,
996- "action" : "exclude" ,
997- "tags" : [ "remove" ]
998- } ] ,
9991002 "aggregate_flush_interval" : { "secs" : 60 , "nanos" : 0 }
10001003 } ) )
10011004 . await ;
@@ -1005,8 +1008,23 @@ mod tests {
10051008 let mapper_chain = ChainedConfiguration :: default ( ) . with_transform_builder ( "dogstatsd_mapper" , mapper) ;
10061009 let prefix_filter = DogStatsDPrefixFilterConfiguration :: from_configuration ( & config)
10071010 . expect ( "prefix filter configuration should parse" ) ;
1008- let tag_filter =
1009- TagFilterlistConfiguration :: from_configuration ( & config) . expect ( "tag filter configuration should parse" ) ;
1011+ let dogstatsd_config = DogStatsDDomain {
1012+ tag_filterlist : vec ! [ MetricTagFilterEntry {
1013+ metric_name: "tenant.mapped.requests" . to_string( ) ,
1014+ action: FilterAction :: Exclude ,
1015+ tags: vec![ "remove" . to_string( ) ] ,
1016+ } ] ,
1017+ tag_value_allowlist : vec ! [ MetricTagValueAllowlistEntry {
1018+ metric_prefix: "tenant.mapped." . to_string( ) ,
1019+ tag_name: "customer_id" . to_string( ) ,
1020+ values: vec![ "top-1" . to_string( ) ] ,
1021+ on_miss: TagValueMismatchAction :: Remove ,
1022+ replacement: "other" . to_string( ) ,
1023+ } ] ,
1024+ ..Default :: default ( )
1025+ } ;
1026+ let tag_filter = TagFilterlistConfiguration :: from_configuration ( Live :: new_fixed ( dogstatsd_config) )
1027+ . expect ( "tag filter configuration should be valid" ) ;
10101028 let aggregate =
10111029 AggregateConfiguration :: from_configuration ( & config) . expect ( "aggregate configuration should parse" ) ;
10121030 let snapshot_handle = aggregate. context_snapshot_handle ( ) ;
@@ -1056,14 +1074,24 @@ mod tests {
10561074 . send ( Event :: Metric ( Metric :: counter ( "raw.blocked" , 1.0 ) ) )
10571075 . await
10581076 . expect ( "controlled source should accept the blocked metric" ) ;
1059- let input_context = Context :: from_static_parts ( "raw.requests.checkout" , & [ "keep:client" , "remove:secret" ] ) ;
1077+ let input_context = Context :: from_static_parts (
1078+ "raw.requests.checkout" ,
1079+ & [
1080+ "customer_id:top-1" ,
1081+ "customer_id:long-tail" ,
1082+ "keep:client" ,
1083+ "remove:secret" ,
1084+ ] ,
1085+ ) ;
10601086 events_tx
10611087 . send ( Event :: Metric ( Metric :: counter ( input_context. clone ( ) , 1.0 ) ) )
10621088 . await
10631089 . expect ( "controlled source should accept the retained metric" ) ;
10641090
1065- let expected_context =
1066- Context :: from_static_parts ( "tenant.mapped.requests" , & [ "keep:client" , "route:checkout" ] ) ;
1091+ let expected_context = Context :: from_static_parts (
1092+ "tenant.mapped.requests" ,
1093+ & [ "customer_id:top-1" , "keep:client" , "route:checkout" ] ,
1094+ ) ;
10671095 let snapshot = loop {
10681096 let snapshot = snapshot_handle
10691097 . snapshot ( )
@@ -1078,7 +1106,15 @@ mod tests {
10781106 assert_eq ! ( snapshot. len( ) , 1 ) ;
10791107 assert_eq ! ( snapshot[ 0 ] . context( ) , & expected_context) ;
10801108 assert_eq ! ( snapshot[ 0 ] . metric_type( ) , AggregateMetricType :: Counter ) ;
1081- assert_eq ! ( snapshot[ 0 ] . context( ) . tags( ) . len( ) , 2 ) ;
1109+ assert_eq ! ( snapshot[ 0 ] . context( ) . tags( ) . len( ) , 3 ) ;
1110+ assert_eq ! (
1111+ snapshot[ 0 ]
1112+ . context( )
1113+ . tags( )
1114+ . get_single_tag( "customer_id" )
1115+ . and_then( |tag| tag. value( ) ) ,
1116+ Some ( "top-1" )
1117+ ) ;
10821118 assert_eq ! (
10831119 snapshot[ 0 ]
10841120 . context( )
0 commit comments