Commit Graph
3 Commits
Author SHA1 Message Date
iceweasel-oai a705e0bb69 Add metrics for Statsig updates and evaluations (#64184)
## Why

A Statsig gate can return `false` while bootstrap is in progress or
because the cached evaluation is disabled. Update failures also share
a generic debug message, which makes recurring failures hard to diagnose.

## What changed

Record OpenTelemetry counts and durations for bootstrap and refresh,
tagged by outcome and failure category. Record gate and dynamic config
counts after successful updates. Skip update metrics while waiting for
authentication.

Count gate and dynamic config reads by name, kind, and reason. Use fixed
reason labels to distinguish fallback reads from evaluated reads while
keeping targeting values out of the metrics.

## Testing

Check that a gate read during bootstrap and a read after bootstrap emit
distinct reasons, and that wrapped network policy denials retain the
`policy` category.

GitOrigin-RevId: ca4a248ee8ec7ed1318b2b2d320b9e9df08cbe5e
2026-11-26 16:57:11 +00:00
iceweasel-oai 0adee0df26 Add a process-wide runtime for Statsig evaluations (#63762)
## Why

Codex callers need to read feature gates and dynamic configs locally and
stop using account-scoped decisions when the authentication owner changes.

## What changed

- Bootstrap ChatGPT evaluations through the Codex backend. Initialize
  API-key and installation identities through the Statsig SDK.
- Share one background worker per process to retry initialization and
  refresh evaluations through the SDK. Keep the last successful values
  on refresh failure while the authentication owner remains current.
- Expose `Gate` and `DynamicConfig` readers that return `false` and an
  empty JSON object, respectively, when current evaluations are unavailable.

## Testing

Add a mock-server test for bootstrap retries after credential changes,
local gate and config reads, and value retention after a failed refresh
followed by replacement on a successful refresh.

GitOrigin-RevId: c02cd976a44229518a7159eb2bd35107ef280b56
2026-11-24 23:15:42 +00:00
iceweasel-oai 598083ae58 Route Statsig requests through Codex's HTTP client (#63438)
## Why

Statsig requests need to honor the caller's proxy, TLS, and network policy
settings.

## What changed

Add a `codex-statsig` crate that adapts a caller-supplied
`RouteAwareClientPool` to the Statsig SDK's HTTP interface. The adapter
requests identity encoding, applies the SDK's timeout and optional
response body limit, and leaves HTTP status handling and retries to the SDK.

## Testing

Mock-server tests cover request forwarding, preservation of HTTP error
responses, response size limits, timeout error mapping, and policy denial
before a request reaches the server.

GitOrigin-RevId: 6e78435f1f93ee272977b2f0058afd8f485cf4e0
2026-11-23 21:05:43 +00:00