OCPBUGS-20179: Stop defining time series for hosted clusters or node pools which do not exist anymore. - #2671
Conversation
6a732c9 to
25331f7
Compare
25331f7 to
c175ca4
Compare
c40abc5 to
0c0aedf
Compare
✅ Deploy Preview for hypershift-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
a878d68 to
7056b5e
Compare
|
I'm not sure I follow the deletion metrics pattern. How is current service dealing with remaining metrics from deleted clusters? |
7056b5e to
91088a8
Compare
That's the problem, all the metrics for a given deleted hosted cluster or node pool currently continue to exist till the Aim of this PR is to make sure the metrics (or more accurately the time series) for a given hosted cluster or node pool cease to exists when the hosted cluster or node pool is deleted. |
Thanks I see what you are trying to solve, my questions is how are we solving the same thing in traditional ROSA? After a cluster is gone what happen to their metrics? This is effectively removing our ability to track and meet our SLOs for HC deletion. I'd suggest we put a doc together so we can agree on the goals then we revisit the best way to implement them. |
The metrics are ended; exactly as I intend to do here. In traditional ROSA, the metrics are all produced by (pods in) the cluster itself. When the cluster is deleted those metrics cease to be produced (for the cluster which has been deleted). With hypershift, metrics are produced by various sources:
Source 1 and 2 cease to produce metrics when the hosted cluster is deleted.
Is "This" == "This pull request"? (this works for metrics which are counters or behave as counters) |
91088a8 to
9665445
Compare
|
/retest |
|
My 2 cents (irrespective of the discussion whether the metric should be deleted or not): deleting metrics in code is usually a code smell as deleting series when some object is removed is prone to error. It is in general safer to implement the custom collector pattern with Const metrics... |
Thanks @simonpasquier for the comment; implementing a custom collector is indeed a better & safer way to go (didn't know about that possibility). I will change the code in this PR to do exactly that. |
|
/jira refresh |
|
@celebdor: This pull request references Jira Issue OCPBUGS-20179, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (jiezhao@redhat.com), skipping review request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test e2e-aws-metrics |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Nikokolas3270, sjenning The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| reportClusterVersionRolloutTime(hcluster) | ||
| hcluster.Annotations[hcmetrics.HasBeenAvailableAnnotation] = "true" | ||
|
|
||
| if err := r.Patch(ctx, hcluster, client.MergeFromWithOptions(original)); err != nil { |
There was a problem hiding this comment.
why is this patch needed here now vs before?
There was a problem hiding this comment.
Hello Alberto,
There was a bug in the old code: the hostedcluster object was annotated in memory but the annotation was not saved in DB.
I believe this is due to this code which only saves the status change but nothing else:
https://github.com/openshift/hypershift/blob/main/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go#L322
Here is some other place in the code in which the same kind of call to patch in needed to save annotations:
fdf4779 to
a091d00
Compare
|
Rebased |
a091d00 to
d96af57
Compare
d96af57 to
3c79066
Compare
|
…ostedclusters and nodepools deletion
3c79066 to
30a3773
Compare
|
@Nikokolas3270: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
thanks! |
|
@Nikokolas3270: Jira Issue OCPBUGS-20179: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-20179 has been moved to the MODIFIED state. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Fix included in accepted release 4.15.0-0.nightly-2023-11-14-041944 |
What this PR does / why we need it:
hostedclusterandnodepooltime series keep being defined long after thehostedclusterornodepoolis gone.This is problematic because:
hostedclustermetric which will "count" the number of worker cores and which will be used to bill the customers (seeOSD-19085).This metric must stop to be defined as soon as the cluster is gone or we will continue to bill the customer for a cluster which is gone.
hostedclusterornodepoolis gone.This PR uses dedicated collectors for all
hostedcluster&nodepoolmetrics.Thanks to that change:
hostedclusterornodepoolas soon as it is gone.hostedclusters and thenodepools (i.e. the controllers)This PR also:
hypershift_cluster_silence_alertsmetric to 1 when the hosted cluster is being deleted.Indeed checking whether or not a hosted cluster is being deleted can be achieved by checking whether or not metric
hypershift_cluster_deleting_duration_secondsis being defined._idlabel for allnodepoolmetricsThis is much more coherent with designing an alert on an action taking too much time to complete.
Also for some metrics (like
hypershift_cluster_deletion_duration_seconds) the end of the action was also the end of thehostedclusterornodepoolthe metrics refers to, so those metrics couldn't start being defined when the action was done (not to mention that if the hypershift operator was restarted just after, those metrics would have been defined for a very brief period of time if not at all)hypershift_cluster_deletion_duration_seconds->hypershift_cluster_deleting_duration_secondshypershift_cluster_guest_cloud_resources_deletion_duration_seconds->hypershift_cluster_guest_cloud_resources_deleting_duration_secondshypershift_cluster_available_duration_seconds->hypershift_cluster_waiting_initial_avaibility_duration_secondshypershift_cluster_initial_rollout_duration_seconds->hypershift_cluster_initial_rolling_out_duration_secondshypershift_cluster_upgrade_duration_seconds->hypershift_cluster_upgrading_duration_secondshypershift_nodepools_deletion_duration_seconds->hypershift_nodepools_deleting_duration_secondshypershift_nodepools_initial_rollout_duration_seconds->hypershift_nodepools_initial_rolling_out_duration_secondshypershift_cluster_skipped_cloud_resources_deletionwithhypershift_cluster_invalid_aws_creds.Indeed the old metric is set (and only set) when deleting the cluster (i.e. when
hypershift_cluster_deleting_duration_secondsis set) and when the AWS creds are invalid (whenhypershift_cluster_invalid_aws_credsis set). The new metric is no more transaction based which allowed the decorrelation between the controller code and the collector code.Indeed those metrics (handled by some kind of fake collector) were either concerning
hostedclusters ornodepools.platformlabel tohypershift_hostedclusters_failure_conditionsmetric in order to be consistent withhypershift_nodepools_failure_conditionsmetric.hypershift_nodepools_failure_conditionsmetric to 0 (instead of undefined) for all plaforms & failure conditions in order to be consistent withhypershift_hostedclusters_failure_conditions.hypershift_nodepoolsmetric to 0 (instead of undefined) to be consistent withhypershift_hostedclusters._idlabel tohypershift_hostedcluster_nodepoolsmetric. Also labelcluster_namehas been renamed tonamein order to be consistant with the otherhostedclustermetrics (remark that this metric is however still computed while dealing with thenodepools).Maybe this metric could be dropped as it is equivalent to
sum by (namespace, name, _id, platform) (label_replace(count by (namespace, cluster_name, _id, platform) (hypershift_nodepools_available_replicas), "name", "$0", "cluster_name", ".*"))hypershift.openshift.io/HasBeenAvailablereally get properly added on ahostedclusterwhen needed... this was not working before.hypershift_nodepools_transition_secondsis now really defined. Old code was attempting to set this metric... but as the new status was already set before the call toObserveConditionTransitionDurationold & new statuses were actually the same!Which issue(s) this PR fixes
Contributes to OCPBUGS-20179 (also this is the clean fix for OSD-16638).
Note that the PR proposes some renaming for some metrics, please tell if you are okay with those renames, maybe they can be shipped with this PR.
Checklist