Skip to content

Commit

Permalink
agent: Add probe point for integration testing
Browse files Browse the repository at this point in the history
This adds a probe point ("event_group") where the log is written to
the file.  The probe point can be used by the integration tests to
wait for the log file is synchronized.

Signed-off-by: Daiki Ueno <[email protected]>
  • Loading branch information
ueno committed Nov 13, 2023
1 parent 48e0c6b commit 923d04d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tokio-uring = { version = "0.4", optional = true }
toml = "0.6"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
probe = "0.3"

[build-dependencies]
libbpf-cargo = { version = "0.20", features = ["novendor"] }
6 changes: 6 additions & 0 deletions agent/src/log_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use crate::config;
use anyhow::{bail, Context as _, Result};
use crypto_auditing::types::EventGroup;
use probe::probe;
use serde_cbor::{ser::IoWrite, Serializer};
use std::path::PathBuf;
use time::{macros::format_description, OffsetDateTime};
Expand Down Expand Up @@ -179,6 +180,11 @@ impl LogWriter {
config::Format::Minimal => to_vec_minimal(&group)?,
};
self.write_all(v).await?;
probe!(
crypto_auditing_internal_agent,
event_group,
group.events().len()
);
self.written_events += group.events().len();
}
self.groups.clear();
Expand Down

0 comments on commit 923d04d

Please sign in to comment.