model

package
v0.2.20 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 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 AlertingConfig added in v0.2.8

type AlertingConfig struct {
	EvaluationInterval  time.Duration       `yaml:"evaluation_interval,omitempty"`
	AlertRelabelConfigs []*relabel.Config   `yaml:"alert_relabel_configs,omitempty"`
	AlertmanagerConfigs AlertmanagerConfigs `yaml:"alertmanagers,omitempty"`
	GlobalLabels        map[string]string   `yaml:"globalLabels,omitempty"`
}

type AlertingConfigFile added in v0.2.8

type AlertingConfigFile struct {
	AlertingConfig AlertingConfig `yaml:"alerting,omitempty"`
}

type AlertmanagerConfig added in v0.2.8

type AlertmanagerConfig struct {
	StaticConfig []*TargetGroup `yaml:"static_configs,omitempty"`
}

type AlertmanagerConfigs added in v0.2.8

type AlertmanagerConfigs []*AlertmanagerConfig

AlertmanagerConfigs is a slice of *AlertmanagerConfig.

type AppInfo added in v0.2.18

type AppInfo struct {
	Version string
}

type ChartOptions

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

type Config

type Config struct {
	AppInfo          AppInfo
	GlobalConfig     GlobalConfig
	DatasourceConfig DatasourceConfig
	UserConfig       UserConfig
	AlertingConfig   AlertingConfig
}

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 GlobalConfig added in v0.2.8

type GlobalConfig struct {
	GinMode  string `yaml:"ginMode,omitempty"`
	LogLevel string `yaml:"logLevel,omitempty"`
}

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 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           time.Duration     `json:"for" yaml:"for,omitempty"`
	KeepFiringFor time.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 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 time.Duration `json:"interval,omitempty" yaml:"interval,omitempty"`
	Limit    int           `json:"limit,omitempty" yaml:"limit,omitempty"`
	Rules    []Rule        `json:"rules" yaml:"rules"`
}

https://github.com/prometheus/prometheus/blob/v2.43.0/model/rulefmt/rulefmt.go#L137

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 TargetGroup added in v0.2.8

type TargetGroup struct {
	Targets []string             `yaml:"targets"`
	Labels  commonModel.LabelSet `yaml:"labels,omitempty"`
}

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"`
}

Jump to

Keyboard shortcuts

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