From 70150cf2b2011e7823ab1615b33dd86829b7af30 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Sun, 12 Nov 2023 12:47:43 +0900 Subject: [PATCH] agent: Add probe point for integration testing 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 --- agent/Cargo.toml | 1 + agent/src/log_writer.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 7447059..d34753d 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -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"] } diff --git a/agent/src/log_writer.rs b/agent/src/log_writer.rs index 3fe21d1..e382331 100644 --- a/agent/src/log_writer.rs +++ b/agent/src/log_writer.rs @@ -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}; @@ -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();