Unverified Commit 73f8557a authored by Neelay Shah's avatar Neelay Shah Committed by GitHub
Browse files

test: e2e JSONL log verification for request tracing (#7817)


Co-authored-by: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
parent 122777c8
...@@ -294,6 +294,7 @@ pub struct InflightGuard { ...@@ -294,6 +294,7 @@ pub struct InflightGuard {
error_type: ErrorType, error_type: ErrorType,
timer: Instant, timer: Instant,
request_id: String, request_id: String,
span: tracing::Span,
} }
/// Requests will be logged by the type of endpoint hit /// Requests will be logged by the type of endpoint hit
...@@ -1031,6 +1032,7 @@ impl InflightGuard { ...@@ -1031,6 +1032,7 @@ impl InflightGuard {
error_type: ErrorType::Internal, error_type: ErrorType::Internal,
timer, timer,
request_id, request_id,
span: tracing::Span::current(),
} }
} }
...@@ -1066,6 +1068,7 @@ impl InflightGuard { ...@@ -1066,6 +1068,7 @@ impl InflightGuard {
impl Drop for InflightGuard { impl Drop for InflightGuard {
fn drop(&mut self) { fn drop(&mut self) {
let _enter = self.span.enter();
let duration = self.timer.elapsed().as_secs_f64(); let duration = self.timer.elapsed().as_secs_f64();
self.metrics.dec_inflight_gauge(&self.model); self.metrics.dec_inflight_gauge(&self.model);
self.metrics.inc_request_counter( self.metrics.inc_request_counter(
......
...@@ -804,6 +804,12 @@ where ...@@ -804,6 +804,12 @@ where
trace_id = Some(parent_tracing_context.trace_id.clone()); trace_id = Some(parent_tracing_context.trace_id.clone());
parent_id = Some(parent_tracing_context.span_id.clone()); parent_id = Some(parent_tracing_context.span_id.clone());
tracestate = parent_tracing_context.tracestate.clone(); tracestate = parent_tracing_context.tracestate.clone();
if x_request_id.is_none() {
x_request_id = parent_tracing_context.x_request_id.clone();
}
if request_id.is_none() {
request_id = parent_tracing_context.request_id.clone();
}
} }
} }
......
...@@ -226,6 +226,8 @@ class MockerWorkerProcess(ManagedProcess): ...@@ -226,6 +226,8 @@ class MockerWorkerProcess(ManagedProcess):
system_port: int, system_port: int,
speedup_ratio: int = 100, speedup_ratio: int = 100,
worker_id: str = "mocker-worker", worker_id: str = "mocker-worker",
extra_args: list = None,
extra_env: dict = None,
): ):
self.worker_id = worker_id self.worker_id = worker_id
self.frontend_port = frontend_port self.frontend_port = frontend_port
...@@ -245,6 +247,10 @@ class MockerWorkerProcess(ManagedProcess): ...@@ -245,6 +247,10 @@ class MockerWorkerProcess(ManagedProcess):
env["DYN_LOG"] = "debug" env["DYN_LOG"] = "debug"
env["DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS"] = '["generate"]' env["DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS"] = '["generate"]'
env["DYN_SYSTEM_PORT"] = str(system_port) env["DYN_SYSTEM_PORT"] = str(system_port)
if extra_env:
env.update(extra_env)
if extra_args:
command.extend(extra_args)
log_dir = f"{request.node.name}_{worker_id}" log_dir = f"{request.node.name}_{worker_id}"
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment