Documentation
¶
Index ¶
- type CollectorInfo
- type DashboardSnapshot
- type DataCollector
- func (dc *DataCollector) CollectHealth(ctx context.Context) *HealthData
- func (dc *DataCollector) CollectMetrics(ctx context.Context) *MetricsData
- func (dc *DataCollector) CollectMetricsReport(ctx context.Context) *MetricsReport
- func (dc *DataCollector) CollectOverview(ctx context.Context) *OverviewData
- func (dc *DataCollector) CollectServiceDetail(ctx context.Context, serviceName string) *ServiceDetail
- func (dc *DataCollector) CollectServices(ctx context.Context) []ServiceInfo
- func (dc *DataCollector) Start(ctx context.Context, interval time.Duration)
- func (dc *DataCollector) Stop()
- type DataHistory
- func (dh *DataHistory) AddHealth(snapshot HealthSnapshot)
- func (dh *DataHistory) AddMetrics(snapshot MetricsSnapshot)
- func (dh *DataHistory) AddOverview(snapshot OverviewSnapshot)
- func (dh *DataHistory) Clear()
- func (dh *DataHistory) GetAll() HistoryData
- func (dh *DataHistory) GetHealth() []HealthSnapshot
- func (dh *DataHistory) GetMetrics() []MetricsSnapshot
- func (dh *DataHistory) GetOverview() []OverviewSnapshot
- type DataPoint
- type ExportFormat
- type HealthData
- type HealthSnapshot
- type HealthSummary
- type HistoryData
- type MetricActivity
- type MetricEntry
- type MetricsData
- type MetricsReport
- type MetricsReportStats
- type MetricsSnapshot
- type MetricsStats
- type OverviewData
- type OverviewSnapshot
- type ServiceDetail
- type ServiceHealth
- type ServiceInfo
- type TimeSeriesData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectorInfo ¶
type CollectorInfo struct {
Name string `json:"name"`
Type string `json:"type"`
MetricsCount int `json:"metrics_count"`
LastCollection time.Time `json:"last_collection"`
Status string `json:"status"`
}
CollectorInfo contains information about a metrics collector.
type DashboardSnapshot ¶
type DashboardSnapshot struct {
Timestamp time.Time `json:"timestamp"`
Overview OverviewData `json:"overview"`
Health HealthData `json:"health"`
Metrics MetricsData `json:"metrics"`
Services []ServiceInfo `json:"services"`
GeneratedBy string `json:"generated_by"`
}
DashboardSnapshot contains complete dashboard state for export.
type DataCollector ¶
type DataCollector struct {
// contains filtered or unexported fields
}
DataCollector collects dashboard data periodically.
func NewDataCollector ¶
func NewDataCollector( healthManager forge.HealthManager, metrics forge.Metrics, container shared.Container, logger forge.Logger, history *DataHistory, ) *DataCollector
NewDataCollector creates a new data collector.
func (*DataCollector) CollectHealth ¶
func (dc *DataCollector) CollectHealth(ctx context.Context) *HealthData
CollectHealth collects health check data.
func (*DataCollector) CollectMetrics ¶
func (dc *DataCollector) CollectMetrics(ctx context.Context) *MetricsData
CollectMetrics collects current metrics.
func (*DataCollector) CollectMetricsReport ¶
func (dc *DataCollector) CollectMetricsReport(ctx context.Context) *MetricsReport
CollectMetricsReport collects comprehensive metrics report.
func (*DataCollector) CollectOverview ¶
func (dc *DataCollector) CollectOverview(ctx context.Context) *OverviewData
CollectOverview collects overview data.
func (*DataCollector) CollectServiceDetail ¶
func (dc *DataCollector) CollectServiceDetail(ctx context.Context, serviceName string) *ServiceDetail
CollectServiceDetail collects detailed information about a specific service.
func (*DataCollector) CollectServices ¶
func (dc *DataCollector) CollectServices(ctx context.Context) []ServiceInfo
CollectServices collects service information with health status.
type DataHistory ¶
type DataHistory struct {
// contains filtered or unexported fields
}
DataHistory manages historical time-series data with a ring buffer.
func NewDataHistory ¶
func NewDataHistory(maxPoints int, retentionPeriod time.Duration) *DataHistory
NewDataHistory creates a new data history manager.
func (*DataHistory) AddHealth ¶
func (dh *DataHistory) AddHealth(snapshot HealthSnapshot)
AddHealth adds a health snapshot.
func (*DataHistory) AddMetrics ¶
func (dh *DataHistory) AddMetrics(snapshot MetricsSnapshot)
AddMetrics adds a metrics snapshot.
func (*DataHistory) AddOverview ¶
func (dh *DataHistory) AddOverview(snapshot OverviewSnapshot)
AddOverview adds an overview snapshot.
func (*DataHistory) GetAll ¶
func (dh *DataHistory) GetAll() HistoryData
GetAll returns all historical data.
func (*DataHistory) GetHealth ¶
func (dh *DataHistory) GetHealth() []HealthSnapshot
GetHealth returns all health snapshots.
func (*DataHistory) GetMetrics ¶
func (dh *DataHistory) GetMetrics() []MetricsSnapshot
GetMetrics returns all metrics snapshots.
func (*DataHistory) GetOverview ¶
func (dh *DataHistory) GetOverview() []OverviewSnapshot
GetOverview returns all overview snapshots.
type DataPoint ¶
type DataPoint struct {
Timestamp time.Time `json:"timestamp"`
Value float64 `json:"value"`
Labels map[string]string `json:"labels,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
DataPoint represents a time-series data point.
type ExportFormat ¶
type ExportFormat string
ExportFormat represents data export format.
const ( ExportFormatJSON ExportFormat = "json" ExportFormatCSV ExportFormat = "csv" ExportFormatPrometheus ExportFormat = "prometheus" )
type HealthData ¶
type HealthData struct {
OverallStatus string `json:"overall_status"`
Services map[string]ServiceHealth `json:"services"`
CheckedAt time.Time `json:"checked_at"`
Duration time.Duration `json:"duration"`
Summary HealthSummary `json:"summary"`
}
HealthData contains health check results.
type HealthSnapshot ¶
type HealthSnapshot struct {
Timestamp time.Time `json:"timestamp"`
OverallStatus string `json:"overall_status"`
HealthyCount int `json:"healthy_count"`
DegradedCount int `json:"degraded_count"`
UnhealthyCount int `json:"unhealthy_count"`
}
HealthSnapshot is a timestamped health snapshot.
type HealthSummary ¶
type HealthSummary struct {
Healthy int `json:"healthy"`
Degraded int `json:"degraded"`
Unhealthy int `json:"unhealthy"`
Unknown int `json:"unknown"`
Total int `json:"total"`
}
HealthSummary provides count of services by status.
type HistoryData ¶
type HistoryData struct {
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Series []TimeSeriesData `json:"series"`
}
HistoryData contains historical dashboard data.
type MetricActivity ¶
type MetricActivity struct {
Metric string `json:"metric"`
Action string `json:"action"`
Value float64 `json:"value"`
Timestamp time.Time `json:"timestamp"`
}
MetricActivity represents recent metric activity.
type MetricEntry ¶
type MetricEntry struct {
Name string `json:"name"`
Type string `json:"type"`
Value any `json:"value"`
Tags []string `json:"tags,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
MetricEntry represents a single metric entry.
type MetricsData ¶
type MetricsData struct {
Timestamp time.Time `json:"timestamp"`
Metrics map[string]any `json:"metrics"`
Stats MetricsStats `json:"stats"`
}
MetricsData contains current metrics information.
type MetricsReport ¶
type MetricsReport struct {
Timestamp time.Time `json:"timestamp"`
TotalMetrics int `json:"total_metrics"`
MetricsByType map[string]int `json:"metrics_by_type"`
Collectors []CollectorInfo `json:"collectors"`
Stats MetricsReportStats `json:"stats"`
TopMetrics []MetricEntry `json:"top_metrics"`
RecentActivity []MetricActivity `json:"recent_activity"`
}
MetricsReport contains comprehensive metrics information.
type MetricsReportStats ¶
type MetricsReportStats struct {
CollectionInterval time.Duration `json:"collection_interval"`
LastCollection time.Time `json:"last_collection"`
TotalCollections int64 `json:"total_collections"`
ErrorCount int `json:"error_count"`
Uptime time.Duration `json:"uptime"`
}
MetricsReportStats contains statistics about metrics.
type MetricsSnapshot ¶
type MetricsSnapshot struct {
Timestamp time.Time `json:"timestamp"`
TotalMetrics int `json:"total_metrics"`
Values map[string]any `json:"values"`
}
MetricsSnapshot is a timestamped metrics snapshot.
type MetricsStats ¶
type MetricsStats struct {
TotalMetrics int `json:"total_metrics"`
Counters int `json:"counters"`
Gauges int `json:"gauges"`
Histograms int `json:"histograms"`
LastUpdate time.Time `json:"last_update"`
}
MetricsStats contains metrics statistics.
type OverviewData ¶
type OverviewData struct {
Timestamp time.Time `json:"timestamp"`
OverallHealth string `json:"overall_health"`
TotalServices int `json:"total_services"`
HealthyServices int `json:"healthy_services"`
TotalMetrics int `json:"total_metrics"`
Uptime time.Duration `json:"uptime"`
Version string `json:"version"`
Environment string `json:"environment"`
Summary map[string]any `json:"summary"`
}
OverviewData contains dashboard overview information.
type OverviewSnapshot ¶
type OverviewSnapshot struct {
Timestamp time.Time `json:"timestamp"`
HealthStatus string `json:"health_status"`
ServiceCount int `json:"service_count"`
HealthyCount int `json:"healthy_count"`
MetricsCount int `json:"metrics_count"`
}
OverviewSnapshot is a timestamped overview snapshot.
type ServiceDetail ¶
type ServiceDetail struct {
Name string `json:"name"`
Type string `json:"type"`
Status string `json:"status"`
Health *ServiceHealth `json:"health,omitempty"`
Metrics map[string]any `json:"metrics"`
Dependencies []string `json:"dependencies"`
Configuration map[string]any `json:"configuration,omitempty"`
LastHealthCheck time.Time `json:"last_health_check"`
Uptime time.Duration `json:"uptime,omitempty"`
}
ServiceDetail contains detailed information about a specific service.
type ServiceHealth ¶
type ServiceHealth struct {
Name string `json:"name"`
Status string `json:"status"`
Message string `json:"message"`
Duration time.Duration `json:"duration"`
Critical bool `json:"critical"`
Timestamp time.Time `json:"timestamp"`
Details map[string]any `json:"details,omitempty"`
}
ServiceHealth contains individual service health information.
type ServiceInfo ¶
type ServiceInfo struct {
Name string `json:"name"`
Type string `json:"type"`
Status string `json:"status"`
RegisteredAt time.Time `json:"registered_at,omitempty"` //nolint:modernize // omitempty intentional for API compat
}
ServiceInfo contains information about a registered service.