test(relay): capture access logs with the production JSON formatter

The capture helpers built a generic flattened JSON layer, which could drift
from the TraceContextJson formatter main.rs installs.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
Duncan
2026-10-26 21:05:26 -04:00
parent f202838ce2
commit f5643c2533

View File

@@ -1302,7 +1302,7 @@ pub(crate) mod tests {
tracing_subscriber::registry().with(
tracing_subscriber::fmt::layer()
.json()
.flatten_event(true)
.event_format(crate::telemetry::TraceContextLookup::default().json_formatter(false))
.with_writer(move || writer.clone()),
)
}
@@ -1317,7 +1317,7 @@ pub(crate) mod tests {
(r, out)
}
/// Run `f` with JSON logs (flattened, as in production) captured.
/// Run `f` with JSON logs captured, using production's JSON formatter.
pub(crate) fn capture<R>(f: impl FnOnce() -> R) -> (R, Captured) {
let _lock = crate::test_support::tracing_dispatch_lock();
let out = Captured::default();