@@ -277,6 +277,7 @@ impl<S: FileStorage> ConfigFetcher<S> {
277277 env,
278278 app_version,
279279 tags,
280+ process_tags,
280281 } = ( * target) . clone ( ) ;
281282
282283 let mut cached_target_files = vec ! [ ] ;
@@ -325,6 +326,7 @@ impl<S: FileStorage> ConfigFetcher<S> {
325326 env,
326327 app_version,
327328 tags : tags. iter ( ) . map ( |t| t. to_string ( ) ) . collect ( ) ,
329+ process_tags : process_tags. iter ( ) . map ( |t| t. to_string ( ) ) . collect ( ) ,
328330 } ) ,
329331 is_agent : false ,
330332 client_agent : None ,
@@ -601,6 +603,19 @@ pub mod tests {
601603 env : "env" . to_string ( ) ,
602604 app_version : "1.3.5" . to_string ( ) ,
603605 tags : vec ! [ ] ,
606+ process_tags : vec ! [ ] ,
607+ } )
608+ } ) ;
609+ pub ( crate ) static DUMMY_TARGET_WITH_PROCESS_TAGS : LazyLock < Arc < Target > > = LazyLock :: new ( || {
610+ Arc :: new ( Target {
611+ service : "service" . to_string ( ) ,
612+ env : "env" . to_string ( ) ,
613+ app_version : "1.3.5" . to_string ( ) ,
614+ tags : vec ! [ ] ,
615+ process_tags : vec ! [
616+ libdd_common:: tag:: Tag :: new( "entrypoint.workdir" , "datadog-remote-config" ) . unwrap( ) ,
617+ libdd_common:: tag:: Tag :: new( "entrypoint.type" , "script" ) . unwrap( ) ,
618+ ] ,
604619 } )
605620 } ) ;
606621
@@ -898,6 +913,42 @@ pub mod tests {
898913 }
899914 }
900915
916+ #[ tokio:: test]
917+ #[ cfg_attr( miri, ignore) ]
918+ async fn test_process_tags_forwarded_in_client_tracer ( ) {
919+ let server: Arc < RemoteConfigServer > = RemoteConfigServer :: spawn ( ) ;
920+ server. files . lock ( ) . unwrap ( ) . insert (
921+ PATH_FIRST . clone ( ) ,
922+ ( vec ! [ DUMMY_TARGET_WITH_PROCESS_TAGS . clone( ) ] , 1 , "v1" . to_string ( ) ) ,
923+ ) ;
924+
925+ let storage = Arc :: new ( Storage :: default ( ) ) ;
926+ let mut fetcher = ConfigFetcher :: new (
927+ storage,
928+ Arc :: new ( ConfigFetcherState :: new ( server. dummy_options ( ) . invariants ) ) ,
929+ ) ;
930+ let mut opaque_state = ConfigClientState :: default ( ) ;
931+
932+ let fetched = fetcher
933+ . fetch_once (
934+ DUMMY_RUNTIME_ID ,
935+ DUMMY_TARGET_WITH_PROCESS_TAGS . clone ( ) ,
936+ & server. dummy_product_capabilities ( ) ,
937+ "foo" ,
938+ & mut opaque_state,
939+ )
940+ . await
941+ . unwrap ( )
942+ . unwrap ( ) ;
943+
944+ assert_eq ! ( fetched. len( ) , 1 ) ;
945+
946+ let req = server. last_request . lock ( ) . unwrap ( ) ;
947+ let req = req. as_ref ( ) . unwrap ( ) ;
948+ let tracer = req. client . as_ref ( ) . unwrap ( ) . client_tracer . as_ref ( ) . unwrap ( ) ;
949+ assert_eq ! ( tracer. process_tags, & [ "entrypoint.workdir:datadog-remote-config" , "entrypoint.type:script" ] ) ;
950+ }
951+
901952 #[ test]
902953 #[ cfg_attr( miri, ignore) ]
903954 fn test_capability_encoding ( ) {
0 commit comments