mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
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:
@@ -8,4 +8,14 @@ pub trait ExtensionMetrics: Send + Sync {
|
||||
|
||||
/// Records one histogram sample with optional extension-provided tags.
|
||||
fn histogram(&self, name: &str, value: i64, tags: &[(&str, &str)]);
|
||||
|
||||
/// Records a histogram with explicit buckets, preserving host attribution.
|
||||
/// All callers of the same metric name must use the same boundaries.
|
||||
fn histogram_with_boundaries(
|
||||
&self,
|
||||
name: &str,
|
||||
value: i64,
|
||||
boundaries: &[f64],
|
||||
tags: &[(&str, &str)],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user