diff --git a/docs/design/ETL_TODO.md b/docs/design/ETL_TODO.md index c1c2178bc..9ee73b3d9 100644 --- a/docs/design/ETL_TODO.md +++ b/docs/design/ETL_TODO.md @@ -5,7 +5,7 @@ This document tracks the tasks required to implement the "Ultimate Visibility" E ## 1. Extract (Ingestion & Telemetry Collection) - [ ] **Structured Logging:** Ensure `zerolog` is used consistently across the codebase for structured JSON logging. Add context to logs where missing (session IDs, tool inputs/outputs). -- [ ] **Basic Metrics Implementation:** Introduce a metrics package (e.g., using `expvar` or a Prometheus client) to expose basic application metrics. +- [x] **Basic Metrics Implementation:** Introduce a metrics package (e.g., using `expvar` or a Prometheus client) to expose basic application metrics. - [x] **Goroutine Tracking:** Implement a metric to track the number of active Goroutines. - [x] **Memory Tracking:** Implement a metric to track heap allocation and GC pauses. - [ ] **AgentLoop Telemetry:** Add specific instrumentation to the `AgentLoop` (iteration duration, tool execution duration, failure counts). diff --git a/pkg/health/server.go b/pkg/health/server.go index 632e4c346..b3f1c5a30 100644 --- a/pkg/health/server.go +++ b/pkg/health/server.go @@ -3,6 +3,7 @@ package health import ( "context" "encoding/json" + "expvar" "fmt" "maps" "net/http" @@ -41,6 +42,7 @@ func NewServer(host string, port int) *Server { mux.HandleFunc("/health", s.healthHandler) mux.HandleFunc("/ready", s.readyHandler) + mux.Handle("/debug/vars", expvar.Handler()) addr := fmt.Sprintf("%s:%d", host, port) s.server = &http.Server{ @@ -162,6 +164,7 @@ func (s *Server) readyHandler(w http.ResponseWriter, r *http.Request) { func (s *Server) RegisterOnMux(mux *http.ServeMux) { mux.HandleFunc("/health", s.healthHandler) mux.HandleFunc("/ready", s.readyHandler) + mux.Handle("/debug/vars", expvar.Handler()) } func statusString(ok bool) string {