mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
Reduce realtime audio submission log noise
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -124,6 +124,7 @@ use tokio::task::JoinHandle;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use tracing::Instrument;
|
||||
use tracing::debug;
|
||||
use tracing::debug_span;
|
||||
use tracing::error;
|
||||
use tracing::field;
|
||||
use tracing::info;
|
||||
@@ -3890,7 +3891,12 @@ async fn submission_loop(sess: Arc<Session>, config: Arc<Config>, rx_sub: Receiv
|
||||
}
|
||||
|
||||
fn submission_dispatch_span(sub: &Submission) -> tracing::Span {
|
||||
let dispatch_span = info_span!("submission_dispatch", submission.id = sub.id.as_str());
|
||||
let dispatch_span = match &sub.op {
|
||||
Op::RealtimeConversationAudio(_) => {
|
||||
debug_span!("submission_dispatch", submission.id = sub.id.as_str())
|
||||
}
|
||||
_ => info_span!("submission_dispatch", submission.id = sub.id.as_str()),
|
||||
};
|
||||
if let Some(trace) = sub.trace.as_ref()
|
||||
&& !set_parent_from_w3c_trace_context(&dispatch_span, trace)
|
||||
{
|
||||
@@ -8579,6 +8585,29 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn submission_dispatch_span_uses_debug_for_realtime_audio() {
|
||||
init_test_tracing();
|
||||
|
||||
let dispatch_span = submission_dispatch_span(&Submission {
|
||||
id: "sub-1".into(),
|
||||
op: Op::RealtimeConversationAudio(ConversationAudioParams {
|
||||
frame: RealtimeAudioFrame {
|
||||
data: "ZmFrZQ==".into(),
|
||||
sample_rate: 16_000,
|
||||
num_channels: 1,
|
||||
samples_per_channel: Some(160),
|
||||
},
|
||||
}),
|
||||
trace: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
dispatch_span.metadata().expect("span metadata").level(),
|
||||
&tracing::Level::DEBUG
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn spawn_task_turn_span_inherits_dispatch_trace_context() {
|
||||
struct TraceCaptureTask {
|
||||
|
||||
Reference in New Issue
Block a user