kubernetes / kube-state-metrics

Add-on agent to generate and expose cluster-level metrics.
https://kubernetes.io/docs/concepts/cluster-administration/kube-state-metrics/
Apache License 2.0
5.36k stars 2k forks source link

feat: add kube_pod_container_status_last_terminated_timestamp metric #2291

Closed tetianakravchenko closed 6 months ago

tetianakravchenko commented 9 months ago

What this PR does / why we need it: Adds kube_pod_container_status_last_terminated_timestamp metric to report the time when container was last time terminated with the kube_pod_container_status_last_terminated_reason. This metric is useful for cases like getting the crash situation - as described in this issue: https://github.com/kubernetes/kube-state-metrics/issues/1805#issuecomment-1219182114

How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality) Adds a new metric in cases when the kube_pod_container_status_last_terminated_reason is reported

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

k8s-ci-robot commented 9 months ago

Welcome @tetianakravchenko!

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. :smiley:

dashpole commented 8 months ago

/triage accepted /assign @rexagod

rexagod commented 8 months ago

@tetianakravchenko Tests seem to be failing here.

tetianakravchenko commented 8 months ago

@tetianakravchenko Tests seem to be failing here.

Hey @rexagod I've fixed tests, please have a look

tetianakravchenko commented 8 months ago

Hey @rexagod @mrueg could you please check this PR?

StephanErb commented 6 months ago

This feature would be super helpful! Anything missing to get this in? :)

tetianakravchenko commented 6 months ago

Hey @rexagod could you please have another look on this PR?

mrueg commented 6 months ago

/lgtm

Thanks for your contribution!

k8s-ci-robot commented 6 months ago

[APPROVALNOTIFIER] This PR is APPROVED

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

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: - ~~[OWNERS](https://github.com/kubernetes/kube-state-metrics/blob/main/OWNERS)~~ [mrueg] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment