model

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Datasource *Datasource         `json:"datasource"`
	State      promRule.AlertState `json:"state"` // commonModel doesn't have pending state
	ActiveAt   commonModel.Time    `json:"activeAt"`
}

type AlertFile

type AlertFile struct {
	Kind               string             `json:"kind,omitempty"`
	CommonLabels       map[string]string  `json:"commonLabels,omitempty"`
	DatasourceSelector DatasourceSelector `json:"datasourceSelector"`
	AlertGroups        []AlertGroup       `json:"groups"`
}

type AlertGroup

type AlertGroup struct {
	Name       string               `json:"name"`
	Interval   commonModel.Duration `json:"interval,omitempty"`
	Limit      int                  `json:"limit,omitempty"`
	RuleAlerts []RuleAlert          `json:"ruleAlerts"`
}

type Alerting

type Alerting struct {
	Name string       `yaml:"name"`
	Type AlertingType `yaml:"type"`
	URL  string       `yaml:"url"`
}

type AlertingFile

type AlertingFile struct {
	Alertings []Alerting `yaml:"alertings"`
}

type AlertingType

type AlertingType string
const (
	AlertingTypeAlertmanager AlertingType = "alertmanager"
)

type ChartOptions

type ChartOptions struct {
	YMax int `json:"yMax,omitempty" yaml:"yMax,omitempty"`
}

type Config

type Config struct {
	Version          string
	DatasourceConfig DatasourceConfig
	UserConfig       UserConfig
}

type Dashboard

type Dashboard struct {
	Title string `json:"title"`
	Rows  []Row  `json:"rows"`
}

dashboard

type Datasource

type Datasource struct {
	Type              DatasourceType `json:"type" yaml:"type"`
	Name              string         `json:"name" yaml:"name"`
	URL               string         `json:"url" yaml:"url"`
	BasicAuth         bool           `json:"basicAuth" yaml:"basicAuth"`
	BasicAuthUser     string         `json:"basicAuthUser" yaml:"basicAuthUser"`
	BasicAuthPassword string         `json:"basicAuthPassword" yaml:"basicAuthPassword"`
	IsMain            bool           `json:"isMain,omitempty" yaml:"isMain,omitempty"`
	IsDiscovered      bool           `json:"isDiscovered,omitempty" yaml:"isDiscovered,omitempty"`
}

type DatasourceConfig

type DatasourceConfig struct {
	QueryTimeout time.Duration `json:"queryTimeout,omitempty" yaml:"queryTimeout,omitempty"`
	Datasources  []Datasource  `json:"datasources" yaml:"datasources,omitempty"`
	Discovery    Discovery     `json:"discovery,omitempty" yaml:"discovery,omitempty"`
}

type DatasourceSelector

type DatasourceSelector struct {
	System DatasourceSystem `json:"system" yaml:"system"`
	Type   DatasourceType   `json:"type" yaml:"type"`
}

type DatasourceSystem

type DatasourceSystem string
const (
	DatasourceSystemNone DatasourceSystem = ""
	DatasourceSystemMain DatasourceSystem = "main"
	DatasourceSystemSub  DatasourceSystem = "sub"
)

type DatasourceType

type DatasourceType string
const (
	DatasourceTypeNone       DatasourceType = ""
	DatasourceTypePrometheus DatasourceType = "prometheus"
	DatasourceTypeLethe      DatasourceType = "lethe"
)

type Discovery

type Discovery struct {
	Enabled          bool   `json:"enabled,omitempty" yaml:"enabled,omitempty"`                   // default: false
	MainNamespace    string `json:"mainNamespace,omitempty" yaml:"mainNamespace,omitempty"`       // default: ”
	AnnotationKey    string `json:"annotationKey,omitempty" yaml:"annotationKey,omitempty"`       // default: kuoss.org/datasource-type
	ByNamePrometheus bool   `json:"byNamePrometheus,omitempty" yaml:"byNamePrometheus,omitempty"` // deprecated
	ByNameLethe      bool   `json:"byNameLethe,omitempty" yaml:"byNameLethe,omitempty"`           // deprecated
}

type EtcUser

type EtcUser struct {
	Username string `yaml:"username"`
	Hash     string `yaml:"hash"`
	IsAdmin  bool   `yaml:"isAdmin,omitempty"`
}

type Fire

type Fire struct {
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
}

type Panel

type Panel struct {
	Title        string        `json:"title" yaml:"title"`
	Type         string        `json:"type" yaml:"type"`
	Headers      []string      `json:"headers,omitempty" yaml:"headers,omitempty"`
	Targets      []Target      `json:"targets" yaml:"targets"`
	ChartOptions *ChartOptions `json:"chartOptions,omitempty" yaml:"chartOptions,omitempty"`
}

type QueryData

type QueryData struct {
	ResultType commonModel.ValueType `json:"resultType"`
	Result     []commonModel.Sample  `json:"result"`
}

type QueryResult

type QueryResult struct {
	Data   QueryData `json:"data"`
	Status string    `json:"status"`
}

type Row

type Row struct {
	Panels []Panel `json:"panels"`
}

type Rule

type Rule struct {
	Record        string               `json:"record,omitempty" yaml:"record,omitempty"`
	Alert         string               `json:"alert,omitempty" yaml:"alert,omitempty"`
	Expr          string               `json:"expr" yaml:"expr"`
	For           commonModel.Duration `json:"for" yaml:"for,omitempty"`
	KeepFiringFor commonModel.Duration `json:"keep_firing_for,omitempty" yaml:"keep_firing_for,omitempty"`
	Labels        map[string]string    `json:"labels,omitempty" yaml:"labels,omitempty"`
	Annotations   map[string]string    `json:"annotations,omitempty" yaml:"annotations,omitempty"`
}

type RuleAlert

type RuleAlert struct {
	Rule   Rule    `json:"rule"`
	Alerts []Alert `json:"alerts"`
}

type RuleFile

type RuleFile struct {
	Kind               string             `json:"kind,omitempty" yaml:"kind,omitempty"`
	CommonLabels       map[string]string  `json:"commonLabels,omitempty" yaml:"commonLabels,omitempty"`
	DatasourceSelector DatasourceSelector `json:"datasourceSelector" yaml:"datasourceSelector"`
	RuleGroups         []RuleGroup        `json:"groups" yaml:"groups"`
}

type RuleGroup

type RuleGroup struct {
	Name     string               `json:"name" yaml:"name"`
	Interval commonModel.Duration `json:"interval,omitempty" yaml:"interval,omitempty"`
	Limit    int                  `json:"limit,omitempty" yaml:"limit,omitempty"`
	Rules    []Rule               `json:"rules" yaml:"rules"`
}

type Target

type Target struct {
	Expr        string      `json:"expr"`
	Legend      string      `json:"legend,omitempty" yaml:"legend,omitempty"`
	Legends     []string    `json:"legends,omitempty" yaml:"legends,omitempty"`
	Unit        string      `json:"unit,omitempty" yaml:"unit,omitempty"`
	Columns     []string    `json:"columns,omitempty" yaml:"columns,omitempty"`
	Headers     []string    `json:"headers,omitempty" yaml:"headers,omitempty"`
	Key         string      `json:"key,omitempty" yaml:"key,omitempty"`
	Thresholds  []Threshold `json:"thresholds,omitempty" yaml:"thresholds,omitempty"`
	Aggregation string      `json:"aggregation,omitempty" yaml:"aggregation,omitempty"`
}

TODO: what Legend, Legends is for?

type Threshold

type Threshold struct {
	Values []int `yaml:"values,omitempty" json:"values,omitempty"`
	Invert bool  `yaml:"invert,omitempty" json:"invert,omitempty"`
}

type User

type User struct {
	ID           int    `gorm:"primaryKey"`
	Username     string `gorm:"index:,unique"`
	Hash         string
	IsAdmin      bool
	Token        string
	TokenExpires time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type UserConfig

type UserConfig struct {
	EtcUsers []EtcUser `yaml:"users"`
}

type VentiVersion

type VentiVersion struct {
	Version   string `json:"version"`
	GoVersion string `json:"goVersion"`
}

Jump to

Keyboard shortcuts

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