@@ -102,7 +102,7 @@ where
102102 Q : Serialize + Clone + Send + ' static ,
103103 F : Fn ( ApiCtx , Q ) -> Fut + Clone + Send + ' static ,
104104 Fut : Future < Output = Result < I > > + Send ,
105- A : Fn ( I , & mut R ) ,
105+ A : Fn ( u16 , I , & mut R ) ,
106106 R : Default + Send + ' static ,
107107{
108108 let dcs = & ctx. config ( ) . topology ( ) . datacenters ;
@@ -117,19 +117,22 @@ where
117117 async move {
118118 if dc. datacenter_label == ctx. config ( ) . dc_label ( ) {
119119 // Local datacenter - use direct API call
120- local_handler ( ctx, query) . await
120+ ( dc . datacenter_label , local_handler ( ctx, query) . await )
121121 } else {
122122 // Remote datacenter - HTTP request
123- request_remote_datacenter :: < I > (
124- ctx. config ( ) ,
123+ (
125124 dc. datacenter_label ,
126- & endpoint,
127- Method :: GET ,
128- headers,
129- Some ( & query) ,
130- Option :: < & ( ) > :: None ,
125+ request_remote_datacenter :: < I > (
126+ ctx. config ( ) ,
127+ dc. datacenter_label ,
128+ & endpoint,
129+ Method :: GET ,
130+ headers,
131+ Some ( & query) ,
132+ Option :: < & ( ) > :: None ,
133+ )
134+ . await ,
131135 )
132- . await
133136 }
134137 }
135138 } ) )
@@ -141,11 +144,11 @@ where
141144 let result_count = results. len ( ) ;
142145 let mut errors = Vec :: new ( ) ;
143146 let mut aggregated = R :: default ( ) ;
144- for res in results {
147+ for ( dc_label , res) in results {
145148 match res {
146- Ok ( data) => aggregator ( data, & mut aggregated) ,
149+ Ok ( data) => aggregator ( dc_label , data, & mut aggregated) ,
147150 Err ( err) => {
148- tracing:: error!( ?err, "failed to request edge dc" ) ;
151+ tracing:: error!( ?dc_label , ? err, "failed to request edge dc" ) ;
149152 errors. push ( err) ;
150153 }
151154 }
0 commit comments