configs

package
v0.0.0-...-54ca42f Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	URL     *url.URL
	Timeout time.Duration
}

API allows retrieving Cortex configs.

func (*API) GetOrgConfigs

func (c *API) GetOrgConfigs(since ConfigID) (*CortexConfigsResponse, error)

GetOrgConfigs returns all Cortex configurations from a configs API server that have been updated after the given ConfigID was last updated.

type ConfigID

type ConfigID int

A ConfigID is the ID of a single organization's Cortex configuration.

type CortexConfig

type CortexConfig struct {
	// RulesFiles maps from a rules filename to file contents.
	RulesFiles         map[string]string `json:"rules_files"`
	AlertmanagerConfig string            `json:"alertmanager_config"`
}

A CortexConfig is a Cortex configuration for a single organization.

func (CortexConfig) GetAlertmanagerConfig

func (c CortexConfig) GetAlertmanagerConfig() (*config.Config, error)

GetAlertmanagerConfig returns the Alertmanager config from the Cortex configuration.

func (CortexConfig) GetRules

func (c CortexConfig) GetRules() ([]rules.Rule, error)

GetRules gets the rules from the Cortex configuration.

Strongly inspired by `loadGroups` in Prometheus.

type CortexConfigView

type CortexConfigView struct {
	ConfigID ConfigID     `json:"id"`
	Config   CortexConfig `json:"config"`
}

CortexConfigView is what's returned from the Weave Cloud configs service when we ask for all Cortex configurations.

The configs service is essentially a JSON blob store that gives each _version_ of a configuration a unique ID and guarantees that later versions have greater IDs.

type CortexConfigsResponse

type CortexConfigsResponse struct {
	// Configs maps organization ID to their latest CortexConfigView.
	Configs map[string]CortexConfigView `json:"configs"`
}

CortexConfigsResponse is a response from server for GetOrgConfigs.

func (CortexConfigsResponse) GetLatestConfigID

func (c CortexConfigsResponse) GetLatestConfigID() ConfigID

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

Jump to

Keyboard shortcuts

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