modules

package
v0.0.0-...-b9dc9a6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugNotifyFunc

func DebugNotifyFunc(logger log.Logger) rules.NotifyFunc

DebugNotifyFunc

func HTTPNotifyFunc

func HTTPNotifyFunc(logger log.Logger, token string, url string, retries int) rules.NotifyFunc

HTTPNotifyFunc

func HTTPQueryFunc

func HTTPQueryFunc(logger log.Logger, url string) rules.QueryFunc

HTTPQueryFunc TODO: use http keep-alive

func NewMockStorage

func NewMockStorage() (storage.Storage, error)

NewMockStorage create temporary storage

Types

type Alert

type Alert rules.Alert

Alert

func (*Alert) MarshalJSON

func (a *Alert) MarshalJSON() ([]byte, error)

MarshalJSON ...

type Config

type Config struct {
	NotifyReties       int
	GatewayURL         string
	GatewayPathRule    string
	GatewayPathProm    string
	GatewayPathNotify  string
	EvaluationInterval model.Duration
	ReloadInterval     model.Duration
	AuthToken          string

	PromlogConfig promlog.Config
}

Config ...

type M

type M map[string]interface{}

M is map

type Manager

type Manager struct {
	Config  Config
	Prom    Prom
	Options *rules.ManagerOptions
	Manager *rules.Manager
	Rules   Rules
	// contains filtered or unexported fields
}

Manager ...

func NewManager

func NewManager(ctx context.Context, logger log.Logger,
	prom Prom, config Config) (*Manager, error)

NewManager ...

func (*Manager) Run

func (m *Manager) Run()

Run ...

func (*Manager) Stop

func (m *Manager) Stop()

Stop ...

func (*Manager) Update

func (m *Manager) Update(rules Rules) error

Update ...

type MockStorage

type MockStorage struct {
	storage.Storage
	// contains filtered or unexported fields
}

MockStorage temporary storage

func (MockStorage) Close

func (s MockStorage) Close() error

Close delete temporary files when closed

type Prom

type Prom struct {
	ID  int64
	URL string
}

Prom ...

type PromRules

type PromRules struct {
	Prom  Prom
	Rules Rules
}

PromRules ...

type PromsResp

type PromsResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data []Prom `json:"data"`
}

PromsResp ...

type Reloader

type Reloader struct {
	// contains filtered or unexported fields
}

Reloader ...

func NewReloader

func NewReloader(logger log.Logger, cfg Config) *Reloader

NewReloader ...

func (*Reloader) Loop

func (r *Reloader) Loop()

Loop for checking the rules

func (*Reloader) Run

func (r *Reloader) Run()

Run rule manager

func (*Reloader) Stop

func (r *Reloader) Stop()

Stop rule manager

func (*Reloader) Update

func (r *Reloader) Update() error

download the rules and update rule manager

type Rule

type Rule struct {
	ID          int64             `json:"id"`
	PromID      int64             `json:"prom_id"`
	Expr        string            `json:"expr"`
	Op          string            `json:"op"`
	Value       string            `json:"value"`
	For         string            `json:"for"`
	Labels      map[string]string `json:"labels"`
	Summary     string            `json:"summary"`
	Description string            `json:"description"`
}

Rule ...

type Rules

type Rules []Rule

Rules ...

func (Rules) Content

func (r Rules) Content() ([]byte, error)

Content get prom rules

func (Rules) PromRules

func (r Rules) PromRules() []PromRules

PromRules cut prom rules

type RulesResp

type RulesResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data Rules  `json:"data"`
}

RulesResp ...

type S

type S []interface{}

S is slice

Jump to

Keyboard shortcuts

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