config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = Config{
		GraphName: "promviz",
	}

	DefaultNodeMapping = NodeMapping{
		Label:       "",
		Regex:       MustNewRegexp("(.*)"),
		Replacement: "$1",
		Class:       "default",
	}

	DefaultClass = Class{
		Name:  "default",
		Color: "rgb(186, 213, 237)",
	}
)

Functions

This section is empty.

Types

type Class

type Class struct {
	Name  string `yaml:"name"`
	Color string `yaml:"color,omitempty"`
}

type Cluster

type Cluster struct {
	Cluster     string        `yaml:"cluster"`
	MaxVolume   float64       `yaml:"maxVolume,omitempty"`
	Connections []*Connection `yaml:"serviceConnections,omitempty"`
	NodeNotices []*NodeNotice `yaml:"serviceNotices,omitempty"`
}

type Config

type Config struct {
	GraphName    string      `yaml:"graphName"`
	GlobalLevel  GlobalLevel `yaml:"globalLevel"`
	ClusterLevel []*Cluster  `yaml:"clusterLevel"`
	Classes      []*Class    `yaml:"classes,omitempty"`
}

func LoadFile

func LoadFile(path string) (*Config, error)

type Connection

type Connection struct {
	Query         string              `yaml:"query,omitempty"`
	PrometheusURL string              `yaml:"prometheusURL,omitempty"`
	Source        *NodeMapping        `yaml:"source,omitempty"`
	Target        *NodeMapping        `yaml:"target,omitempty"`
	Status        *Status             `yaml:"status,omitempty"`
	Notices       []*ConnectionNotice `yaml:"notices,omitempty"`
}
func (c *Connection) QueryLink() string

type ConnectionNotice

type ConnectionNotice struct {
	Title             string            `yaml:"title"`
	SubTitle          string            `yaml:"subtitle"`
	Link              string            `yaml:"link"`
	StatusType        string            `yaml:"statusType"`
	SeverityThreshold SeverityThreshold `yaml:"severityThreshold"`
}

type GlobalLevel

type GlobalLevel struct {
	MaxVolume   float64       `yaml:"maxVolume,omitempty"`
	Connections []*Connection `yaml:"clusterConnections,omitempty"`
}

type NodeMapping

type NodeMapping struct {
	Label       string `yaml:"label,omitempty"`
	Regex       Regexp `yaml:"regex,omitempty"`
	Replacement string `yaml:"replacement,omitempty"`
	Class       string `yaml:"class,omitempty"`
}

func (*NodeMapping) UnmarshalYAML

func (nm *NodeMapping) UnmarshalYAML(unmarshal func(interface{}) error) error

type NodeNotice

type NodeNotice struct {
	Title             string            `yaml:"title"`
	SubTitle          string            `yaml:"subtitle"`
	Link              string            `yaml:"link"`
	Query             string            `yaml:"query,omitempty"`
	PrometheusURL     string            `yaml:"prometheusURL,omitempty"`
	SeverityThreshold SeverityThreshold `yaml:"severityThreshold"`
	Service           *NodeMapping      `yaml:"service,omitempty"`
}
func (nn *NodeNotice) QueryLink() string

type Regexp

type Regexp struct {
	*regexp.Regexp
	Original string
}

func MustNewRegexp

func MustNewRegexp(s string) Regexp

func NewRegexp

func NewRegexp(s string) (Regexp, error)

func (*Regexp) UnmarshalYAML

func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error

type SeverityThreshold

type SeverityThreshold struct {
	Info    float64 `yaml:"info,omitempty"`
	Warning float64 `yaml:"warning,omitempty"`
	Error   float64 `yaml:"error,omitempty"`
}

type Status

type Status struct {
	Label        string  `yaml:"label"`
	WarningRegex *Regexp `yaml:"warningRegex,omitempty"`
	DangerRegex  *Regexp `yaml:"dangerRegex,omitempty"`
}

Jump to

Keyboard shortcuts

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