Scope Guardian V2 response timing to snapshot sampling (#51065)

## What changed

Measure `responses_duration` directly around `sampler.sample()` in the snapshot classification path. Leave it unset for conversation classification instead of timing submission and waiting for the score.

GitOrigin-RevId: 4cfac9db6f19f3c8513d7bf839ea9631d41bf3ac
This commit is contained in:
swastik-oai
2026-10-05 09:52:25 +00:00
committed by copyberry
parent c8949e55c2
commit 315f0efb34
@@ -308,7 +308,6 @@ impl Classification {
parent_turn_id: turn_id.clone(),
root_turn_id,
};
let mut sampling_started = Instant::now();
let result = match transcript {
ClassificationContext::Snapshot(context) => {
sampling.input = context.into_messages();
@@ -325,8 +324,10 @@ impl Classification {
"not_initialized",
);
}
sampling_started = Instant::now();
sampler.sample(sampling).await
let sampling_started = Instant::now();
let result = sampler.sample(sampling).await;
responses_duration = Some(sampling_started.elapsed());
result
}
ClassificationContext::Conversation {
@@ -358,7 +359,6 @@ impl Classification {
score.await.unwrap_or(Err(LunaSamplerError::Superseded))
}
};
responses_duration = Some(sampling_started.elapsed());
let output = match result {
Ok(output) => output,
Err(LunaSamplerError::Superseded) => {