GithubHelp home page GithubHelp logo

Comments (12)

yujuhong avatar yujuhong commented on June 16, 2024 1

Thank you Ruiwen, for the cardinality issue I have some comments on it:

This is very different from the existing implementation of pod_start_total_duration_seconds. Waiting for @dashpole or others from sig-instrumentation to give some advice on the best way to record one-time per-pod metrics like this.

from kubernetes.

JeffLuoo avatar JeffLuoo commented on June 16, 2024

cc: @ruiwen-zhao for review.

from kubernetes.

JeffLuoo avatar JeffLuoo commented on June 16, 2024

/sig instrumentation

from kubernetes.

ruiwen-zhao avatar ruiwen-zhao commented on June 16, 2024

/sig node

from kubernetes.

ruiwen-zhao avatar ruiwen-zhao commented on June 16, 2024

Just to bring up previous discussion around metric cardinality, adding both pod name and node name to metric labels might be too much cardinality. We need to come up with a way to address this.

cc @SergeyKanzhelev @logicalhan @dashpole

from kubernetes.

JeffLuoo avatar JeffLuoo commented on June 16, 2024

Thank you Ruiwen, for the cardinality issue I have some comments on it:

  1. Kubernetes already has some metrics from scheduler that include the pod name, namespace, and node name as metrics label:

    []string{"namespace", "pod", "node", "scheduler", "priority", "resource", "unit"},

  2. "uid",
    "namespace",
    "pod",

Kubenetes has another metric kubelet_container_log_filesystem_used_bytes that also use pod name and namespace as metrics labels.

  1. KSM also exports pod metrics in prometheus format and some metrics have pod name and namespace as metrics labels: https://github.com/kubernetes/kube-state-metrics/blob/main/docs/metrics/workload/pod-metrics.md.

from kubernetes.

dgrisonnet avatar dgrisonnet commented on June 16, 2024

cc @dgrisonnet @richabanker

from kubernetes.

JeffLuoo avatar JeffLuoo commented on June 16, 2024

@yujuhong Yes. The pod_start_total_duration_seconds is a Distribution over all pods in the node, but newly added metric in this feature proposed to add a gauge metric that provides the exact startup time for a single pod to become ready.

@dashpole Hi David, could you please provide some insights here? Thanks!

from kubernetes.

dashpole avatar dashpole commented on June 16, 2024

A few questions to get the discussion started:

  • Why a gauge instead of a histogram? A gauge is OK when looking at a single stream, or if you want to graph the average. But durations are often best represented by a histogram, as you can graph percentiles, or show a distribution. But if you graph a bunch of gauges, you will just see lots of lines on the graph, which isn't that helpful.
  • Does this need to be in the kubelet? IIUC, this metric is produced by watching pods, and emitting a metric when it becomes ready for the first time. It doesn't need any special knowledge that the kubelet has, right?
  • How long would the metric exist for? The startup will occur at the very beginning of the pod's life (in a single instant). Most pod-level metrics exist for the lifetime of the pod, but doing that would mean any aggregation would be less meaningful. Averaging the startup time of all currently-running pods in the cluster won't tell you if pod startup is currently slow. We could emit the metric for an arbitrary amount of time (e.g. 5 minutes), but that risks a scraper missing a pod entirely.

Bikeshedding: From the names, kubelet_pod_full_startup_duration_seconds vs pod_start_total_duration_seconds, I wouldn't know what the difference is. Would pod_ready_duration_seconds or pod_first_ready_duration_seconds be better?

from kubernetes.

JeffLuoo avatar JeffLuoo commented on June 16, 2024

@dashpole Hi David thank you for the comment.

Why a gauge instead of a histogram? A gauge is OK when looking at a single stream, or if you want to graph the average. But durations are often best represented by a histogram, as you can graph percentiles, or show a distribution. But if you graph a bunch of gauges, you will just see lots of lines on the graph, which isn't that helpful.

I want to use a gauge because I want to record the exact startup time of the pod, and it will allow users to know the exact time it takes for their pods to become ready to serve. With the pod-level metric, users could also group them together under the workload (e.g. deployment).

Does this need to be in the kubelet? IIUC, this metric is produced by watching pods, and emitting a metric when it becomes ready for the first time. It doesn't need any special knowledge that the kubelet has, right?

I use kubelet as kubelet will track the status of each pod in pod_startup_latency_tracker, and kubelet will watch for the status change of each pod. Also, kubelet is usually the first layer to process the pod status and it's a stable component (compared to other components in the cluster like kube-state-metrics which I usually see out-of-memory issue..) Do you have any recommendation for other places to add such metric?

How long would the metric exist for? The startup will occur at the very beginning of the pod's life (in a single instant). Most pod-level metrics exist for the lifetime of the pod, but doing that would mean any aggregation would be less meaningful. Averaging the startup time of all currently-running pods in the cluster won't tell you if pod startup is currently slow. We could emit the metric for an arbitrary amount of time (e.g. 5 minutes), but that risks a scraper missing a pod entirely.

For "Most pod-level metrics exist for the lifetime of the pod, but doing that would mean any aggregation would be less meaningful", can you provide more context here to help me understand? Thanks!

From the names, kubelet_pod_full_startup_duration_seconds vs pod_start_total_duration_seconds, I wouldn't know what the difference is. Would pod_ready_duration_seconds or pod_first_ready_duration_seconds be better?

pod_first_ready_duration_seconds looks good to me!

from kubernetes.

yujuhong avatar yujuhong commented on June 16, 2024

Does this need to be in the kubelet? IIUC, this metric is produced by watching pods, and emitting a metric when it becomes ready for the first time. It doesn't need any special knowledge that the kubelet has, right?

Would something like kube-state-metrics more suitable for this?
https://kubernetes.io/docs/concepts/cluster-administration/kube-state-metrics/

from kubernetes.

dashpole avatar dashpole commented on June 16, 2024

/assign @JeffLuoo
/assign
/triage accepted

from kubernetes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.