Skip to content

Commit

Permalink
Merge pull request #3987 from HivenOu/master
Browse files Browse the repository at this point in the history
Standardize metrics help message
  • Loading branch information
karmada-bot committed Aug 24, 2023
2 parents c3bc284 + aad7b0b commit 5e8a765
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions pkg/metrics/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ const (
var (
findMatchedPolicyDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: resourceMatchPolicyDurationMetricsName,
Help: "Duration in seconds to find a matched propagation policy for the resource template.",
Help: "Duration in seconds to find a matched PropagationPolicy or ClusterPropagationPolicy for the resource templates.",
Buckets: prometheus.ExponentialBuckets(0.001, 2, 12),
}, []string{})

applyPolicyDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: resourceApplyPolicyDurationMetricsName,
Help: "Duration in seconds to apply a propagation policy for the resource template. By the result, 'error' means a resource template failed to apply the policy. Otherwise 'success'.",
Help: "Duration in seconds to apply a PropagationPolicy or ClusterPropagationPolicy for the resource templates. By the result, 'error' means a resource template failed to apply the policy. Otherwise 'success'.",
Buckets: prometheus.ExponentialBuckets(0.001, 2, 12),
}, []string{"result"})

policyApplyAttempts = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: policyApplyAttemptsMetricsName,
Help: "Number of attempts to be applied for a propagation policy. By the result, 'error' means a resource template failed to apply the policy. Otherwise 'success'.",
Help: "Number of attempts to be applied for a PropagationPolicy or ClusterPropagationPolicy. By the result, 'error' means a resource template failed to apply the policy. Otherwise 'success'.",
}, []string{"result"})

syncWorkDurationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: syncWorkDurationMetricsName,
Help: "Duration in seconds to sync works for a binding object. By the result, 'error' means a binding failed to sync works. Otherwise 'success'.",
Help: "Duration in seconds to sync works for ResourceBinding and ClusterResourceBinding objects. By the result, 'error' means a binding failed to sync works. Otherwise 'success'.",
Buckets: prometheus.ExponentialBuckets(0.001, 2, 12),
}, []string{"result"})

Expand Down
6 changes: 3 additions & 3 deletions pkg/scheduler/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var (
prometheus.CounterOpts{
Subsystem: SchedulerSubsystem,
Name: "schedule_attempts_total",
Help: "Number of attempts to schedule resourceBinding",
Help: "Number of attempts to schedule a ResourceBinding or ClusterResourceBinding",
}, []string{"result", "schedule_type"})

e2eSchedulingLatency = prometheus.NewHistogramVec(
Expand All @@ -65,12 +65,12 @@ var (
Buckets: prometheus.ExponentialBuckets(0.001, 2, 15),
}, []string{"schedule_step"})

// SchedulerQueueIncomingBindings is the number of bindings added to scheduling queues by event type.
// SchedulerQueueIncomingBindings is the Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
SchedulerQueueIncomingBindings = prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: SchedulerSubsystem,
Name: "queue_incoming_bindings_total",
Help: "Number of bindings added to scheduling queues by event type.",
Help: "Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.",
}, []string{"event"})

// FrameworkExtensionPointDuration is the metrics which indicates the latency for running all plugins of a specific extension point.
Expand Down
14 changes: 7 additions & 7 deletions pkg/scheduler/scheduler_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestIncomingBindingMetrics(t *testing.T) {
crbInvolved: false,
trigger: addBinding,
want: `
# HELP karmada_scheduler_queue_incoming_bindings_total Number of bindings added to scheduling queues by event type.
# HELP karmada_scheduler_queue_incoming_bindings_total Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
# TYPE karmada_scheduler_queue_incoming_bindings_total counter
karmada_scheduler_queue_incoming_bindings_total{event="BindingAdd"} 3
`,
Expand All @@ -110,7 +110,7 @@ func TestIncomingBindingMetrics(t *testing.T) {
crbInvolved: false,
trigger: updateBinding,
want: `
# HELP karmada_scheduler_queue_incoming_bindings_total Number of bindings added to scheduling queues by event type.
# HELP karmada_scheduler_queue_incoming_bindings_total Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
# TYPE karmada_scheduler_queue_incoming_bindings_total counter
karmada_scheduler_queue_incoming_bindings_total{event="BindingUpdate"} 3
`,
Expand All @@ -120,7 +120,7 @@ func TestIncomingBindingMetrics(t *testing.T) {
crbInvolved: false,
trigger: policyChanged,
want: `
# HELP karmada_scheduler_queue_incoming_bindings_total Number of bindings added to scheduling queues by event type.
# HELP karmada_scheduler_queue_incoming_bindings_total Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
# TYPE karmada_scheduler_queue_incoming_bindings_total counter
karmada_scheduler_queue_incoming_bindings_total{event="PolicyChanged"} 3
`,
Expand All @@ -130,7 +130,7 @@ func TestIncomingBindingMetrics(t *testing.T) {
crbInvolved: true,
trigger: crbPolicyChanged,
want: `
# HELP karmada_scheduler_queue_incoming_bindings_total Number of bindings added to scheduling queues by event type.
# HELP karmada_scheduler_queue_incoming_bindings_total Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
# TYPE karmada_scheduler_queue_incoming_bindings_total counter
karmada_scheduler_queue_incoming_bindings_total{event="PolicyChanged"} 3
`,
Expand All @@ -140,7 +140,7 @@ func TestIncomingBindingMetrics(t *testing.T) {
crbInvolved: false,
trigger: clusterChanged,
want: `
# HELP karmada_scheduler_queue_incoming_bindings_total Number of bindings added to scheduling queues by event type.
# HELP karmada_scheduler_queue_incoming_bindings_total Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
# TYPE karmada_scheduler_queue_incoming_bindings_total counter
karmada_scheduler_queue_incoming_bindings_total{event="ClusterChanged"} 3
`,
Expand All @@ -150,7 +150,7 @@ func TestIncomingBindingMetrics(t *testing.T) {
crbInvolved: true,
trigger: crbClusterChanged,
want: `
# HELP karmada_scheduler_queue_incoming_bindings_total Number of bindings added to scheduling queues by event type.
# HELP karmada_scheduler_queue_incoming_bindings_total Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
# TYPE karmada_scheduler_queue_incoming_bindings_total counter
karmada_scheduler_queue_incoming_bindings_total{event="ClusterChanged"} 3
`,
Expand All @@ -166,7 +166,7 @@ func TestIncomingBindingMetrics(t *testing.T) {
crbInvolved: false,
trigger: scheduleAttemptFailure,
want: `
# HELP karmada_scheduler_queue_incoming_bindings_total Number of bindings added to scheduling queues by event type.
# HELP karmada_scheduler_queue_incoming_bindings_total Number of ResourceBinding and ClusterResourceBinding objects added to scheduling queues by event type.
# TYPE karmada_scheduler_queue_incoming_bindings_total counter
karmada_scheduler_queue_incoming_bindings_total{event="ScheduleAttemptFailure"} 3
`,
Expand Down

0 comments on commit 5e8a765

Please sign in to comment.