Documentation
¶
Index ¶
- Constants
- func InitDatabase(cfg *DatabaseConfig) (*sql.DB, error)
- func OpenDatabase(cfg *DatabaseConfig) (*sql.DB, error)
- type Analytics
- type CacheConfig
- type Config
- type DashboardOptions
- type DatabaseConfig
- type FlakyTest
- type LoggingConfig
- type Repository
- type Server
- type SessionsConfig
- type TrendPoint
- type WorkflowGridRow
- type WorkflowRun
- type WorkflowRunOptions
Constants ¶
View Source
const (
DefaultEnvPrefix = "DASHBOARD_"
)
Variables ¶
This section is empty.
Functions ¶
func InitDatabase ¶
func InitDatabase(cfg *DatabaseConfig) (*sql.DB, error)
InitDatabase initializes a database within a bounded startup window.
func OpenDatabase ¶
func OpenDatabase(cfg *DatabaseConfig) (*sql.DB, error)
OpenDatabase creates a stable pool; it can reconnect without replacing its pointer.
Types ¶
type Analytics ¶
type Analytics struct {
TotalRuns int `json:"total_runs"`
SuccessRate float64 `json:"success_rate"`
SkippedRuns int `json:"skipped_runs"`
CancelledRuns int `json:"cancelled_runs"`
AverageDuration float64 `json:"average_duration_seconds"`
FlakyTests []FlakyTest `json:"flaky_tests,omitempty"`
TrendData []TrendPoint `json:"trend_data,omitempty"`
}
Analytics provides statistical analysis of workflow data
type CacheConfig ¶
type CacheConfig struct {
// Cache duration for workflow runs
WorkflowTTL time.Duration `yaml:"workflow_ttl"`
// Maximum cache entries
MaxEntries int `yaml:"max_entries"`
// How long repository, analytics and flaky-check results are served from
// memory before being refreshed in the background (default: 1m)
StatsTTL time.Duration `yaml:"stats_ttl"`
}
type Config ¶
type Config struct {
Server baseapp.HTTPConfig `yaml:"server"`
Logging LoggingConfig `yaml:"logging"`
Github githubapp.Config `yaml:"github"`
Database DatabaseConfig `yaml:"database"`
Cache CacheConfig `yaml:"cache"`
Options DashboardOptions `yaml:"options"`
Sessions SessionsConfig `yaml:"sessions"`
Access auth.AccessPolicy `yaml:"access"`
DemoMode bool `yaml:"demo_mode"`
}
func ParseConfig ¶
type DashboardOptions ¶
type DashboardOptions struct {
// Default time window for workflow display (e.g., "12h", "24h")
DefaultTimeWindow string `yaml:"default_time_window"`
// Maximum repositories to display per page
MaxReposPerPage int `yaml:"max_repos_per_page"`
// Enable real-time updates via WebSocket
EnableRealtime bool `yaml:"enable_realtime"`
}
type DatabaseConfig ¶
type DatabaseConfig struct {
// Database driver: "postgres" (default: postgres)
Driver string `yaml:"driver"`
// Database connection string
// For PostgreSQL: "postgres://user:pass@localhost:5432/dbname?sslmode=disable"
// For Cloud SQL: auto-generated from CloudSQLInstance
URL string `yaml:"url"`
// Cloud SQL Instance connection name (format: project:region:instance)
// When set, automatically configures Unix socket connection for Cloud Run
CloudSQLInstance string `yaml:"cloud_sql_instance"`
// Database name (PostgreSQL only)
DBName string `yaml:"db_name"`
// Database user (PostgreSQL only)
User string `yaml:"user"`
// Database password (prefer using Secret Manager in production)
Password string `yaml:"password"`
// Maximum number of open connections
MaxOpenConns int `yaml:"max_open_conns"`
// Maximum number of idle connections
MaxIdleConns int `yaml:"max_idle_conns"`
}
type FlakyTest ¶
type FlakyTest struct {
Name string `json:"name"`
Repository string `json:"repository"`
TotalRuns int `json:"total_runs"`
FailureCount int `json:"failure_count"`
FlakeRate float64 `json:"flake_rate"`
LastFailure time.Time `json:"last_failure"`
}
FlakyTest represents a test that intermittently fails
type LoggingConfig ¶
type Repository ¶
type Repository struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
Name string `json:"name"`
FullName string `json:"full_name"`
DefaultBranch string `json:"default_branch"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Aggregate data
TotalRuns int `json:"total_runs,omitempty"`
SuccessfulRuns int `json:"successful_runs,omitempty"`
FailedRuns int `json:"failed_runs,omitempty"`
SkippedRuns int `json:"skipped_runs,omitempty"`
CancelledRuns int `json:"cancelled_runs,omitempty"`
SuccessRate float64 `json:"success_rate,omitempty"`
}
Repository represents a GitHub repository
func GetRepositories ¶
GetRepositories returns all tracked repositories with optional statistics
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the dashboard application server
type SessionsConfig ¶
type TrendPoint ¶
type TrendPoint struct {
Date string `json:"date"`
SuccessRate float64 `json:"success_rate"`
TotalRuns int `json:"total_runs"`
}
TrendPoint represents success rate at a point in time
func GetTrendData ¶
func GetTrendData(ctx context.Context, db *sql.DB, repositoryID int64, days int) ([]TrendPoint, error)
GetTrendData returns success rate trends over time
type WorkflowGridRow ¶
type WorkflowGridRow struct {
Name string
Cells []*WorkflowRun
}
type WorkflowRun ¶
type WorkflowRun struct {
ID int64 `json:"id"`
RepositoryID int64 `json:"repository_id"`
WorkflowID int64 `json:"workflow_id"`
WorkflowName string `json:"workflow_name"`
WorkflowPath string `json:"workflow_path,omitempty"`
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
RunNumber int `json:"run_number"`
Event string `json:"event"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
HTMLURL string `json:"html_url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
RunStartedAt *time.Time `json:"run_started_at,omitempty"`
// Joined data
RepositoryFullName string `json:"repository_full_name,omitempty"`
}
WorkflowRun represents a workflow run
func GetWorkflowRuns ¶
func GetWorkflowRuns(ctx context.Context, db *sql.DB, opts WorkflowRunOptions) ([]WorkflowRun, error)
GetWorkflowRuns returns workflow runs with optional filtering
Source Files
¶
Click to show internal directories.
Click to hide internal directories.