Documentation
¶
Overview ¶
Package dashboards defines the portable custom dashboard document, its JSON Schema and the starter templates.
Index ¶
Constants ¶
const ( ScopeUser = "user" TargetApp = "app" TargetDatabase = "database" TargetNode = "node" WidgetMetricChart = "metric_chart" WidgetRequestPcts = "request_percentiles" WidgetErrorRate = "error_rate" WidgetLogTail = "log_tail" WidgetDeployTimeline = "deploy_timeline" WidgetResourceCounts = "resource_counts" WidgetCost = "cost" WidgetAlertStatus = "alert_status" WidgetNodeCapacity = "node_capacity" WidgetLink = "link" // Fleet-wide types read the whole fleet, so they take no target. WidgetFleetHealth = "fleet_health" WidgetFleetTraffic = "fleet_traffic" WidgetTopApps = "top_apps" WidgetDeployActivity = "deploy_activity" WidgetFleetCapacity = "fleet_capacity" WidgetAttention = "attention" // Cluster types read every connected Kubernetes cluster, so they take no target either. WidgetClusterHealth = "cluster_health" WidgetClusterNodes = "cluster_nodes" WidgetClusterWorkloads = "cluster_workloads" WidgetRolloutActivity = "rollout_activity" WidgetAppsOnClusters = "apps_on_clusters" // Summary types read one fleet summary endpoint each and take no target. WidgetBackupsSummary = "backups_summary" WidgetSecuritySummary = "security_summary" WidgetSLOSummary = "slo_summary" WidgetCloudSummary = "cloud_summary" WidgetSecurityFindings = "security_findings" WidgetCertsExpiring = "certs_expiring" WidgetBackupRuns = "backup_runs" WidgetCloudResources = "cloud_resources" )
Dashboard scopes, target kinds and widget types, matching schema.json.
const DefaultImportMaxBytes = 256 << 10
DefaultImportMaxBytes is the import size cap when no runtime setting is wired.
const PlaceholderName = "{app}"
PlaceholderName stands in for the app a starter reads from until the picker fills it.
const Version = 1
Version is the document format version; export files carry it so imports can reject newer formats.
Variables ¶
var ErrInvalid = errors.New("invalid dashboard")
ErrInvalid wraps every validation failure so callers can answer 400.
Functions ¶
func MarshalYAML ¶
MarshalYAML renders a document with a stable key order and a header naming the schema version.
func PacksError ¶
func PacksError() error
PacksError reports why the embedded packs failed to load, so a test fails on a bad pack.
Types ¶
type Doc ¶
type Doc struct {
Version int `json:"version" yaml:"version"`
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
TimeRange string `json:"time_range,omitempty" yaml:"time_range,omitempty"`
RefreshSeconds int `json:"refresh_seconds,omitempty" yaml:"refresh_seconds,omitempty"`
Requires []string `json:"requires,omitempty" yaml:"requires,omitempty"`
RequiresAny []string `json:"requires_any,omitempty" yaml:"requires_any,omitempty"`
Pack *Pack `json:"pack,omitempty" yaml:"pack,omitempty"`
Widgets []Widget `json:"widgets" yaml:"widgets"`
}
Doc is the exportable body of a dashboard.
func Parse ¶
Parse decodes and validates an exported dashboard document in JSON or YAML, capped at DefaultImportMaxBytes.
func ParseLimit ¶
ParseLimit is Parse with an explicit size cap in bytes.
type Template ¶
type Template struct {
Key string `json:"key"`
Doc Doc `json:"doc"`
NeedsTarget string `json:"needs_target,omitempty"`
Requires []string `json:"requires,omitempty"`
RequiresAny []string `json:"requires_any,omitempty"`
}
Template is a one-click starter dashboard; the picker fills the placeholder target names of NeedsTarget kind.
type Widget ¶
type Widget struct {
ID string `json:"id" yaml:"id"`
Type string `json:"type" yaml:"type"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Size string `json:"size" yaml:"size"`
Target *Target `json:"target,omitempty" yaml:"target,omitempty"`
Metric string `json:"metric,omitempty" yaml:"metric,omitempty"`
Query string `json:"query,omitempty" yaml:"query,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
}
Widget is one tile on the dashboard grid.