metrics

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RootShardResourceType   = "rootshard"
	ShardResourceType       = "shard"
	FrontProxyResourceType  = "frontproxy"
	CacheServerResourceType = "cacheserver"
	KubeconfigResourceType  = "kubeconfig"
)
View Source
const (
	UnknownPhase = "Unknown"
)

Variables

View Source
var (
	// RootShardCount tracks the number of RootShard objects by their current phase.
	// Labels: phase (Provisioning|Running|Deleting), namespace
	RootShardCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "kcp_operator_rootshard_count",
			Help: "Number of RootShard objects by phase",
		},
		[]string{"phase", "namespace"},
	)

	// ShardCount tracks the number of Shard objects by their current phase.
	// Labels: phase (Provisioning|Running|Deleting), namespace
	ShardCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "kcp_operator_shard_count",
			Help: "Number of Shard objects by phase",
		},
		[]string{"phase", "namespace"},
	)

	// FrontProxyCount tracks the number of FrontProxy objects by their current phase.
	// Labels: phase (Provisioning|Running|Deleting), namespace
	FrontProxyCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "kcp_operator_frontproxy_count",
			Help: "Number of FrontProxy objects by phase",
		},
		[]string{"phase", "namespace"},
	)

	// CacheServerCount tracks the number of CacheServer objects by namespace.
	// Labels: namespace
	CacheServerCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "kcp_operator_cacheserver_count",
			Help: "Number of CacheServer objects by namespace",
		},
		[]string{"namespace"},
	)

	// KubeconfigCount tracks the number of Kubeconfig objects by namespace.
	// Labels: namespace
	KubeconfigCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "kcp_operator_kubeconfig_count",
			Help: "Number of Kubeconfig objects by namespace",
		},
		[]string{"namespace"},
	)

	// ReconciliationDuration measures the time taken to reconcile kcp operator resources.
	// Labels: controller (rootshard|shard|frontproxy|kubeconfig|cacheserver), result (success|error)
	ReconciliationDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "kcp_operator_reconciliation_duration_seconds",
			Help:    "Time taken to reconcile objects",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"controller", "result"},
	)

	// ReconciliationErrors counts the total number of reconciliation errors by controller and error type.
	// Labels: controller (rootshard|shard|frontproxy|kubeconfig|cacheserver), error_type
	ReconciliationErrors = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "kcp_operator_reconciliation_errors_total",
			Help: "Total number of reconciliation errors",
		},
		[]string{"controller", "error_type"},
	)

	// ConditionStatus tracks the status of conditions on kcp operator resources.
	// Values: 1.0 (True), 0.0 (False), -1.0 (Unknown)
	// Labels: resource_type (rootshard|shard|frontproxy|cacheserver|kubeconfig),
	//         resource_name, namespace, condition_type (Available|RootShard)
	ConditionStatus = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "kcp_operator_condition_status",
			Help: "Status of conditions",
		},
		[]string{"resource_type", "resource_name", "namespace", "condition_type"},
	)
)

Functions

func RecordReconciliationError

func RecordReconciliationError(controller, errorType string)

RecordReconciliationError records a specific reconciliation error

func RecordReconciliationMetrics

func RecordReconciliationMetrics(controller string, duration float64, err error)

RecordReconciliationMetrics records reconciliation duration and error metrics

func RegisterMetrics

func RegisterMetrics()

Types

type MetricsCollector

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

func NewMetricsCollector

func NewMetricsCollector(client ctrlruntimeclient.Client) *MetricsCollector

func (*MetricsCollector) Start

func (mc *MetricsCollector) Start(ctx context.Context)

Jump to

Keyboard shortcuts

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