feat: add workflow dry-run observability
This commit is contained in:
@@ -49,23 +49,27 @@ export function createWorkflowShadowObserver({
|
||||
userId,
|
||||
workflowName,
|
||||
});
|
||||
const planningMode = ['shadow', 'canary', 'active'].includes(selection.mode);
|
||||
const executionPlan = planningMode
|
||||
&& (selection.dryRun || ['canary', 'active'].includes(selection.mode)) ? {
|
||||
version: 'workflow-execution-decision-v1',
|
||||
candidateEngine: selection.candidateEngine ?? WORKFLOW_ENGINE.NATIVE,
|
||||
effectiveEngine: selection.engine ?? WORKFLOW_ENGINE.NATIVE,
|
||||
fallbackEngine: selection.fallbackEngine ?? WORKFLOW_ENGINE.NATIVE,
|
||||
reason: selection.reason,
|
||||
candidateReason: selection.candidateReason ?? null,
|
||||
configVersion: selection.configVersion ?? null,
|
||||
bucket: selection.bucket ?? null,
|
||||
taskType,
|
||||
dryRun: true,
|
||||
handoffAllowed: false,
|
||||
} : null;
|
||||
if (selection.shadowEngine !== WORKFLOW_ENGINE.LANGGRAPH) {
|
||||
return {
|
||||
observed: false,
|
||||
reason: selection.reason,
|
||||
mode: selection.mode,
|
||||
executionPlan: selection.dryRun ? {
|
||||
version: 'workflow-execution-decision-v1',
|
||||
candidateEngine: selection.candidateEngine ?? WORKFLOW_ENGINE.NATIVE,
|
||||
effectiveEngine: selection.engine ?? WORKFLOW_ENGINE.NATIVE,
|
||||
fallbackEngine: selection.fallbackEngine ?? WORKFLOW_ENGINE.NATIVE,
|
||||
reason: selection.reason,
|
||||
candidateReason: selection.candidateReason ?? null,
|
||||
configVersion: selection.configVersion ?? null,
|
||||
bucket: selection.bucket ?? null,
|
||||
dryRun: true,
|
||||
handoffAllowed: false,
|
||||
} : null,
|
||||
executionPlan,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -107,10 +111,15 @@ export function createWorkflowShadowObserver({
|
||||
engine: WORKFLOW_ENGINE.LANGGRAPH,
|
||||
mode: selection.mode,
|
||||
configVersion: selection.configVersion,
|
||||
executionPlan,
|
||||
shadowRun: result,
|
||||
};
|
||||
} catch (error) {
|
||||
logger.warn('[orchestrator-shadow] observation failed:', safeError(error));
|
||||
if (error && typeof error === 'object') {
|
||||
error.executionPlan = executionPlan;
|
||||
error.mode = selection.mode;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user