diff --git a/pkg/mcs/resourcemanager/server/manager.go b/pkg/mcs/resourcemanager/server/manager.go index 2462a4f1f64..f71623ae0cd 100644 --- a/pkg/mcs/resourcemanager/server/manager.go +++ b/pkg/mcs/resourcemanager/server/manager.go @@ -48,11 +48,6 @@ const ( reservedDefaultGroupName = "default" middlePriority = 8 - - // Labels for the metrics. - ruPerSec = "ru_per_sec" - ruCapacity = "ru_capacity" - priority = "priority" ) // Manager is the manager of resource group. @@ -478,9 +473,9 @@ func (m *Manager) backgroundMetricsFlush(ctx context.Context) { ru = 0 } availableRUCounter.WithLabelValues(group.Name, group.Name).Set(ru) - resourceGroupConfigGauge.WithLabelValues(group.Name, priority).Set(float64(group.Priority)) - resourceGroupConfigGauge.WithLabelValues(group.Name, ruPerSec).Set(float64(group.RUSettings.RU.Settings.FillRate)) - resourceGroupConfigGauge.WithLabelValues(group.Name, ruCapacity).Set(float64(group.RUSettings.RU.Settings.BurstLimit)) + 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. diff --git a/pkg/mcs/resourcemanager/server/metrics.go b/pkg/mcs/resourcemanager/server/metrics.go index 5faffcf1018..766ca841268 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 ( @@ -131,7 +136,7 @@ var ( Subsystem: serverSubsystem, Name: "group_config", Help: "Config of the resource group.", - }, []string{newResourceGroupNameLabel, "type"}) + }, []string{newResourceGroupNameLabel, typeLabel}) ) func init() {