Skip to content

Commit 39ddb53

Browse files
authored
Log test-result message sizes (#87)
1 parent df44b47 commit 39ddb53

File tree

6 files changed

+51
-14
lines changed

6 files changed

+51
-14
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 1.7.3
2+
3+
ABQ 1.7.3 is a patch release.
4+
5+
This release adds additional info logging for message sizes.
6+
17
# 1.7.2
28

39
ABQ 1.7.2 is a patch release.

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/abq_cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "abq"
3-
version = "1.7.2"
3+
version = "1.7.3"
44
edition = "2021"
55

66
[dependencies]

crates/abq_queue/src/persistence/results.rs

+7
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ pub enum EligibleForRemoteDump {
108108
No,
109109
}
110110

111+
impl EligibleForRemoteDump {
112+
fn bool(self) -> bool {
113+
self == Self::Yes
114+
}
115+
}
116+
111117
impl ResultsPersistedCell {
112118
pub fn new(run_id: RunId) -> Self {
113119
Self(Arc::new(CellInner {
@@ -183,6 +189,7 @@ pub struct PersistencePlan<'a> {
183189
}
184190

185191
impl<'a> PersistencePlan<'a> {
192+
#[tracing::instrument(level = "info", skip_all, fields(run_id = %self.cell.run_id, eligible_for_remote_dump = %self.eligible_for_remote_dump.bool()))]
186193
pub async fn execute(self) -> Result<()> {
187194
let result = self
188195
.persist_results

crates/abq_queue/src/queue.rs

+15-6
Original file line numberDiff line numberDiff line change
@@ -1921,10 +1921,11 @@ impl QueueServer {
19211921
.await
19221922
.located(here!())
19231923
.no_entity()?;
1924-
let Request { entity, message } = net_protocol::async_read(&mut stream)
1925-
.await
1926-
.located(here!())
1927-
.no_entity()?;
1924+
let (Request { entity, message }, request_message_size) =
1925+
net_protocol::async_read_with_size(&mut stream)
1926+
.await
1927+
.located(here!())
1928+
.no_entity()?;
19281929

19291930
let result: OpaqueResult<()> = match message {
19301931
Message::HealthCheck => Self::handle_healthcheck(entity, stream).await,
@@ -1972,6 +1973,7 @@ impl QueueServer {
19721973
run_id,
19731974
entity,
19741975
results,
1976+
request_message_size,
19751977
stream,
19761978
)
19771979
.await
@@ -2277,16 +2279,17 @@ impl QueueServer {
22772279
Ok(())
22782280
}
22792281

2280-
#[instrument(level = "trace", skip(queues, persist_results))]
2282+
#[instrument(level = "info", skip_all, fields(run_id, entity, results_message_size))]
22812283
async fn handle_worker_results(
22822284
queues: SharedRuns,
22832285
persist_results: SharedPersistResults,
22842286
run_id: RunId,
22852287
entity: Entity,
22862288
results: Vec<AssociatedTestResults>,
2289+
results_message_size: usize,
22872290
mut stream: Box<dyn net_async::ServerStream>,
22882291
) -> OpaqueResult<()> {
2289-
tracing::debug!(?entity, ?run_id, "got result");
2292+
tracing::debug!(?entity, ?run_id, ?results_message_size, "got result");
22902293

22912294
// Build a plan for persistence of the result, then immediately chuck the test result ACK
22922295
// over the wire before executing the plan.
@@ -3703,6 +3706,7 @@ mod test {
37033706
run_id.clone(),
37043707
entity,
37053708
vec![result],
3709+
0,
37063710
server_conn,
37073711
);
37083712
let cancellation_fut =
@@ -4787,6 +4791,7 @@ mod persist_results {
47874791
run_id.clone(),
47884792
Entity::runner(0, 1),
47894793
results.clone(),
4794+
0,
47904795
server_conn,
47914796
)
47924797
.await
@@ -4834,6 +4839,7 @@ mod persist_results {
48344839
run_id.clone(),
48354840
Entity::runner(0, 1),
48364841
results.clone(),
4842+
0,
48374843
server_conn,
48384844
)
48394845
.await
@@ -4876,6 +4882,7 @@ mod persist_results {
48764882
run_id.clone(),
48774883
Entity::runner(0, 1),
48784884
results.clone(),
4885+
0,
48794886
server_conn,
48804887
)
48814888
.await;
@@ -5038,6 +5045,7 @@ mod persist_results {
50385045
run_id.clone(),
50395046
Entity::runner(0, 1),
50405047
results,
5048+
0,
50415049
server_conn,
50425050
)
50435051
.await
@@ -5154,6 +5162,7 @@ mod persist_results {
51545162
run_id.clone(),
51555163
Entity::runner(1, 1),
51565164
results3.clone(),
5165+
0,
51575166
server_conn,
51585167
)
51595168
.await

crates/abq_utils/src/net_protocol.rs

+21-6
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,10 @@ impl<const COMPRESS_LARGE: bool> AsyncReader<COMPRESS_LARGE> {
11061106
///
11071107
/// Cancellation-safe, but the same `reader` must be provided between cancellable calls.
11081108
/// If errors, not resumable.
1109-
pub async fn next<R, T: serde::de::DeserializeOwned>(&mut self, reader: &mut R) -> io::Result<T>
1109+
pub async fn next<R, T: serde::de::DeserializeOwned>(
1110+
&mut self,
1111+
reader: &mut R,
1112+
) -> io::Result<(T, usize)>
11101113
where
11111114
R: tokio::io::AsyncReadExt + Unpin,
11121115
{
@@ -1178,7 +1181,7 @@ impl<const COMPRESS_LARGE: bool> AsyncReader<COMPRESS_LARGE> {
11781181
self.msg_buf.clear();
11791182
self.next_expiration = None;
11801183

1181-
return Ok(msg);
1184+
return Ok((msg, size));
11821185
}
11831186
}
11841187
}
@@ -1192,6 +1195,16 @@ impl<const COMPRESS_LARGE: bool> AsyncReader<COMPRESS_LARGE> {
11921195
pub async fn async_read<R, T: serde::de::DeserializeOwned>(
11931196
reader: &mut R,
11941197
) -> Result<T, std::io::Error>
1198+
where
1199+
R: tokio::io::AsyncReadExt + Unpin,
1200+
{
1201+
let (msg, _) = AsyncReader::<true>::new(READ_TIMEOUT).next(reader).await?;
1202+
Ok(msg)
1203+
}
1204+
1205+
pub async fn async_read_with_size<R, T: serde::de::DeserializeOwned>(
1206+
reader: &mut R,
1207+
) -> Result<(T, usize), std::io::Error>
11951208
where
11961209
R: tokio::io::AsyncReadExt + Unpin,
11971210
{
@@ -1210,7 +1223,8 @@ pub async fn async_read_local<R, T: serde::de::DeserializeOwned>(
12101223
where
12111224
R: tokio::io::AsyncReadExt + Unpin,
12121225
{
1213-
AsyncReader::<false>::new(READ_TIMEOUT).next(reader).await
1226+
let (msg, _) = AsyncReader::<false>::new(READ_TIMEOUT).next(reader).await?;
1227+
Ok(msg)
12141228
}
12151229

12161230
/// Like [write], but async.
@@ -1388,7 +1402,7 @@ mod test {
13881402
let msg_size = 10_u32.to_be_bytes();
13891403
client_conn.write_all(&msg_size).await.unwrap();
13901404

1391-
let read_result: Result<(), _> = AsyncReader::<true>::new(Duration::from_secs(0))
1405+
let read_result: Result<((), _), _> = AsyncReader::<true>::new(Duration::from_secs(0))
13921406
.next(&mut server_conn)
13931407
.await;
13941408
assert!(read_result.is_err());
@@ -1440,8 +1454,9 @@ mod test {
14401454
} else {
14411455
// After we read the last message, we should in fact end up with the message we
14421456
// expect.
1443-
let msg = handle.await.unwrap().unwrap();
1457+
let (msg, size) = handle.await.unwrap().unwrap();
14441458
assert_eq!(msg, "11111111");
1459+
assert_eq!(size, 10);
14451460
}
14461461
}
14471462
}
@@ -1525,7 +1540,7 @@ mod test {
15251540
} else {
15261541
// After we read the last message, we should in fact end up with the message we
15271542
// expect.
1528-
let msg = handle.await.unwrap().unwrap();
1543+
let (msg, _) = handle.await.unwrap().unwrap();
15291544
assert_eq!(msg, expected_str);
15301545
}
15311546
}

0 commit comments

Comments
 (0)