Add structured step logging and error reporting
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from agentci.domain.models import Job, JobKind
|
||||
from agentci.workflows.common import Dependencies
|
||||
from agentci.workflows.implement import ImplementWorkflow
|
||||
from agentci.workflows.plan import PlanWorkflow
|
||||
from agentci.workflows.pull_request import PullRequestWorkflow
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Dispatcher:
|
||||
def __init__(self, dependencies: Dependencies) -> None:
|
||||
@@ -21,5 +25,16 @@ class Dispatcher:
|
||||
}
|
||||
|
||||
async def dispatch(self, job: Job) -> None:
|
||||
await self.handlers[job.kind](job)
|
||||
|
||||
extra = {
|
||||
"operation": "workflow.dispatch",
|
||||
"job_id": job.id,
|
||||
"target": job.target_key,
|
||||
"stage": job.kind.value,
|
||||
}
|
||||
log.info("workflow dispatch started", extra=extra)
|
||||
try:
|
||||
await self.handlers[job.kind](job)
|
||||
except Exception:
|
||||
log.exception("workflow dispatch failed", extra=extra)
|
||||
raise
|
||||
log.info("workflow dispatch completed", extra=extra)
|
||||
|
||||
Reference in New Issue
Block a user