feat(client): add timestamp to ClientEvent::Warning
Include a timestamp when reporting warnings to allow consumers like the machine-readable formatter to provide temporal context for troubleshooting.
This commit is contained in:
5 files changed
+13
-4
No files matched your search
@@ -319,6 +319,7 @@ impl Client {
|
||||
return Ok(vec![ClientEvent::Warning {
|
||||
kind: WarningKind::MalformedOrUnrelatedPacket,
|
||||
message: "dropped malformed or unrelated packet".to_owned(),
|
||||
at: now,
|
||||
}]);
|
||||
};
|
||||
self.process_echo_reply(reply, packet_len, now, datagram.meta)
|
||||
@@ -415,6 +416,7 @@ impl Client {
|
||||
return Ok(vec![ClientEvent::Warning {
|
||||
kind: WarningKind::MalformedOrUnrelatedPacket,
|
||||
message: "dropped malformed or unrelated packet".to_owned(),
|
||||
at: now,
|
||||
}]);
|
||||
};
|
||||
self.process_echo_reply(reply, packet_len, now, meta)
|
||||
@@ -447,6 +449,7 @@ impl Client {
|
||||
"dropped reply with wrong token: expected {token:#x}, got {:#x}",
|
||||
reply.token
|
||||
),
|
||||
at: now,
|
||||
}]);
|
||||
}
|
||||
|
||||
@@ -561,6 +564,7 @@ impl Client {
|
||||
message: format!(
|
||||
"dropped reply with untracked seq {wire_seq} (no pending or completed entry)"
|
||||
),
|
||||
at: now,
|
||||
}])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1678,7 +1678,7 @@ fn receive_metadata_does_not_broaden_malformed_warning() {
|
||||
|
||||
assert_eq!(events.len(), 1);
|
||||
match &events[0] {
|
||||
ClientEvent::Warning { kind, message } => {
|
||||
ClientEvent::Warning { kind, message, .. } => {
|
||||
assert_eq!(*kind, WarningKind::MalformedOrUnrelatedPacket);
|
||||
assert_eq!(message, "dropped malformed or unrelated packet");
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ pub enum ClientEvent {
|
||||
Warning {
|
||||
kind: WarningKind,
|
||||
message: String,
|
||||
at: ClientTimestamp,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -279,6 +279,7 @@ mod tests {
|
||||
ClientEvent::Warning {
|
||||
kind: WarningKind::UntrackedReply,
|
||||
message: format!("event-{n}"),
|
||||
at: ClientTimestamp::now(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user