diff --git a/pkg/mcs/resourcemanager/server/manager.go b/pkg/mcs/resourcemanager/server/manager.go index 8588c22b9ae..58b8b5426a4 100644 --- a/pkg/mcs/resourcemanager/server/manager.go +++ b/pkg/mcs/resourcemanager/server/manager.go @@ -457,6 +457,7 @@ func (m *Manager) backgroundMetricsFlush(ctx context.Context) { delete(maxPerSecTrackers, r.name) readRequestUnitMaxPerSecCost.DeleteLabelValues(r.name) writeRequestUnitMaxPerSecCost.DeleteLabelValues(r.name) + resourceGroupConfigGauge.DeletePartialMatch(prometheus.Labels{newResourceGroupNameLabel: r.name}) } } case <-availableRUTicker.C: @@ -476,8 +477,10 @@ func (m *Manager) backgroundMetricsFlush(ctx context.Context) { ru = 0 } availableRUCounter.WithLabelValues(group.Name, group.Name).Set(ru) + resourceGroupConfigGauge.WithLabelValues(group.Name, priorityLabel).Set(float64(group.Priority)) + resourceGroupConfigGauge.WithLabelValues(group.Name, ruPerSecLabel).Set(float64(group.RUSettings.RU.Settings.FillRate)) + resourceGroupConfigGauge.WithLabelValues(group.Name, ruCapacityLabel).Set(float64(group.RUSettings.RU.Settings.BurstLimit)) } - case <-recordMaxTicker.C: // Record the sum of RRU and WRU every second. m.RLock() diff --git a/pkg/mcs/resourcemanager/server/metrics.go b/pkg/mcs/resourcemanager/server/metrics.go index 45c94e5c735..6ed4d8ff10a 100644 --- a/pkg/mcs/resourcemanager/server/metrics.go +++ b/pkg/mcs/resourcemanager/server/metrics.go @@ -29,6 +29,11 @@ const ( tiflashTypeLabel = "ap" defaultTypeLabel = "tp" newResourceGroupNameLabel = "resource_group" + + // Labels for the config. + ruPerSecLabel = "ru_per_sec" + ruCapacityLabel = "ru_capacity" + priorityLabel = "priority" ) var ( @@ -116,6 +121,14 @@ var ( Name: "available_ru", Help: "Counter of the available RU for all resource groups.", }, []string{resourceGroupNameLabel, newResourceGroupNameLabel}) + + resourceGroupConfigGauge = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: namespace, + Subsystem: serverSubsystem, + Name: "group_config", + Help: "Config of the resource group.", + }, []string{newResourceGroupNameLabel, typeLabel}) ) func init() { @@ -130,4 +143,5 @@ func init() { prometheus.MustRegister(availableRUCounter) prometheus.MustRegister(readRequestUnitMaxPerSecCost) prometheus.MustRegister(writeRequestUnitMaxPerSecCost) + prometheus.MustRegister(resourceGroupConfigGauge) }