dashboards

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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"
)

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