client

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetRules returns all Cortex configurations from a configs API server
	// that have been updated after the given userconfig.ID was last updated.
	GetRules(ctx context.Context, since userconfig.ID) (map[string]userconfig.VersionedRulesConfig, error)

	// GetAlerts fetches all the alerts that have changes since since.
	GetAlerts(ctx context.Context, since userconfig.ID) (*ConfigsResponse, error)
}

Client is what the ruler and altermanger needs from a config store to process rules.

type Config

type Config struct {
	ConfigsAPIURL flagext.URLValue     `yaml:"configs_api_url"`
	ClientTimeout time.Duration        `yaml:"client_timeout"` // HTTP timeout duration for requests made to the Weave Cloud configs service.
	TLS           tls_cfg.ClientConfig `yaml:",inline"`
}

Config says where we can find the ruler userconfig.

func (*Config) RegisterFlagsWithPrefix added in v0.6.0

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet

type ConfigDBClient added in v0.6.0

type ConfigDBClient struct {
	URL       *url.URL
	Timeout   time.Duration
	TLSConfig *tls.Config
}

ConfigDBClient allows retrieving recording and alerting rules from the configs server.

func New

func New(cfg Config) (*ConfigDBClient, error)

New creates a new ConfigClient.

func (ConfigDBClient) GetAlerts added in v0.6.0

func (c ConfigDBClient) GetAlerts(ctx context.Context, since userconfig.ID) (*ConfigsResponse, error)

GetAlerts implements Client.

func (ConfigDBClient) GetRules added in v0.6.0

GetRules implements Client

type ConfigsResponse

type ConfigsResponse struct {

	// Configs maps user ID to their latest userconfig.View.
	Configs map[string]userconfig.View `json:"configs"`
	// contains filtered or unexported fields
}

ConfigsResponse is a response from server for Getuserconfig.

func (ConfigsResponse) GetLatestConfigID

func (c ConfigsResponse) GetLatestConfigID() userconfig.ID

GetLatestConfigID returns the last config ID from a set of userconfig.

Jump to

Keyboard shortcuts

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