metrics

package
v1.16.0 Latest Latest
Warning

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

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

Documentation

Overview

Package metrics provides naming constants for CSM Replication metrics.

Index

Constants

View Source
const (
	// MetricReplicationPairStatus reports the status of replication pairs.
	// 1 = active, 0 = inactive/unknown.
	MetricReplicationPairStatus = "dell_csm_repl_pair_status"

	// MetricReplicationLagSeconds reports the replication lag in seconds.
	MetricReplicationLagSeconds = "dell_csm_repl_lag_seconds"

	// MetricReplicationBandwidthBytes reports the current replication traffic
	// bandwidth in bytes per second from the storage array.
	MetricReplicationBandwidthBytes = "dell_csm_repl_bandwidth_bytes"

	// MetricReplicationSuccessTotal reports total successful replication operations.
	MetricReplicationSuccessTotal = "dell_csm_repl_success_total"

	// MetricReplicationFailureTotal reports total failed replication operations.
	MetricReplicationFailureTotal = "dell_csm_repl_failure_total"

	// MetricReplicationSuccessRatio reports the ratio of successful replication
	// operations (0.0 to 1.0).
	MetricReplicationSuccessRatio = "dell_csm_repl_success_ratio"

	// MetricReplicationControllerHealth reports the health of the replication controller.
	// 1 = healthy, 0 = unhealthy.
	MetricReplicationControllerHealth = "dell_csm_repl_controller_health"

	// MetricReplicationMetricsStale indicates whether metrics data is stale.
	// 1 = stale, 0 = fresh.
	MetricReplicationMetricsStale = "dell_csm_repl_metrics_stale"

	// MetricReplicationLastCollectionTimestamp reports the last complete collection cycle.
	MetricReplicationLastCollectionTimestamp = "dell_csm_repl_last_collection_timestamp_seconds"
)

Replication metric name constants following the dell_csm_repl_ prefix convention.

View Source
const (
	LabelDriver     = "driver"
	LabelPolicyName = "policy_name"
	LabelStatus     = "status"
	LabelAction     = "action"
)

Label constants used across replication metrics.

View Source
const (
	// MetricSRDFGroupState reports the current SRDF replication state per RDF group.
	// 1=SYNCHRONIZED, 2=SYNC_IN_PROGRESS, 3=SUSPENDED, 4=FAILEDOVER, 0=UNKNOWN/EMPTY.
	MetricSRDFGroupState = "dell_powermax_srdf_group_state"

	// MetricSRDFLagSeconds reports the SRDF replication lag in seconds between R1 and R2.
	MetricSRDFLagSeconds = "dell_powermax_srdf_lag_seconds"

	// MetricSRDFBandwidthBytes reports the SRDF replication bandwidth in bytes per second.
	MetricSRDFBandwidthBytes = "dell_powermax_srdf_bandwidth_bytes_per_sec"

	// MetricSRDFLinkStatus reports the active/inactive status of the RDF group link.
	// 1=active, 0=inactive.
	MetricSRDFLinkStatus = "dell_powermax_srdf_link_status"
)

PowerMax-specific SRDF metric name constants. Exposed on the same replication metrics endpoint (port 8445) with explicit rdf_group and mode labels to satisfy the per-RDF-group requirement.

View Source
const (
	LabelRGName   = "rg_name"
	LabelRDFGroup = "rdf_group"
	LabelMode     = "mode"
)

SRDF-specific label constants.

Variables

This section is empty.

Functions

func ParseSRDFGroupInfo

func ParseSRDFGroupInfo(protectionGroupID string) (rdfGroup, mode string)

ParseSRDFGroupInfo extracts the RDF group number and replication mode from a PowerMax SRDF protection group ID (format: csi-rep-sg-{namespace}-{rdfGroup}-{mode}). Returns empty strings for non-PowerMax SRDF protection group IDs.

func SetGlobalReplicationMetrics

func SetGlobalReplicationMetrics(m *ReplicationMetrics)

SetGlobalReplicationMetrics sets the global ReplicationMetrics singleton.

func SetGlobalSRDFMetrics

func SetGlobalSRDFMetrics(m *SRDFMetrics)

SetGlobalSRDFMetrics sets the global SRDFMetrics singleton.

Types

type ReplicationMetrics

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

ReplicationMetrics holds Prometheus metric vectors for CSM Replication.

func GetGlobalReplicationMetrics

func GetGlobalReplicationMetrics() *ReplicationMetrics

GetGlobalReplicationMetrics returns the global ReplicationMetrics singleton, or nil if not initialized.

func NewReplicationMetrics

func NewReplicationMetrics(registry *prometheus.Registry) *ReplicationMetrics

NewReplicationMetrics creates and registers all replication metrics with the given registry.

func (*ReplicationMetrics) RecordAction

func (m *ReplicationMetrics) RecordAction(driver, action, status string)

RecordAction records a replication action result and updates the success ratio.

func (*ReplicationMetrics) SetBandwidthBytes

func (m *ReplicationMetrics) SetBandwidthBytes(driver, policyName string, bw float64)

SetBandwidthBytes sets the replication bandwidth in bytes per second.

func (*ReplicationMetrics) SetControllerHealth

func (m *ReplicationMetrics) SetControllerHealth(driver string, healthy bool)

SetControllerHealth sets the controller health gauge.

func (*ReplicationMetrics) SetLagSeconds

func (m *ReplicationMetrics) SetLagSeconds(driver, policyName string, lag float64)

SetLagSeconds sets the replication lag in seconds.

func (*ReplicationMetrics) SetLastCollectionTimestamp

func (m *ReplicationMetrics) SetLastCollectionTimestamp(driver string, timestamp float64)

SetLastCollectionTimestamp records when a complete monitoring cycle finished.

func (*ReplicationMetrics) SetMetricsStale

func (m *ReplicationMetrics) SetMetricsStale(driver string, stale bool)

SetMetricsStale marks the per-driver metrics as stale (1) or fresh (0). Call with stale=true when the monitoring loop fails to update metrics, and stale=false when metrics are successfully refreshed.

func (*ReplicationMetrics) SetPairStatus

func (m *ReplicationMetrics) SetPairStatus(driver, policyName, status string, active bool)

SetPairStatus sets the status gauge for a replication pair.

When the status label transitions (e.g. SYNCHRONIZED → SUSPENDED), the previous label combination is deleted from the GaugeVec so that stale series do not interfere with max-by / min-by Prometheus alert expressions. Without deletion, the old {status="SYNCHRONIZED", value=1} series would linger for up to 5 minutes, causing max by (driver, policy_name)(dell_csm_repl_pair_status) to always return 1 even after the pair becomes inactive.

type SRDFMetrics

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

SRDFMetrics holds Prometheus metric vectors for PowerMax SRDF replication. These provide per-RDF-group granularity with explicit rdf_group and mode labels, covering the PowerMax-specific metrics section of the observability spec.

func GetGlobalSRDFMetrics

func GetGlobalSRDFMetrics() *SRDFMetrics

GetGlobalSRDFMetrics returns the global SRDFMetrics singleton, or nil if not initialized.

func NewSRDFMetrics

func NewSRDFMetrics(registry *prometheus.Registry) *SRDFMetrics

NewSRDFMetrics creates and registers all SRDF metrics with the given registry.

func (*SRDFMetrics) DeleteGroup

func (m *SRDFMetrics) DeleteGroup(driver, rgName, rdfGroup, mode string)

DeleteGroup removes all SRDF metric label sets for a replication group, preventing stale metrics from persisting after an RG is removed.

func (*SRDFMetrics) SetBandwidth

func (m *SRDFMetrics) SetBandwidth(driver, rgName, rdfGroup, mode string, bw float64)

SetBandwidth sets the SRDF replication bandwidth metric for the given replication group.

func (*SRDFMetrics) SetGroupState

func (m *SRDFMetrics) SetGroupState(driver, rgName, rdfGroup, mode, state string)

SetGroupState sets the SRDF group state metric for the given replication group.

func (*SRDFMetrics) SetLagSeconds

func (m *SRDFMetrics) SetLagSeconds(driver, rgName, rdfGroup, mode string, lag float64)

SetLagSeconds sets the SRDF replication lag metric for the given replication group.

Jump to

Keyboard shortcuts

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