reloader

package
v0.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package reloader contains helpers to trigger reloads of Prometheus instances on configuration changes and to substitute environment variables in config files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReloadURLFromBase

func ReloadURLFromBase(u *url.URL) *url.URL

ReloadURLFromBase returns the standard Prometheus reload URL from its base URL.

Types

type Reloader

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

Reloader can watch config files and trigger reloads of a Prometheus server. It optionally substitutes environment variables in the configuration. Referenced environment variables must be of the form `$(var)` (not `$var` or `${var}`).

func New

func New(logger log.Logger, reloadURL *url.URL, cfgFile string, cfgEnvsubstFile string, ruleDir string) *Reloader

New creates a new reloader that watches the given config file and rule directory and triggers a Prometheus reload upon changes. If cfgEnvsubstFile is not empty, environment variables in the config file will be substituted and the out put written into the given path. Prometheus should then use cfgEnvsubstFile as its config file path.

func (*Reloader) Watch

func (r *Reloader) Watch(ctx context.Context) error

Watch starts to watch the config file and rules and process them until the context gets canceled. Config file gets env expanded if cfgEnvsubstFile is specified and reload is trigger if config or rules changed.

Jump to

Keyboard shortcuts

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