type resourceLifecycleDescriptors … func (d resourceLifecycleDescriptors) Describe(ch chan<- *metrics.Desc) { … } type resourceMetricsDescriptors … func (d resourceMetricsDescriptors) Describe(ch chan<- *metrics.Desc) { … } var podResourceDesc … // Handler creates a collector from the provided podLister and returns an http.Handler that // will report the requested metrics in the prometheus format. It does not include any other // metrics. func Handler(podLister corelisters.PodLister) http.Handler { … } var _ … // NewPodResourcesMetricsCollector registers a O(pods) cardinality metric that // reports the current resources requested by all pods on the cluster within // the Kubernetes resource model. Metrics are broken down by pod, node, resource, // and phase of lifecycle. Each pod returns two series per resource - one for // their aggregate usage (required to schedule) and one for their phase specific // usage. This allows admins to assess the cost per resource at different phases // of startup and compare to actual resource usage. func NewPodResourcesMetricsCollector(podLister corelisters.PodLister) metrics.StableCollector { … } type podResourceCollector … func (c *podResourceCollector) DescribeWithStability(ch chan<- *metrics.Desc) { … } func (c *podResourceCollector) CollectWithStability(ch chan<- metrics.Metric) { … } func recordMetricWithUnit( ch chan<- metrics.Metric, desc *metrics.Desc, namespace, name, nodeName, schedulerName, priority string, resourceName v1.ResourceName, unit string, val resource.Quantity, ) { … } // podRequestsAndLimitsByLifecycle returns a dictionary of all defined resources summed up for all // containers of the pod. Pod overhead is added to the // total container resource requests and to the total container limits which have a // non-zero quantity. The caller may avoid allocations of resource lists by passing // a requests and limits list to the function, which will be cleared before use. // This method is the same as resourcehelper.PodRequestsAndLimits but avoids allocating in several // scenarios for efficiency. func podRequestsAndLimitsByLifecycle(pod *v1.Pod, reuseReqs, reuseLimits v1.ResourceList) (reqs, limits v1.ResourceList, terminal bool) { … }