@@ -97,6 +97,7 @@ pub(crate) type ResponsePoliciesMap =
97
97
/// Adds a command to the pipeline map for a specific node address.
98
98
///
99
99
/// `add_asking` is a boolean flag that determines whether to add an `ASKING` command before the command.
100
+ /// `is_retrying` is a boolean flag that indicates whether this is a retry attempt.
100
101
fn add_command_to_node_pipeline_map < C > (
101
102
pipeline_map : & mut NodePipelineMap < C > ,
102
103
address : String ,
@@ -105,9 +106,19 @@ fn add_command_to_node_pipeline_map<C>(
105
106
index : usize ,
106
107
inner_index : Option < usize > ,
107
108
add_asking : bool ,
109
+ is_retrying : bool ,
108
110
) where
109
111
C : Clone ,
110
112
{
113
+ if is_retrying {
114
+ // Record retry attempt metric if telemetry is initialized
115
+ if let Err ( e) = GlideOpenTelemetry :: record_retries ( ) {
116
+ log_error (
117
+ "OpenTelemetry:retry_error" ,
118
+ format ! ( "Failed to record retry attempt: {}" , e) ,
119
+ ) ;
120
+ }
121
+ }
111
122
if add_asking {
112
123
let asking_cmd = Arc :: new ( crate :: cmd:: cmd ( "ASKING" ) ) ;
113
124
pipeline_map
@@ -226,6 +237,7 @@ where
226
237
index,
227
238
Some ( inner_index) ,
228
239
false ,
240
+ false ,
229
241
) ;
230
242
}
231
243
}
@@ -281,7 +293,7 @@ where
281
293
. await
282
294
. map_err ( |err| ( OperationTarget :: NotFound , err) ) ?;
283
295
284
- add_command_to_node_pipeline_map ( pipeline_map, address, conn, cmd, index, None , false ) ;
296
+ add_command_to_node_pipeline_map ( pipeline_map, address, conn, cmd, index, None , false , false ) ;
285
297
Ok ( ( ) )
286
298
}
287
299
@@ -326,6 +338,7 @@ where
326
338
index,
327
339
Some ( inner_index) ,
328
340
false ,
341
+ false ,
329
342
) ;
330
343
} else {
331
344
return Err ( (
@@ -1089,6 +1102,7 @@ where
1089
1102
index,
1090
1103
inner_index,
1091
1104
matches ! ( retry_method, RetryMethod :: AskRedirect ) ,
1105
+ true ,
1092
1106
) ;
1093
1107
continue ;
1094
1108
}
@@ -1204,15 +1218,9 @@ where
1204
1218
index,
1205
1219
inner_index,
1206
1220
false ,
1221
+ true ,
1207
1222
) ;
1208
1223
1209
- // Record retry attempt metric if telemetry is initialized
1210
- if let Err ( e) = GlideOpenTelemetry :: record_retries ( ) {
1211
- log_error (
1212
- "OpenTelemetry:retry_error" ,
1213
- format ! ( "Failed to record retry attempt: {}" , e) ,
1214
- ) ;
1215
- }
1216
1224
}
1217
1225
Err ( redis_error) => {
1218
1226
error. append_detail ( & redis_error. into ( ) ) ;
0 commit comments