Add structured logging infrastructure#59
Conversation
WalkthroughThis PR adds structured logging with Go's slog across the backend: a new agent logger utility, integration into the Runtime and TaskReconciler, and extensive logging in model providers and filesystem/interpreter tools. It introduces timing and token usage metrics and replaces many ad-hoc logs with structured helpers. A few public APIs/structs were changed: ModelProviderFactory.CreateClient signature, RuntimeOptions (LoggerConfig) and WithLoggerConfig, Runtime (logger field), and TaskReconciler.publishError signature. Functional behavior is otherwise unchanged. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Free 📒 Files selected for processing (13)
🚧 Files skipped from review as they are similar to previous changes (5)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Implement comprehensive structured logging using slog across agent runtime, task reconciliation, and model providers with: • New logging layer: agent/logger.go with standardized log key constants • Context propagation: agent/context.go for task/agent/model tracking • Model providers: OpenAI, Anthropic, Gemini with operation telemetry • Task reconciliation: Detailed logging of reconciliation phases and tool execution • Filesystem tools: Logging for file operations and search results • Code interpreter: Execution timing and output tracking • Runtime lifecycle: Component initialization and shutdown logging Key features: - Centralized log key constants for consistency (KeyTaskID, KeyModel, etc.) - Operation timing with LogOperationStart/End helpers - Token usage logging with cache hit ratio calculations - Retryable error logging with retry-after timing This enables better observability into task execution, model invocations, and tool operations for debugging and performance monitoring. Co-authored-by: construct-agent <noreply@construct.sh>
Implement comprehensive structured logging using slog across agent runtime, task reconciliation, and model providers with:
• New logging layer: agent/logger.go with standardized log key constants
• Context propagation: agent/context.go for task/agent/model tracking
• Model providers: OpenAI, Anthropic, Gemini with operation telemetry
• Task reconciliation: Detailed logging of reconciliation phases and tool execution
• Filesystem tools: Logging for file operations and search results
• Code interpreter: Execution timing and output tracking
• Runtime lifecycle: Component initialization and shutdown logging
Key features:
This enables better observability into task execution, model invocations, and tool operations for debugging and performance monitoring.