Skip to content
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

Add metrics of kube_pod_status_ready_time and kube_pod_status_containers_ready_time redux #1938

Merged
merged 5 commits into from
Jan 19, 2023

Conversation

ryanrolds
Copy link
Contributor

This is a copy of #1837 with the merge conflict resolved. All credit should go to @liangyuanpeng. The text below is copied from the other PR.

What this PR does / why we need it:
Base PR #1482

Ref: Adds kube_pod_status_ready_time and kube_pod_status_containers_ready_time metrics to get the information provided by Pod Lifecycle's PodConditions array.

Maybe we should support param to open this feature or not, juse like feature-gates.

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
increases metrics number that Pod number * 2

Which issue(s) this PR fixes (optional, in fixes #(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1465

Co-authored-by: Szymon Grzemski sz.grzemski@gmail.com
Signed-off-by: Lan Liang gcslyp@gmail.com

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 29, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: liangyuanpeng / name: Lan (f36b8e6)
  • ✅ login: ryanrolds / name: Ryan Olds (c3c0862)

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Dec 29, 2022
@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Dec 29, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @ryanrolds!

It looks like this is your first PR to kubernetes/kube-state-metrics 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kube-state-metrics has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 29, 2022
docs/pod-metrics.md Outdated Show resolved Hide resolved
docs/pod-metrics.md Outdated Show resolved Hide resolved
internal/store/pod.go Outdated Show resolved Hide resolved
@ryanrolds ryanrolds requested review from mrueg and removed request for logicalhan and fpetkovski December 30, 2022 03:24
@dgrisonnet
Copy link
Member

Holding in favor of #1837 for now.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 10, 2023
liangyuanpeng and others added 2 commits January 10, 2023 16:04
Co-authored-by: Szymon Grzemski <sz.grzemski@gmail.com>
Signed-off-by: Lan Liang <gcslyp@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 11, 2023
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 11, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 11, 2023
@logicalhan
Copy link
Member

/triage accepted
/assign @mrueg

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 12, 2023
Copy link
Member

@mrueg mrueg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small requests, then we should be able to merge it.

internal/store/pod.go Show resolved Hide resolved
for _, c := range p.Status.Conditions {
if c.Type == v1.ContainersReady {
ms = append(ms, &metric.Metric{
LabelKeys: []string{},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this require Label Keys identifying the container?
Similar to createPodContainerInfoFamilyGenerator

Copy link
Contributor Author

@ryanrolds ryanrolds Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is it's not that a specific container is ready, but all the containers are ready. If we emitting a metric about the status of individual containers, I would add container id so it could be joined to kube_pod_container_info. Thoughts?

Copy link
Member

@mrueg mrueg Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right! I was thinking it's using something in .status.containerStatuses which would be per container. No need to change anything then. :)

  - lastProbeTime: null
    lastTransitionTime: "2022-11-18T18:50:53Z"
    status: "True"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2022-11-18T18:50:53Z"
    status: "True"
    type: ContainersReady

@ryanrolds ryanrolds requested a review from mrueg January 19, 2023 00:24
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 19, 2023
@mrueg
Copy link
Member

mrueg commented Jan 19, 2023

/hold cancel
/lgtm

Thanks @liangyuanpeng and @ryanrolds for your contribution here!

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jan 19, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrueg, ryanrolds

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 19, 2023
@k8s-ci-robot k8s-ci-robot merged commit 1cda0bf into kubernetes:main Jan 19, 2023
@valorl
Copy link

valorl commented Feb 2, 2023

Thanks for this. Very relevant to me currently. @mrueg may I ask whether this will make it to 2.8 ? And if yes, do you maybe have a rough idea when that could be published ? I'm not familiar with the release process here 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support kube_pod_ready_time metric
7 participants