Documentation
¶
Index ¶
- Constants
- Variables
- func HandleRawLogs(w http.ResponseWriter, r *http.Request, req LogsRequest, deps *Deps)
- func RegisterAssets(mux *http.ServeMux)
- type AgentState
- type Analytics
- type AttemptData
- type AttemptRequest
- type BenchmarkStats
- type BenchmarkTarget
- type Deps
- type EcoDaily
- type ExpensivePackage
- type IndexData
- type IndexRequest
- type LogLine
- type LogsData
- type LogsRequest
- type PackageData
- type PackageEvent
- type PackageRequest
- type PackageSummary
- type RebuildView
- type ResourcesData
- type ResourcesRequest
- type SessionView
- type VersionData
- type VersionRequest
- type VersionState
- type VersionStatus
Constants ¶
const ( ThemeCSSPath = "/theme.css" CSSPath = "/dashboard.css" )
Hardcoded by the page templates, so the package owns the routes.
const MAX_LOG_SIZE_BYTES = 10 * 1024 * 1024
Variables ¶
Functions ¶
func HandleRawLogs ¶
func HandleRawLogs(w http.ResponseWriter, r *http.Request, req LogsRequest, deps *Deps)
func RegisterAssets ¶
RegisterAssets serves the dashboard's stylesheets at the paths above.
Types ¶
type AgentState ¶
type AgentState string
AgentState summarizes agent activity on a version.
const ( AgentNone AgentState = "" AgentRunning AgentState = "running" AgentFixed AgentState = "fixed" AgentFailed AgentState = "failed" AgentThrottled AgentState = "throttled" )
type Analytics ¶
type Analytics interface {
// Query runs f with the current database, serialized against refreshes.
Query(f func(*sqlite3.Conn) error) error
// Freshness is the time through which the served data is complete.
Freshness() time.Time
}
Analytics serves the snapshot database behind the derived-trend pages (docdb.Cache satisfies it). A nil Analytics degrades those pages to an empty state without affecting the live views.
type AttemptData ¶
type AttemptData struct {
Ecosystem string
PackageName string
EncodedPackage string
Attempt *RebuildView
AttemptStrategy string
AttemptDuration string
}
func Attempt ¶
func Attempt(ctx context.Context, req AttemptRequest, deps *Deps) (*AttemptData, error)
type AttemptRequest ¶
type AttemptRequest struct {
Ecosystem string
Package string
Version string
Artifact string
RunID string `form:"runid"`
}
func (AttemptRequest) Validate ¶
func (AttemptRequest) Validate() error
type BenchmarkStats ¶
type BenchmarkTarget ¶
type BenchmarkTarget struct {
Ecosystem string
Package string
EncodedEcosystem string
EncodedPackage string
Success bool
HasRun bool
}
BenchmarkTarget is a tracked target (version and artifact agnostic)
type Deps ¶
type Deps struct {
Rundex rundex.Reader
Sessions rundex.SessionReader
GCSClient *storage.Client
LogsBucket string
Tracked feed.TrackedPackageIndex
BenchmarkName string
SuccessRegex *regexp.Regexp
Analytics Analytics // serves the snapshot-derived trend views
Registry rebuild.RegistryMux // enumerates published versions for status
}
type EcoDaily ¶
type EcoDaily struct {
Day string
Attempts int64
Successes int64
SuccessPct int64
AttemptsBarPct int64
BuilderMinutes float64
Tokens string
VMMinutes float64
}
EcoDaily is one ecosystem-day in the trends table.
type ExpensivePackage ¶
type ExpensivePackage struct {
Ecosystem string
Package string
Attempts int64
BuilderMinutes float64
BarPct int64
}
ExpensivePackage is one row of the most-expensive-packages table, costed by summed builder time over the window.
type IndexData ¶
type IndexData struct {
BenchmarkTitle string
BenchmarkStats BenchmarkStats
BenchmarkTargets []BenchmarkTarget
RecentRebuilds []RebuildView
RecentSessions []SessionView
}
type IndexRequest ¶
type IndexRequest struct{}
func (IndexRequest) Validate ¶
func (IndexRequest) Validate() error
type LogsData ¶
type LogsRequest ¶
type LogsRequest struct {
Ecosystem string
Package string
Version string
Artifact string
RunID string
}
func (LogsRequest) Validate ¶
func (LogsRequest) Validate() error
type PackageData ¶
type PackageData struct {
Ecosystem string
PackageName string
EncodedPackage string
Summary PackageSummary // high-level per-package status shown at the top
Versions []VersionStatus // windowed slice of the version history shown in the strip
Expanded bool // strip shown as a multi-row grid
Offset int // current window offset (for building toggle links)
HasPrev bool // a newer window exists (scroll toward newest)
HasNext bool // an older window exists (scroll back in time)
PrevOffset int // offset the newer-window link jumps to
NextOffset int // offset the older-window link jumps to
WindowFrom int // 1-based index of the first shown version (for the caption)
WindowTo int // 1-based index of the last shown version
Events []PackageEvent // rebuilds and sessions intermingled, most-recent-first
RebuildEvents []PackageEvent // the same timeline restricted to rebuild attempts
SessionEvents []PackageEvent // the same timeline restricted to agent sessions
Warning string // set when the version lookup failed, not when the ecosystem lacks a lister
}
func Package ¶
func Package(ctx context.Context, req PackageRequest, deps *Deps) (*PackageData, error)
type PackageEvent ¶
type PackageEvent struct {
Created time.Time
Rebuild *RebuildView
Session *SessionView
}
PackageEvent is a single entry in a package's chronological history: either a rebuild attempt or an agent session. Exactly one of Rebuild/Session is set.
type PackageRequest ¶
type PackageRequest struct {
Ecosystem string
Package string
Offset int // render strip scroll-back into the version history, 0 = newest
Expanded bool // render strip as a multi-row grid rather than a single row
}
func (PackageRequest) Validate ¶
func (PackageRequest) Validate() error
type PackageSummary ¶
type PackageSummary struct {
Supported bool // whether the version history was enumerable for this ecosystem
TotalVersions int
Attempted int
Verified int
Failed int
Running int
AgentRuns int
NeedsAttention int // regressions
VerifiedPct int
}
PackageSummary is the high-level status shown at the top of the package view.
type RebuildView ¶
type RebuildView struct {
rundex.Rebuild
Encoded rebuild.EncodedTarget
}
func NewRebuildView ¶
func NewRebuildView(rb rundex.Rebuild) RebuildView
type ResourcesData ¶
type ResourcesData struct {
Loaded bool
AsOf string
WindowDays int
TotalAttempts int64
TotalSuccesses int64
TotalTokens string
TotalBuilderHours float64
TotalVMHours float64
Ecosystems []string // tab labels, from the window's data
Eco string // selected tab; empty is the aggregate view
Days []EcoDaily
TopPackages []ExpensivePackage
}
func ResourcesPage ¶
func ResourcesPage(ctx context.Context, req ResourcesRequest, deps *Deps) (*ResourcesData, error)
type ResourcesRequest ¶
type ResourcesRequest struct {
Eco string // ecosystem tab for the daily table; empty aggregates every ecosystem
}
func (ResourcesRequest) Validate ¶
func (ResourcesRequest) Validate() error
type SessionView ¶
type SessionView struct {
schema.AgentSession
Encoded rebuild.EncodedTarget
Iterations []schema.AgentIteration // NOTE: Only populated by pages where it's required
}
SessionView pairs an agent session with its encoded target for building dashboard links (e.g. to the package page).
func NewSessionView ¶
func NewSessionView(s schema.AgentSession) SessionView
type VersionData ¶
type VersionData struct {
Ecosystem string
PackageName string
Version string
EncodedPackage string
// Attempts are this version's rebuild attempts (across artifacts), newest-first.
Attempts []RebuildView
// Sessions are this version's agent sessions with their iterations, newest-first.
Sessions []SessionView
}
func Version ¶
func Version(ctx context.Context, req VersionRequest, deps *Deps) (*VersionData, error)
Version aggregates every rebuild attempt and agent session (with iterations) for a single package version.
type VersionRequest ¶
func (VersionRequest) Validate ¶
func (VersionRequest) Validate() error
type VersionState ¶
type VersionState string
VersionState is the coarse status a version's attempts and agent sessions roll up to. Detail (which failure phase, how many attempts, etc.) lives in the per-version drill-down.
const ( StateUntried VersionState = "untried" StateVerified VersionState = "verified" StateFailed VersionState = "failed" StateRunning VersionState = "running" )
type VersionStatus ¶
type VersionStatus struct {
Version string
Encoded rebuild.EncodedTarget
State VersionState
Agent AgentState
Regressed bool // Failed while an older version is Verified.
Attempts int
Sessions int
}
VersionStatus is the aggregated status of a single package version across all of its rebuild attempts and agent sessions.