metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

Metrics represents metrics associated with the operator.

func NewMetrics

func NewMetrics() *Metrics

NewMetrics initializes operator metrics and registers them with the controller-runtime registry.

func (*Metrics) Collect

func (m *Metrics) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*Metrics) Describe

func (m *Metrics) Describe(ch chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

func (*Metrics) PersesInstances

func (m *Metrics) PersesInstances(namespace string) prometheus.Gauge

PersesInstances returns a gauge to track Perses instance count.

func (*Metrics) Ready

func (m *Metrics) Ready(controller string) prometheus.Gauge

Ready returns a gauge to track operator readiness for the given controller.

func (*Metrics) ReconcileErrors

func (m *Metrics) ReconcileErrors(controller, reason string) prometheus.Counter

ReconcileErrors returns a counter to track reconciliation errors.

func (*Metrics) ReconcileOperations

func (m *Metrics) ReconcileOperations(controller string) prometheus.Counter

ReconcileOperations returns a counter to track total reconciliation operations.

func (*Metrics) SetFailedResources

func (m *Metrics) SetFailedResources(objKey, resource string, v int)

SetFailedResources sets the number of resources that failed to sync for the given object's key.

func (*Metrics) SetSyncedResources

func (m *Metrics) SetSyncedResources(objKey, resource string, v int)

SetSyncedResources sets the number of resources that synced successfully for the given object's key.

type ReconciliationStatus

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

ReconciliationStatus represents the status of a reconciliation operation.

func (ReconciliationStatus) Message

func (rs ReconciliationStatus) Message() string

Message returns the reconciliation message.

func (ReconciliationStatus) Ok

func (rs ReconciliationStatus) Ok() bool

Ok returns true if the reconciliation was successful.

func (ReconciliationStatus) Reason

func (rs ReconciliationStatus) Reason() string

Reason returns the reconciliation reason.

type ReconciliationTracker

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

ReconciliationTracker tracks reconciliation status per object.

It uses the namespace/name key to identify objects.

func NewReconciliationTracker

func NewReconciliationTracker(reg prometheus.Registerer) *ReconciliationTracker

NewReconciliationTracker creates a new ReconciliationTracker and registers it with the metrics registry.

func (*ReconciliationTracker) Collect

func (rt *ReconciliationTracker) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*ReconciliationTracker) Describe

func (rt *ReconciliationTracker) Describe(ch chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

func (*ReconciliationTracker) ForgetObject

func (rt *ReconciliationTracker) ForgetObject(key string)

ForgetObject removes the given object from the tracker. It should be called when the controller detects that the object has been deleted.

func (*ReconciliationTracker) GetStatus

GetStatus returns the last reconciliation status for the given object. The second value indicates whether the object is known or not.

func (*ReconciliationTracker) SetReasonAndMessage

func (rt *ReconciliationTracker) SetReasonAndMessage(key string, reason, message string)

SetReasonAndMessage updates the reason and message for the object identified by key. The reason and message are only used when the reconciliation returned no error.

func (*ReconciliationTracker) SetStatus

func (rt *ReconciliationTracker) SetStatus(key string, err error)

SetStatus updates the last reconciliation status for the object identified by key.

Jump to

Keyboard shortcuts

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