prometheus

package
v2.11.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package prometheus contains business logic of working with Prometheus.

Index

Constants

View Source
const (

	// BasePrometheusConfigPath - basic path with prometheus config,
	// that user can mount to container.
	BasePrometheusConfigPath = "/srv/prometheus/prometheus.base.yml"
)

Variables

This section is empty.

Functions

func AddInternalServicesToScrape

func AddInternalServicesToScrape(cfg *config.Config, s models.MetricsResolutions, dbaas bool)

AddInternalServicesToScrape adds internal services metrics to scrape targets.

func AddScrapeConfigs

func AddScrapeConfigs(l *logrus.Entry, cfg *config.Config, q *reform.Querier, s *models.MetricsResolutions) error

AddScrapeConfigs wraps addScrapeConfigs for victoriametrics package.

func ScrapeTimeout

func ScrapeTimeout(interval time.Duration) config.Duration

ScrapeTimeout - wraps scrapeTimeout and makes it public for victoriametrics package.

Types

type AlertingRules

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

AlertingRules contains all logic related to alerting rules files.

func NewAlertingRules

func NewAlertingRules() *AlertingRules

NewAlertingRules creates new AlertingRules instance.

func (*AlertingRules) ReadRules

func (s *AlertingRules) ReadRules() (string, error)

ReadRules reads current rules from FS.

func (*AlertingRules) RemoveRulesFile

func (s *AlertingRules) RemoveRulesFile() error

RemoveRulesFile removes rules file from FS.

func (*AlertingRules) ValidateRules

func (s *AlertingRules) ValidateRules(ctx context.Context, rules string) error

ValidateRules validates alerting rules.

func (*AlertingRules) WriteRules

func (s *AlertingRules) WriteRules(rules string) error

WriteRules writes rules to file.

type Service

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

Service is responsible for interactions with Prometheus. It assumes the following:

  • Prometheus APIs (including lifecycle) are accessible;
  • Prometheus configuration and rule files are accessible;
  • promtool is available.

func NewService

func NewService(alertingRules *AlertingRules, configPath string, db *reform.DB, baseURL string) (*Service, error)

NewService creates new service.

func (*Service) IsReady

func (svc *Service) IsReady(ctx context.Context) error

IsReady verifies that Prometheus works.

func (*Service) RequestConfigurationUpdate

func (svc *Service) RequestConfigurationUpdate()

RequestConfigurationUpdate requests Prometheus configuration update.

func (*Service) Run

func (svc *Service) Run(ctx context.Context)

Run runs Prometheus configuration update loop until ctx is canceled.

Jump to

Keyboard shortcuts

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