ruler

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package ruler provides clients for deleting alerting and recording rules from ruler backends (Mimir and Loki) on cluster deletion.

Tenants in this codebase map to Grafana organizations (e.g. "giantswarm"). Use NewMulti to compose multiple backends; it implements Client so callers depend only on the interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// DeleteClusterRulesForTenant deletes all rule namespaces owned by tenantID
	// whose name starts with clusterID (the mimir_namespace_prefix / loki_namespace_prefix
	// set by Alloy, which equals the cluster name).
	// Implementations must be idempotent: a tenant with no matching rules is not an error.
	DeleteClusterRulesForTenant(ctx context.Context, tenantID, clusterID string) error
}

Client deletes recording and alerting rules from a ruler backend.

func NewLoki

func NewLoki(baseURL string, timeout time.Duration) Client

NewLoki returns a Client that targets the Loki ruler at baseURL.

func NewMimir

func NewMimir(baseURL string, timeout time.Duration) Client

NewMimir returns a Client that targets the Mimir ruler at baseURL.

func NewMulti

func NewMulti(clients ...Client) Client

NewMulti returns a Client that fans out to all provided backends. All backends are always attempted; errors are joined so a failure in one does not skip the others.

func NewNoop

func NewNoop() Client

NewNoop returns a Client that does nothing. Use this when the ruler URL is not configured.

Jump to

Keyboard shortcuts

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