This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/handlers/admin_metrics.go
Jeffrey Smith 4bc11c2f4e
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Successful in 5s
CI/CD / test-go-pg (pull_request) Successful in 2m40s
CI/CD / test-sqlite (pull_request) Successful in 2m46s
CI/CD / build-and-deploy (pull_request) Successful in 1m1s
Feat v0.6.4 admin health/metrics tab + cluster merge
Admin Health tab under Monitoring with auto-refreshing runtime, DB,
cluster, and extension metrics panels. New GET /api/v1/admin/metrics
endpoint. Fattened heartbeat JSONB with stack, GC CPU%, extension
count, sandbox stats, trigger fires. Sandbox runner and trigger engine
now track cumulative execution counters. Event bus tracks publish/deliver
counts. Health endpoints consolidated via shared builder. Block renderers
(mermaid, katex, csv-table, diff-viewer) no longer require chat.
cluster-dashboard package retired — merged into admin Health tab.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:06:09 +00:00

25 lines
554 B
Go

package handlers
import (
"github.com/gin-gonic/gin"
"switchboard-core/metrics"
)
// MetricsHandler serves the admin metrics endpoint.
type MetricsHandler struct {
collector *metrics.Collector
}
// NewMetricsHandler creates a MetricsHandler.
func NewMetricsHandler(c *metrics.Collector) *MetricsHandler {
return &MetricsHandler{collector: c}
}
// GetMetrics returns a full metrics snapshot.
// GET /api/v1/admin/metrics
func (h *MetricsHandler) GetMetrics(c *gin.Context) {
snap := h.collector.Collect(c.Request.Context())
c.JSON(200, snap)
}