dashboards

package
v1.5.10 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 9 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"
)

Dashboard scopes, target kinds and widget types, matching schema.json.

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

This section is empty.

Types

type Doc

type Doc struct {
	Version        int      `json:"version"`
	Name           string   `json:"name"`
	Description    string   `json:"description,omitempty"`
	TimeRange      string   `json:"time_range,omitempty"`
	RefreshSeconds int      `json:"refresh_seconds,omitempty"`
	Widgets        []Widget `json:"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.

func (Doc) Validate

func (d Doc) Validate() error

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

type Target

type Target struct {
	Kind string `json:"kind"`
	Name string `json:"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"`
}

Template is a one-click starter dashboard; the picker fills the empty target names of NeedsTarget kind.

func Templates

func Templates() []Template

Templates returns the built-in starters.

type Widget

type Widget struct {
	ID     string  `json:"id"`
	Type   string  `json:"type"`
	Title  string  `json:"title,omitempty"`
	Size   string  `json:"size"`
	Target *Target `json:"target,omitempty"`
	Metric string  `json:"metric,omitempty"`
	Query  string  `json:"query,omitempty"`
	URL    string  `json:"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