dashboard

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dashboard provides real-time dashboard components and handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID           string    `json:"id"`
	Level        string    `json:"level"` // info, warning, error, critical
	Type         string    `json:"type"`
	Message      string    `json:"message"`
	Timestamp    time.Time `json:"timestamp"`
	AffectedItem string    `json:"affected_item"`
	Action       string    `json:"action_required"`
}

Alert represents a system alert.

type Client

type Client struct {
	ID string
	// contains filtered or unexported fields
}

Client represents a WebSocket client.

type CollectorFunc

type CollectorFunc func(context.Context) (interface{}, error)

CollectorFunc is a function that collects specific metrics.

type MetricUpdate

type MetricUpdate struct {
	Type      string      `json:"type"`
	Metric    string      `json:"metric"`
	Value     interface{} `json:"value"`
	Timestamp time.Time   `json:"timestamp"`
	Delta     interface{} `json:"delta,omitempty"`
}

MetricUpdate represents a real-time metric update.

type MetricsCollector

type MetricsCollector struct {
	// contains filtered or unexported fields
}

MetricsCollector collects and broadcasts real-time metrics.

func NewMetricsCollector

func NewMetricsCollector(db interface{}) *MetricsCollector

NewMetricsCollector creates a new metrics collector.

func (*MetricsCollector) HandleWebSocket

func (mc *MetricsCollector) HandleWebSocket(c *gin.Context)

HandleWebSocket handles WebSocket connections.

func (*MetricsCollector) RegisterCollector

func (mc *MetricsCollector) RegisterCollector(name string, collector CollectorFunc)

RegisterCollector registers a custom metric collector.

func (*MetricsCollector) Start

func (mc *MetricsCollector) Start(ctx context.Context)

Start starts the metrics collector.

type PerformanceMetrics

type PerformanceMetrics struct {
	AvgResponseTime float64            `json:"avg_response_time_ms"`
	P95ResponseTime float64            `json:"p95_response_time_ms"`
	P99ResponseTime float64            `json:"p99_response_time_ms"`
	ErrorRate       float64            `json:"error_rate_percent"`
	Throughput      float64            `json:"throughput_requests_per_sec"`
	DatabaseQueries int                `json:"database_queries_per_sec"`
	SlowQueries     int                `json:"slow_queries_count"`
	EndpointMetrics map[string]float64 `json:"endpoint_metrics"`
}

PerformanceMetrics represents system performance metrics.

type QueueMetrics

type QueueMetrics struct {
	QueueID         int     `json:"queue_id"`
	QueueName       string  `json:"queue_name"`
	TicketsWaiting  int     `json:"tickets_waiting"`
	AvgWaitTime     float64 `json:"avg_wait_time_minutes"`
	LongestWaitTime float64 `json:"longest_wait_time_minutes"`
	AgentsAssigned  int     `json:"agents_assigned"`
	ProcessingRate  float64 `json:"processing_rate_per_hour"`
}

QueueMetrics represents metrics for a specific queue.

type SLAMetrics

type SLAMetrics struct {
	ComplianceRate  float64              `json:"compliance_rate_percent"`
	BreachedTickets int                  `json:"breached_tickets"`
	AtRiskTickets   int                  `json:"at_risk_tickets"`
	MetTargets      int                  `json:"met_targets"`
	TotalTargets    int                  `json:"total_targets"`
	ByPriority      map[string]SLAStatus `json:"by_priority"`
}

SLAMetrics represents SLA compliance metrics.

type SLAStatus

type SLAStatus struct {
	Priority       string  `json:"priority"`
	ComplianceRate float64 `json:"compliance_rate"`
	AvgTime        float64 `json:"avg_time_hours"`
	TargetTime     float64 `json:"target_time_hours"`
}

SLAStatus represents SLA status for a priority level.

type SystemMetrics

type SystemMetrics struct {
	Timestamp     time.Time              `json:"timestamp"`
	System        SystemStats            `json:"system"`
	Tickets       TicketMetrics          `json:"tickets"`
	Users         UserMetrics            `json:"users"`
	Performance   PerformanceMetrics     `json:"performance"`
	Queues        []QueueMetrics         `json:"queues"`
	SLA           SLAMetrics             `json:"sla"`
	Trends        TrendMetrics           `json:"trends"`
	Alerts        []Alert                `json:"alerts"`
	CustomMetrics map[string]interface{} `json:"custom"`
}

SystemMetrics holds all system metrics.

type SystemStats

type SystemStats struct {
	Uptime         time.Duration `json:"uptime"`
	DatabaseStatus string        `json:"database_status"`
	CacheHitRatio  float64       `json:"cache_hit_ratio"`
	ActiveSessions int           `json:"active_sessions"`
	MemoryUsage    float64       `json:"memory_usage_percent"`
	CPUUsage       float64       `json:"cpu_usage_percent"`
	DiskUsage      float64       `json:"disk_usage_percent"`
	ErrorRate      float64       `json:"error_rate"`
	RequestsPerSec float64       `json:"requests_per_sec"`
}

SystemStats represents system-level statistics.

type TicketMetrics

type TicketMetrics struct {
	TotalOpen         int     `json:"total_open"`
	TotalClosed       int     `json:"total_closed"`
	TotalPending      int     `json:"total_pending"`
	CreatedToday      int     `json:"created_today"`
	ClosedToday       int     `json:"closed_today"`
	AvgResponseTime   float64 `json:"avg_response_time_hours"`
	AvgResolutionTime float64 `json:"avg_resolution_time_hours"`
	EscalatedCount    int     `json:"escalated_count"`
	OverdueCount      int     `json:"overdue_count"`
	UnassignedCount   int     `json:"unassigned_count"`
}

TicketMetrics represents ticket-related metrics.

type Trend

type Trend struct {
	Direction    string  `json:"direction"` // up, down, stable
	Change       float64 `json:"change_percent"`
	LastValue    float64 `json:"last_value"`
	CurrentValue float64 `json:"current_value"`
	Period       string  `json:"period"` // hour, day, week, month
}

Trend represents a metric trend.

type TrendMetrics

type TrendMetrics struct {
	TicketTrend       Trend `json:"ticket_trend"` // up, down, stable
	ResponseTrend     Trend `json:"response_trend"`
	ResolutionTrend   Trend `json:"resolution_trend"`
	UserGrowthTrend   Trend `json:"user_growth_trend"`
	SatisfactionTrend Trend `json:"satisfaction_trend"`
}

TrendMetrics represents trend analysis.

type UserMetrics

type UserMetrics struct {
	TotalUsers       int     `json:"total_users"`
	ActiveUsers      int     `json:"active_users"`
	OnlineNow        int     `json:"online_now"`
	NewToday         int     `json:"new_today"`
	AgentsAvailable  int     `json:"agents_available"`
	AgentsBusy       int     `json:"agents_busy"`
	AgentsOffline    int     `json:"agents_offline"`
	AvgSessionLength float64 `json:"avg_session_length_minutes"`
}

UserMetrics represents user-related metrics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL