dashboards

package
v1.5.19 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dashboards defines the portable custom dashboard document, its JSON Schema and the starter templates.

Index

Constants

View Source
const (
	ScopeUser   = "user"
	ScopeShared = "shared"

	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.

View Source
const DefaultImportMaxBytes = 256 << 10

DefaultImportMaxBytes is the import size cap when no runtime setting is wired.

View Source
const PlaceholderName = "{app}"

PlaceholderName stands in for the app a starter reads from until the picker fills it.

View Source
const Version = 1

Version is the document format version; export files carry it so imports can reject newer formats.

Variables

View Source
var ErrInvalid = errors.New("invalid dashboard")

ErrInvalid wraps every validation failure so callers can answer 400.

Functions

func MarshalYAML

func MarshalYAML(d Doc) ([]byte, error)

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

func Parse(raw []byte) (Doc, error)

Parse decodes and validates an exported dashboard document in JSON or YAML, capped at DefaultImportMaxBytes.

func ParseLimit

func ParseLimit(raw []byte, maxBytes int) (Doc, error)

ParseLimit is Parse with an explicit size cap in bytes.

func (Doc) Validate

func (d Doc) Validate() error

Validate checks an in-memory document the same way Parse checks a file.

type Pack

type Pack struct {
	ID      string `json:"id" yaml:"id"`
	Version string `json:"version" yaml:"version"`
}

Pack records where a imported board came from; stored, not enforced yet.

type Target

type Target struct {
	Kind string `json:"kind" yaml:"kind"`
	Name string `json:"name" yaml:"name"`
}

Target names the app, database or node a widget reads from.

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.

func Templates

func Templates() []Template

Templates returns the built-in starter packs from the embedded YAML files.

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.

Jump to

Keyboard shortcuts

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