Skip to content

Commit

Permalink
fix issue argoproj#2297 Missing metric for updatedReplicas (argoproj#…
Browse files Browse the repository at this point in the history
…2300)

incl. documentation and enhanced test
incl. fix rollout_info_replicas_desired was not documented

Signed-off-by: nitram509 <[email protected]>

Signed-off-by: nitram509 <[email protected]>
Signed-off-by: zachaller <[email protected]>
Co-authored-by: zachaller <[email protected]>
  • Loading branch information
2 people authored and jandersen-plaid committed Nov 26, 2022
1 parent 6320e35 commit c5399f9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
7 changes: 7 additions & 0 deletions controller/metrics/prommetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ var (
nil,
)

MetricRolloutInfoReplicasUpdated = prometheus.NewDesc(
"rollout_info_replicas_updated",
"The number of updated replicas per rollout.",
namespaceNameLabels,
nil,
)

MetricRolloutEventsTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "rollout_events_total",
Expand Down
24 changes: 21 additions & 3 deletions controller/metrics/rollout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ rollout_info_replicas_available{name="guestbook-bluegreen",namespace="default"}
rollout_info_replicas_desired{name="guestbook-bluegreen",namespace="default"} 1
# HELP rollout_info_replicas_unavailable The number of unavailable replicas per rollout.
# TYPE rollout_info_replicas_unavailable gauge
rollout_info_replicas_unavailable{name="guestbook-bluegreen",namespace="default"} 0`,
rollout_info_replicas_unavailable{name="guestbook-bluegreen",namespace="default"} 0
# HELP rollout_info_replicas_unavailable The number of unavailable replicas per rollout.
# TYPE rollout_info_replicas_unavailable gauge
rollout_info_replicas_unavailable{name="guestbook-bluegreen",namespace="default"} 0
# HELP rollout_info_replicas_updated The number of updated replicas per rollout.
# TYPE rollout_info_replicas_updated gauge
rollout_info_replicas_updated{name="guestbook-bluegreen",namespace="default"} 0`,
},

{
Expand All @@ -131,7 +137,13 @@ rollout_info_replicas_available{name="guestbook-bluegreen",namespace="default"}
rollout_info_replicas_desired{name="guestbook-bluegreen",namespace="default"} 1
# HELP rollout_info_replicas_unavailable The number of unavailable replicas per rollout.
# TYPE rollout_info_replicas_unavailable gauge
rollout_info_replicas_unavailable{name="guestbook-bluegreen",namespace="default"} 0`,
rollout_info_replicas_unavailable{name="guestbook-bluegreen",namespace="default"} 0
# HELP rollout_info_replicas_unavailable The number of unavailable replicas per rollout.
# TYPE rollout_info_replicas_unavailable gauge
rollout_info_replicas_unavailable{name="guestbook-bluegreen",namespace="default"} 0
# HELP rollout_info_replicas_updated The number of updated replicas per rollout.
# TYPE rollout_info_replicas_updated gauge
rollout_info_replicas_updated{name="guestbook-bluegreen",namespace="default"} 0`,
},
{
fakeCanaryRollout,
Expand All @@ -148,7 +160,13 @@ rollout_info_replicas_available{name="guestbook-canary",namespace="default"} 1
rollout_info_replicas_desired{name="guestbook-canary",namespace="default"} 1
# HELP rollout_info_replicas_unavailable The number of unavailable replicas per rollout.
# TYPE rollout_info_replicas_unavailable gauge
rollout_info_replicas_unavailable{name="guestbook-canary",namespace="default"} 0`,
rollout_info_replicas_unavailable{name="guestbook-canary",namespace="default"} 0
# HELP rollout_info_replicas_unavailable The number of unavailable replicas per rollout.
# TYPE rollout_info_replicas_unavailable gauge
rollout_info_replicas_unavailable{name="guestbook-canary",namespace="default"} 0
# HELP rollout_info_replicas_updated The number of updated replicas per rollout.
# TYPE rollout_info_replicas_updated gauge
rollout_info_replicas_updated{name="guestbook-canary",namespace="default"} 0`,
},
}

Expand Down
1 change: 1 addition & 0 deletions controller/metrics/rollouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func collectRollouts(ch chan<- prometheus.Metric, rollout *v1alpha1.Rollout) {
addGauge(MetricRolloutInfoReplicasAvailable, float64(rollout.Status.AvailableReplicas))
addGauge(MetricRolloutInfoReplicasUnavailable, float64(rollout.Status.Replicas-rollout.Status.AvailableReplicas))
addGauge(MetricRolloutInfoReplicasDesired, float64(defaults.GetReplicasOrDefault(rollout.Spec.Replicas)))
addGauge(MetricRolloutInfoReplicasUpdated, float64(rollout.Status.UpdatedReplicas))

// DEPRECATED
addGauge(MetricRolloutPhase, boolFloat64(calculatedPhase == RolloutCompleted), strategyType, string(RolloutCompleted))
Expand Down
4 changes: 3 additions & 1 deletion docs/features/controller-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ You can import this Dashboard in your Grafana installation [as a JSON file](http
The Argo Rollouts controller publishes the following prometheus metrics about Argo Rollout objects.
| Name | Description |
| ----------------------------------- | ----------- |
|-------------------------------------| ----------- |
| `rollout_info` | Information about rollout. |
| `rollout_info_replicas_available` | The number of available replicas per rollout. |
| `rollout_info_replicas_unavailable` | The number of unavailable replicas per rollout. |
| `rollout_info_replicas_desired` | The number of desired replicas per rollout. |
| `rollout_info_replicas_updated` | The number of updated replicas per rollout. |
| `rollout_phase` | [**DEPRECATED - use rollout_info**] Information on the state of the rollout. |
| `rollout_reconcile` | Rollout reconciliation performance. |
| `rollout_reconcile_error` | Error occurring during the rollout. |
Expand Down

0 comments on commit c5399f9

Please sign in to comment.