You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// iterate over reports and check if they are valid
@@ -228,30 +180,42 @@ impl UsageAgent {
228
180
let metadata:Option<Metadata> =
229
181
if client_name.is_some() || client_version.is_some(){
230
182
Some(Metadata{
231
-
client:Some(ClientInfo{
232
-
name: client_name,
233
-
version: client_version,
183
+
client:Some(Client{
184
+
name: client_name.unwrap_or_default(),
185
+
version: client_version.unwrap_or_default(),
234
186
}),
235
187
})
236
188
}else{
237
189
None
238
190
};
239
-
report.operations.push(Operation{
240
-
operationMapKey: hash.clone(),
191
+
report.operations.push(RequestOperation{
192
+
operation_map_key: hash.clone(),
241
193
timestamp: op.timestamp,
242
194
execution:Execution{
243
195
ok: op.ok,
244
-
duration: op.duration.as_nanos(),
245
-
errorsTotal: op.errors,
196
+
/*
197
+
The conversion from u128 (from op.duration.as_nanos()) to u64 using try_into().unwrap() can panic if the duration is longer than u64::MAX nanoseconds (over 584 years).
198
+
While highly unlikely, it's safer to handle this potential overflow gracefully in library code to prevent panics.
199
+
A safe alternative is to convert the Result to an Option and provide a fallback value on failure,
0 commit comments