[DO-NOT-MERGE-YET] feat(complexity): add session routing observability - #6045
Closed
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This was referenced Aug 11, 2026
Closed
Closed
Contributor
Author
18 tasks
18 tasks
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_feat_complexity_add_session_routing_observability
branch
from
August 11, 2026 12:48
4d0b5be to
901048f
Compare
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_complexity_cache-aware_session_routing_integration
branch
from
August 11, 2026 12:48
82164fb to
3fbdd04
Compare
18 tasks
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_complexity_cache-aware_session_routing_integration
branch
from
August 11, 2026 19:10
3fbdd04 to
ef83df2
Compare
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_feat_complexity_add_session_routing_observability
branch
from
August 11, 2026 19:10
901048f to
c59699c
Compare
kohlivrinda
force-pushed
the
08-11-_do-not-merge-yet_complexity_cache-aware_session_routing_integration
branch
from
August 12, 2026 11:31
ef83df2 to
7a3d7cc
Compare
kohlivrinda
force-pushed
the
08-11-_do-not-merge-yet_feat_complexity_add_session_routing_observability
branch
from
August 12, 2026 11:31
c59699c to
417bd3b
Compare
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_feat_complexity_add_session_routing_observability
branch
from
August 12, 2026 15:14
417bd3b to
7d2cb18
Compare
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_complexity_cache-aware_session_routing_integration
branch
from
August 12, 2026 15:14
7a3d7cc to
06cc703
Compare
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_feat_complexity_add_session_routing_observability
branch
2 times, most recently
from
August 12, 2026 22:06
8f98604 to
e7b109e
Compare
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_complexity_cache-aware_session_routing_integration
branch
from
August 12, 2026 22:20
b52c3cc to
97a29d7
Compare
Madhuvod
force-pushed
the
08-11-_do-not-merge-yet_feat_complexity_add_session_routing_observability
branch
from
August 12, 2026 22:20
e7b109e to
3e52dee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds session observability to complexity-routed requests. When a governance routing rule evaluates a complexity tier through session policy (pinned or cache-aware), four new fields are now recorded on the request log: a tenant-scoped session hash, the session mode, the tier source (classified, memoised, or held), and the cumulative tier-switch count. These fields are surfaced in the log detail view and are filterable from the sidebar and API.
Changes
BifrostContextKeyconstants (ComplexitySessionID,ComplexitySessionMode,ComplexitySessionTierSource,ComplexitySessionSwitchCount) to the schema.ComplexitySessionLogFieldsas an embedded struct onlogstore.Log, keeping database columns and JSON response fields flat.migrationAddComplexitySessionColumnsmigration that idempotently adds the four nullable columns to thelogstable, with partial indexes on the two low-cardinality filter columns (complexity_session_mode,complexity_session_tier_source). The session ID column is intentionally unindexed as it is display/export-only.SearchFilterswithComplexitySessionModesandComplexitySessionTierSources, wired throughapplyFilters,canUseMatViewFilters(both new filters force the raw query path), andlistSelectColumns.applyComplexityContextToEntryhelper that covers both the normal completion path and the minimal-error path, preventing future drift.publishComplexitySessionLogContextandpublishSessionClassificationTelemetryin the governance plugin to emit session context into the request context from within the lazy complexity closure only—requests whose rules never inspectcomplexity_tierreceive no session log fields.persistInitialSessionTiernow returns the switch count and a known/unknown flag so callers can propagate it to telemetry without an extra store read.parseComplexityFiltersin the HTTP transport to deduplicate filter parsing across the log search, stats, and histogram endpoints, and addedcomplexity_session_modesandcomplexity_session_tier_sourcesquery parameters.ComplexitySessionTierSourcetype,COMPLEXITY_SESSION_LOG_MODE_VALUES,COMPLEXITY_SESSION_TIER_SOURCE_VALUES, andCOMPLEXITY_SESSION_TIER_SOURCE_LABELSto the UI type system.ComplexitySessionFiltersidebar section with mode and tier-source checkboxes, wired into URL state and the API filter builder.Type of change
Affected areas
How to test
Enable a routing rule that references
complexity_tierwith session policy (pinnedorcache_aware) configured. Send several requests in the same session. Verify that:complexity_session_modes=pinnedorcomplexity_session_tier_sources=heldreturns only matching rows.complexity_tierhave no session fields on their log entries.Breaking changes
Related issues
Security considerations
The session ID stored in the log is a hash of the already tenant-namespaced store key, not the raw caller identity, harness value, or fingerprint. The separately hashed tenant component in the key is not exposed. No PII reaches the log column.
Checklist
docs/contributing/README.mdand followed the guidelines