github.com/cilium/cilium@v1.16.2/pkg/kvstore/store/metrics.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package store 5 6 import ( 7 "github.com/cilium/cilium/pkg/metrics" 8 "github.com/cilium/cilium/pkg/metrics/metric" 9 ) 10 11 type Metrics struct { 12 KVStoreSyncQueueSize metric.Vec[metric.Gauge] 13 KVStoreSyncErrors metric.Vec[metric.Counter] 14 KVStoreInitialSyncCompleted metric.Vec[metric.Gauge] 15 } 16 17 func MetricsProvider() *Metrics { 18 return &Metrics{ 19 KVStoreSyncQueueSize: metric.NewGaugeVec(metric.GaugeOpts{ 20 Namespace: metrics.Namespace, 21 Subsystem: metrics.SubsystemKVStore, 22 Name: "sync_queue_size", 23 Help: "Number of elements queued for synchronization in the kvstore", 24 }, []string{metrics.LabelScope, metrics.LabelSourceCluster}), 25 KVStoreSyncErrors: metric.NewCounterVec(metric.CounterOpts{ 26 Namespace: metrics.Namespace, 27 Subsystem: metrics.SubsystemKVStore, 28 Name: "sync_errors_total", 29 Help: "Number of times synchronization to the kvstore failed", 30 }, []string{metrics.LabelScope, metrics.LabelSourceCluster}), 31 KVStoreInitialSyncCompleted: metric.NewGaugeVec(metric.GaugeOpts{ 32 Namespace: metrics.Namespace, 33 Subsystem: metrics.SubsystemKVStore, 34 Name: "initial_sync_completed", 35 Help: "Whether the initial synchronization from/to the kvstore has completed", 36 }, []string{metrics.LabelScope, metrics.LabelSourceCluster, metrics.LabelAction}), 37 } 38 }