alert

package
v0.0.0-...-a76d8a2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	OperatorConfigMapName = "ocs-client-operator-config"
	DefaultPollInterval   = 1 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector exposes alerts fetched from the storage provider as Prometheus metrics. Each firing provider-side alert becomes a gauge:

ocs_client_alert{alert_name="X", severity="Y", storage_client="Z", ...} = value

The "alertname" key from the provider labels is renamed to "alert_name" to avoid conflicting with Prometheus' reserved alertname label.

Describe sends no descriptors so the collector is registered as "unchecked", which allows dynamic label sets per alert.

func NewCollector

func NewCollector(ca *Runnable) *Collector

NewCollector creates a collector that reads from ca's in-memory alert cache.

func (*Collector) Collect

func (c *Collector) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*Collector) Describe

func (c *Collector) Describe(chan<- *prometheus.Desc)

Describe implements prometheus.Collector. Empty on purpose -- signals an unchecked collector to the registry because label names vary per alert.

type ResourceCollector

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

ResourceCollector exposes resource counts and upgrade status as Prometheus metrics. It reads from the controller-runtime cache (cached client) during each Prometheus scrape, so no background polling loop is needed.

func NewResourceCollector

func NewResourceCollector(c client.Client, operatorNamespace string) *ResourceCollector

NewResourceCollector creates a collector that counts CephFS PVs, ODF VolumeGroupSnapshotContent resources, and checks upgrade status.

func (*ResourceCollector) Collect

func (c *ResourceCollector) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*ResourceCollector) Describe

func (c *ResourceCollector) Describe(chan<- *prometheus.Desc)

Describe implements prometheus.Collector. Empty on purpose -- unchecked collector.

type Runnable

type Runnable struct {
	client.Client
	// contains filtered or unexported fields
}

Runnable is a manager.Runnable that periodically fetches firing alerts from the storage provider for each connected StorageClient.

func NewRunnable

func NewRunnable(c client.Client, namespace string, logger logr.Logger, pollInterval time.Duration) *Runnable

NewRunnable creates a new alert Runnable.

func (*Runnable) GetAllAlerts

func (ca *Runnable) GetAllAlerts() map[string][]*pb.AlertInfo

GetAllAlerts returns all currently cached alerts keyed by StorageClient name.

func (*Runnable) GetPollInterval

func (ca *Runnable) GetPollInterval() time.Duration

GetPollInterval atomically reads the poll interval.

func (*Runnable) SetPollInterval

func (ca *Runnable) SetPollInterval(d time.Duration)

SetPollInterval atomically updates the poll interval.

func (*Runnable) Start

func (ca *Runnable) Start(ctx context.Context) error

Start implements manager.Runnable. It periodically polls for client alerts.

Jump to

Keyboard shortcuts

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