Use explicit histogram buckets for Guardian context metrics (#44181)

## Why

Guardian request and section cost distributions need shared bucket boundaries across synchronous and asynchronous reviewers so their measurements align.

## What changed

- Add `histogram_with_boundaries` to session telemetry and extension metrics while preserving session attribution.
- Use shared request-token buckets up to 2,000,000 tokens and section-cost buckets up to 16,777,216 for both review paths.

## Testing

Extend telemetry tests to verify explicit bucket boundaries and sample counts, and Guardian integration coverage to check exported request and section metric bounds for both synchronous and asynchronous reviews.

GitOrigin-RevId: e34f6972b3418bac3b061939b62eeeccaec5a299
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-09-09 15:48:39 +00:00
1 parent c77c34ed33
commit 2bba3a29a0
16 files changed
+202 -18

No files matched your search

@@ -15,6 +15,17 @@ impl ExtensionMetrics for SessionTelemetryExtensionMetrics {
fn histogram(&self, name: &str, value: i64, tags: &[(&str, &str)]) {
self.session_telemetry.histogram(name, value, tags);
}
fn histogram_with_boundaries(
&self,
name: &str,
value: i64,
boundaries: &[f64],
tags: &[(&str, &str)],
) {
self.session_telemetry
.histogram_with_boundaries(name, value, boundaries, tags);
}
}
pub(crate) fn from_session_telemetry(