Documentation
¶
Index ¶
- func GetAllMetrics() map[string]*ServiceMetrics
- func RegisterRoutes(mux *http.ServeMux)
- func RegisterService(name, serviceType string)
- func UpdateCircuitBreakerStats(name string, stats CircuitBreakerStats)
- func UpdatePoolStats(name string, stats PoolStats)
- func UpdateServiceMetrics(name string, m *metrics.Metrics)
- type CircuitBreakerStats
- type Dashboard
- func (d *Dashboard) GetAllMetrics() map[string]*ServiceMetrics
- func (d *Dashboard) GetDashboardSnapshot() DashboardSnapshot
- func (d *Dashboard) GetServiceMetrics(name string) (*ServiceMetrics, bool)
- func (d *Dashboard) GetServicesByType(serviceType string) []*ServiceMetrics
- func (d *Dashboard) GetUnhealthyServices() []*ServiceMetrics
- func (d *Dashboard) HealthCheckAll(ctx context.Context) map[string]health.CheckResult
- func (d *Dashboard) RegisterService(name, serviceType string)
- func (d *Dashboard) StartPeriodicUpdate(interval time.Duration) chan struct{}
- func (d *Dashboard) UpdateCircuitBreakerStats(name string, stats CircuitBreakerStats)
- func (d *Dashboard) UpdatePoolStats(name string, stats PoolStats)
- func (d *Dashboard) UpdateServiceMetrics(name string, m *metrics.Metrics)
- type DashboardSnapshot
- type DashboardSummary
- type Handler
- func (h *Handler) HandleAllMetrics(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleDashboard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleHealth(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleLiveness(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleReadiness(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleServiceMetrics(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RegisterRoutes(mux *http.ServeMux)
- type PoolStats
- type ServiceMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllMetrics ¶
func GetAllMetrics() map[string]*ServiceMetrics
GetAllMetrics returns all metrics from global dashboard
func RegisterRoutes ¶
RegisterRoutes registers routes using global handler
func RegisterService ¶
func RegisterService(name, serviceType string)
RegisterService registers a service in global dashboard
func UpdateCircuitBreakerStats ¶
func UpdateCircuitBreakerStats(name string, stats CircuitBreakerStats)
UpdateCircuitBreakerStats updates circuit breaker stats in global dashboard
func UpdatePoolStats ¶
UpdatePoolStats updates pool stats in global dashboard
func UpdateServiceMetrics ¶
UpdateServiceMetrics updates service metrics in global dashboard
Types ¶
type CircuitBreakerStats ¶
type CircuitBreakerStats struct {
State string `json:"state"`
Requests uint32 `json:"requests"`
TotalSuccesses uint32 `json:"total_successes"`
TotalFailures uint32 `json:"total_failures"`
ConsecutiveSuccesses uint32 `json:"consecutive_successes"`
ConsecutiveFailures uint32 `json:"consecutive_failures"`
SuccessRate float64 `json:"success_rate"` // percentage
}
CircuitBreakerStats represents circuit breaker statistics
type Dashboard ¶
type Dashboard struct {
// contains filtered or unexported fields
}
Dashboard aggregates metrics from all services
func (*Dashboard) GetAllMetrics ¶
func (d *Dashboard) GetAllMetrics() map[string]*ServiceMetrics
GetAllMetrics returns metrics for all services
func (*Dashboard) GetDashboardSnapshot ¶
func (d *Dashboard) GetDashboardSnapshot() DashboardSnapshot
GetDashboardSnapshot returns a complete dashboard snapshot
func (*Dashboard) GetServiceMetrics ¶
func (d *Dashboard) GetServiceMetrics(name string) (*ServiceMetrics, bool)
GetServiceMetrics returns metrics for a specific service
func (*Dashboard) GetServicesByType ¶
func (d *Dashboard) GetServicesByType(serviceType string) []*ServiceMetrics
GetServicesByType returns all services of a specific type
func (*Dashboard) GetUnhealthyServices ¶
func (d *Dashboard) GetUnhealthyServices() []*ServiceMetrics
GetUnhealthyServices returns all unhealthy services
func (*Dashboard) HealthCheckAll ¶
HealthCheckAll performs health checks on all registered services
func (*Dashboard) RegisterService ¶
RegisterService registers a service for monitoring
func (*Dashboard) StartPeriodicUpdate ¶
StartPeriodicUpdate starts periodic metrics update
func (*Dashboard) UpdateCircuitBreakerStats ¶
func (d *Dashboard) UpdateCircuitBreakerStats(name string, stats CircuitBreakerStats)
UpdateCircuitBreakerStats updates circuit breaker stats for a service
func (*Dashboard) UpdatePoolStats ¶
UpdatePoolStats updates pool statistics for a service
type DashboardSnapshot ¶
type DashboardSnapshot struct {
Timestamp time.Time `json:"timestamp"`
OverallStatus health.Status `json:"overall_status"`
Services map[string]*ServiceMetrics `json:"services"`
Summary DashboardSummary `json:"summary"`
}
DashboardSnapshot represents a point-in-time dashboard snapshot
func GetDashboardSnapshot ¶
func GetDashboardSnapshot() DashboardSnapshot
GetDashboardSnapshot returns snapshot from global dashboard
type DashboardSummary ¶
type DashboardSummary struct {
TotalServices int `json:"total_services"`
HealthyServices int `json:"healthy_services"`
DegradedServices int `json:"degraded_services"`
UnhealthyServices int `json:"unhealthy_services"`
TotalConnections int64 `json:"total_connections"`
TotalOperations int64 `json:"total_operations"`
TotalErrors int64 `json:"total_errors"`
AverageLatencyMs int64 `json:"average_latency_ms"`
OverallSuccessRate float64 `json:"overall_success_rate"`
}
DashboardSummary provides aggregated statistics
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides HTTP handlers for monitoring endpoints
func NewHandler ¶
NewHandler creates a new monitoring handler
func (*Handler) HandleAllMetrics ¶
func (h *Handler) HandleAllMetrics(w http.ResponseWriter, r *http.Request)
HandleAllMetrics returns metrics for all services
func (*Handler) HandleDashboard ¶
func (h *Handler) HandleDashboard(w http.ResponseWriter, r *http.Request)
HandleDashboard returns dashboard snapshot
func (*Handler) HandleHealth ¶
func (h *Handler) HandleHealth(w http.ResponseWriter, r *http.Request)
HandleHealth returns overall health status
func (*Handler) HandleLiveness ¶
func (h *Handler) HandleLiveness(w http.ResponseWriter, r *http.Request)
HandleLiveness returns liveness status (basic ping)
func (*Handler) HandleReadiness ¶
func (h *Handler) HandleReadiness(w http.ResponseWriter, r *http.Request)
HandleReadiness returns readiness status (quick check)
func (*Handler) HandleServiceMetrics ¶
func (h *Handler) HandleServiceMetrics(w http.ResponseWriter, r *http.Request)
HandleServiceMetrics returns metrics for specific service
func (*Handler) RegisterRoutes ¶
RegisterRoutes registers monitoring routes with HTTP mux
type PoolStats ¶
type PoolStats struct {
OpenConnections int `json:"open_connections"`
IdleConnections int `json:"idle_connections"`
WaitingRequests int `json:"waiting_requests"`
MaxOpenConns int `json:"max_open_conns"`
MaxIdleConns int `json:"max_idle_conns"`
Utilization float64 `json:"utilization"` // percentage
}
PoolStats represents connection pool statistics
type ServiceMetrics ¶
type ServiceMetrics struct {
Name string `json:"name"`
Type string `json:"type"` // redis, mongodb, mysql, sqlite, http, grpc, etc.
Status health.Status `json:"status"`
Metrics metrics.MetricsSnapshot `json:"metrics"`
PoolStats *PoolStats `json:"pool_stats,omitempty"`
CircuitBreaker *CircuitBreakerStats `json:"circuit_breaker,omitempty"`
LastUpdated time.Time `json:"last_updated"`
}
ServiceMetrics represents metrics for a specific service
func GetServiceMetrics ¶
func GetServiceMetrics(name string) (*ServiceMetrics, bool)
GetServiceMetrics returns service metrics from global dashboard