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
When metrics are counted, discard the wrong container StartTime metrics #110880
When metrics are counted, discard the wrong container StartTime metrics #110880
Conversation
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.
/lgtm
/aasign @dashpole
/assign |
/approve |
Sorry, just getting back from vacation. Sig node owns these packages, and I am an approver based on my previous work in sig-node. Anyone with pkg/kubelet can also approve, so it isn't just me, but it might be nice for someone else who spans both sigs (maybe @ehashman) to be an approver here as well. Did we find the root cause of the negative start time? This change is unobjectionable, but is probably hiding a real issue. With just this change, we would end up dropping metrics that might be valid. |
The containerStats.StartTime comes from the container.spec.CreateTime which is collected by cadvisor, so if the containerStats.StartTime is not initialized, it means that the container.spec.CreateTime was not set by cadvisor while it created the containerData. But see the code, normaly it is not possible for the CreateTime not set except in some extreme case. @bobbypage did you ever meet that the container.spec.CreateTime was not set by cadvisor? thanks |
@dashpole This issue occurs when the pod terminates. |
It looks like @AtkinsChang was right in his comment on May 23. This appear to be from an "empty" time object. This code snippet return the same as seen in the issue;
Running it returns Can you please describe more about your setup here @yangjunmyfm1920? Is this due to CRI metrics returning the wrong value, or some other thing? It would be nice to be able to reproduce it to be sure about what is causing it. I can't see how that referred cadvisor PR can result in such a Do you know more about the CRI metrics pipeline ref. the above @dashpole? Lgtm as well, but think we should find the root cause for this! /lgtm |
I'm not aware of the current status of CRI-O, but it used to still use cAdvisor for metrics. If that is the case, then it would be the cAdvisor code responsible for detecting container start time in this case. |
I agree with @dashpole |
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.
/retest
/test pull-kubernetes-unit |
/test pull-kubernetes-e2e-gce-ubuntu-containerd |
/test pull-kubernetes-e2e-kind |
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
@yangjunmyfm192085 pls rebase |
50015a6
to
a84e9c0
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 249043822, dashpole, dgrisonnet, wzshiming, yangjunmyfm192085 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
a84e9c0
to
c71e3a7
Compare
/lgtm |
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.
/test pull-kubernetes-unit
/test pull-kubernetes-unit |
/test pull-kubernetes-e2e-kind |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Incorrect metrics of container might be generated when pod start or stop.
Need to filter out wrong metrics.
Which issue(s) this PR fixes:
Fixes #109679
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: