-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add placement status metrics #1077
base: main
Are you sure you want to change the base?
Conversation
f0ded74
to
fc22495
Compare
c25f067
to
42093bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we emit the last condition if the crp is not completed? since your metrics type is gauge. WE only need to know the current status.
@@ -222,12 +223,12 @@ func (r *Reconciler) handleUpdate(ctx context.Context, crp *fleetv1beta1.Cluster | |||
klog.V(2).InfoS("Placement has finished the rollout process and reached the desired status", "clusterResourcePlacement", crpKObj, "generation", crp.Generation) | |||
r.Recorder.Event(crp, corev1.EventTypeNormal, "PlacementRolloutCompleted", "Placement has finished the rollout process and reached the desired status") | |||
} | |||
metrics.FleetPlacementStatus.WithLabelValues(crp.Name).Set(1) | |||
metrics.FleetPlacementComplete.WithLabelValues(crp.Name).SetToCurrentTime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i remember i never see people emit the cpu metrics with the timestamp. Could you please investigate how people create the gauge metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked to Arvind about this too as my reaction was exactly the same "I never see people emit metrics with the timestamp" but it turned out there is actually a reason for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the timestamp is there to help to setup alerts for "snapshot" instead of including all the history
return condition.IsConditionStatusTrue(crp.GetCondition(string(fleetv1beta1.ClusterResourcePlacementScheduledConditionType)), crp.Generation) | ||
cond := crp.GetCondition(string(fleetv1beta1.ClusterResourcePlacementScheduledConditionType)) | ||
if cond != nil { | ||
emitPlacementStatusMetric(cond, crp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are multiple ways to create the status metrics,
for example,
the label is, crp name, generation, value is status for that generation.
could you please investigate how others emit metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if including the crp name can result in cardinality being too large?
e8afb26
to
d7683e2
Compare
d7683e2
to
6f85e45
Compare
cond := crp.GetCondition(string(fleetv1beta1.ClusterResourcePlacementScheduledConditionType)) | ||
if cond != nil { | ||
metrics.FleetPlacementStatus.DeletePartialMatch(prometheus.Labels{"name": crp.Name}) | ||
metrics.FleetPlacementStatus.WithLabelValues(crp.Name, strconv.FormatInt(crp.Generation, 10), cond.Type, string(cond.Status)).SetToCurrentTime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thought on setting it as SetToCurrentTime()
or Set(float(LastTransitionTime.Unixnano()))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that SetToCurrentTime is a built-in? If so, I would prefer that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will leave as is then.
Description of your changes
Fixes #
I have: added a metric to emit crp condition status' along with a test.
make reviewable
to ensure this PR is ready for review.How has this code been tested
Special notes for your reviewer