fix(sdk): include hotpath fallback reason in bridge observability

This commit is contained in:
Tom Boucher
2026-05-05 20:29:43 -04:00
parent fe16143e29
commit 3785c09307
2 changed files with 6 additions and 0 deletions

View File

@@ -117,6 +117,7 @@ describe('QueryRuntimeBridge observability', () => {
type: 'query_hotpath_dispatch',
command: 'commit',
dispatchMode: 'subprocess',
reason: 'native_disabled',
outcome: 'success',
}),
);
@@ -141,6 +142,7 @@ describe('QueryRuntimeBridge observability', () => {
type: 'query_hotpath_dispatch',
command: 'commit',
dispatchMode: 'subprocess',
reason: 'policy_blocked',
outcome: 'error',
}),
);

View File

@@ -35,6 +35,7 @@ export interface RuntimeBridgeHotpathEvent {
legacyCommand: string;
mode: TransportMode;
dispatchMode: 'native_hotpath' | 'subprocess';
reason?: 'native_disabled' | 'policy_blocked';
durationMs: number;
outcome: 'success' | 'error';
errorKind?: 'timeout' | 'failure';
@@ -168,6 +169,7 @@ export class QueryRuntimeBridge {
legacyCommand,
mode,
dispatchMode: 'subprocess',
reason: 'policy_blocked',
durationMs: Date.now() - startedAt,
outcome: 'error',
errorKind: 'failure',
@@ -189,6 +191,7 @@ export class QueryRuntimeBridge {
legacyCommand,
mode,
dispatchMode: useNative ? 'native_hotpath' : 'subprocess',
reason: useNative ? undefined : 'native_disabled',
durationMs: Date.now() - startedAt,
outcome: 'success',
});
@@ -201,6 +204,7 @@ export class QueryRuntimeBridge {
legacyCommand,
mode,
dispatchMode: useNative ? 'native_hotpath' : 'subprocess',
reason: useNative ? undefined : 'native_disabled',
durationMs: Date.now() - startedAt,
outcome: 'error',
errorKind: kind,