client

package
v0.0.0-...-ba40f9b Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: AGPL-3.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResourceNotFound = errors.New("requested resource not found")
)

Functions

func GetBlockMeta

func GetBlockMeta(blockDir string) (block.Meta, error)

GetBlockMeta reads meta.json file, and adds (or replaces) thanos.files section with list of local files from the local block.

func UserAgent

func UserAgent() string

UserAgent returns build information in format suitable to be used in HTTP User-Agent header.

Types

type Config

type Config struct {
	User            string `yaml:"user"`
	Key             string `yaml:"key"`
	Address         string `yaml:"address"`
	ID              string `yaml:"id"`
	TLS             tls.ClientConfig
	UseLegacyRoutes bool              `yaml:"use_legacy_routes"`
	MimirHTTPPrefix string            `yaml:"mimir_http_prefix"`
	AuthToken       string            `yaml:"auth_token"`
	ExtraHeaders    map[string]string `yaml:"extra_headers"`
}

Config is used to configure a MimirClient.

type MimirClient

type MimirClient struct {
	Client http.Client
	// contains filtered or unexported fields
}

MimirClient is a client to the Mimir API.

func New

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

New returns a new MimirClient.

func (*MimirClient) Backfill

func (c *MimirClient) Backfill(ctx context.Context, blocks []string, sleepTime time.Duration) error

func (*MimirClient) CreateAlertmanagerConfig

func (r *MimirClient) CreateAlertmanagerConfig(ctx context.Context, cfg string, templates map[string]string) error

CreateAlertmanagerConfig creates a new alertmanager config

func (*MimirClient) CreateRuleGroup

func (r *MimirClient) CreateRuleGroup(ctx context.Context, namespace string, rg rwrulefmt.RuleGroup) error

CreateRuleGroup creates a new rule group

func (*MimirClient) DeleteAlermanagerConfig

func (r *MimirClient) DeleteAlermanagerConfig(ctx context.Context) error

DeleteAlermanagerConfig deletes the users alertmanagerconfig

func (*MimirClient) DeleteNamespace

func (r *MimirClient) DeleteNamespace(ctx context.Context, namespace string) error

DeleteNamespace delete all the rule groups in a namespace including the namespace itself

func (*MimirClient) DeleteRuleGroup

func (r *MimirClient) DeleteRuleGroup(ctx context.Context, namespace, groupName string) error

DeleteRuleGroup deletes a rule group

func (*MimirClient) GetAlertmanagerConfig

func (r *MimirClient) GetAlertmanagerConfig(ctx context.Context) (string, map[string]string, error)

GetAlertmanagerConfig retrieves a Mimir cluster's Alertmanager config.

func (*MimirClient) GetRuleGroup

func (r *MimirClient) GetRuleGroup(ctx context.Context, namespace, groupName string) (*rwrulefmt.RuleGroup, error)

GetRuleGroup retrieves a rule group

func (*MimirClient) ListRules

func (r *MimirClient) ListRules(ctx context.Context, namespace string) (map[string][]rwrulefmt.RuleGroup, error)

ListRules retrieves a rule group

func (*MimirClient) Query

func (r *MimirClient) Query(ctx context.Context, query string) (*http.Response, error)

Query executes a PromQL query against the Mimir cluster.

Jump to

Keyboard shortcuts

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