mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Add the pod_resources_endpoint_requests_total metric
This commit is contained in:
parent
501f7b16d9
commit
969e45f49f
@ -12,6 +12,7 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/pkg/kubelet/apis/podresources",
|
importpath = "k8s.io/kubernetes/pkg/kubelet/apis/podresources",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/kubelet/metrics:go_default_library",
|
||||||
"//pkg/kubelet/util:go_default_library",
|
"//pkg/kubelet/util:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/kubelet/pkg/apis/podresources/v1:go_default_library",
|
"//staging/src/k8s.io/kubelet/pkg/apis/podresources/v1:go_default_library",
|
||||||
|
@ -19,6 +19,8 @@ package podresources
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/kubelet/metrics"
|
||||||
|
|
||||||
"k8s.io/kubelet/pkg/apis/podresources/v1"
|
"k8s.io/kubelet/pkg/apis/podresources/v1"
|
||||||
"k8s.io/kubelet/pkg/apis/podresources/v1alpha1"
|
"k8s.io/kubelet/pkg/apis/podresources/v1alpha1"
|
||||||
)
|
)
|
||||||
@ -50,6 +52,8 @@ func alphaDevicesToV1(alphaDevs []*v1alpha1.ContainerDevices) []*v1.ContainerDev
|
|||||||
|
|
||||||
// List returns information about the resources assigned to pods on the node
|
// List returns information about the resources assigned to pods on the node
|
||||||
func (p *v1PodResourcesServer) List(ctx context.Context, req *v1.ListPodResourcesRequest) (*v1.ListPodResourcesResponse, error) {
|
func (p *v1PodResourcesServer) List(ctx context.Context, req *v1.ListPodResourcesRequest) (*v1.ListPodResourcesResponse, error) {
|
||||||
|
metrics.PodResourcesEndpointRequestsTotalCount.WithLabelValues("v1").Inc()
|
||||||
|
|
||||||
pods := p.podsProvider.GetPods()
|
pods := p.podsProvider.GetPods()
|
||||||
podResources := make([]*v1.PodResources, len(pods))
|
podResources := make([]*v1.PodResources, len(pods))
|
||||||
p.devicesProvider.UpdateAllocatedDevices()
|
p.devicesProvider.UpdateAllocatedDevices()
|
||||||
|
@ -19,6 +19,8 @@ package podresources
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/kubelet/metrics"
|
||||||
|
|
||||||
"k8s.io/kubelet/pkg/apis/podresources/v1alpha1"
|
"k8s.io/kubelet/pkg/apis/podresources/v1alpha1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ func NewV1alpha1PodResourcesServer(podsProvider PodsProvider, devicesProvider De
|
|||||||
|
|
||||||
// List returns information about the resources assigned to pods on the node
|
// List returns information about the resources assigned to pods on the node
|
||||||
func (p *v1alpha1PodResourcesServer) List(ctx context.Context, req *v1alpha1.ListPodResourcesRequest) (*v1alpha1.ListPodResourcesResponse, error) {
|
func (p *v1alpha1PodResourcesServer) List(ctx context.Context, req *v1alpha1.ListPodResourcesRequest) (*v1alpha1.ListPodResourcesResponse, error) {
|
||||||
|
metrics.PodResourcesEndpointRequestsTotalCount.WithLabelValues("v1alpha1").Inc()
|
||||||
pods := p.podsProvider.GetPods()
|
pods := p.podsProvider.GetPods()
|
||||||
podResources := make([]*v1alpha1.PodResources, len(pods))
|
podResources := make([]*v1alpha1.PodResources, len(pods))
|
||||||
p.devicesProvider.UpdateAllocatedDevices()
|
p.devicesProvider.UpdateAllocatedDevices()
|
||||||
|
@ -60,6 +60,8 @@ const (
|
|||||||
// Metrics keys of device plugin operations
|
// Metrics keys of device plugin operations
|
||||||
DevicePluginRegistrationCountKey = "device_plugin_registration_total"
|
DevicePluginRegistrationCountKey = "device_plugin_registration_total"
|
||||||
DevicePluginAllocationDurationKey = "device_plugin_alloc_duration_seconds"
|
DevicePluginAllocationDurationKey = "device_plugin_alloc_duration_seconds"
|
||||||
|
// Metrics keys of pod resources operations
|
||||||
|
PodResourcesEndpointRequestsTotalKey = "pod_resources_endpoint_requests_total"
|
||||||
|
|
||||||
// Metric keys for node config
|
// Metric keys for node config
|
||||||
AssignedConfigKey = "node_config_assigned"
|
AssignedConfigKey = "node_config_assigned"
|
||||||
@ -277,6 +279,18 @@ var (
|
|||||||
[]string{"resource_name"},
|
[]string{"resource_name"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PodResourcesEndpointRequestsTotalCount is a Counter that tracks the cumulative number of requests to the PodResource endpoints.
|
||||||
|
// Broken down by server API version.
|
||||||
|
PodResourcesEndpointRequestsTotalCount = metrics.NewCounterVec(
|
||||||
|
&metrics.CounterOpts{
|
||||||
|
Subsystem: KubeletSubsystem,
|
||||||
|
Name: PodResourcesEndpointRequestsTotalKey,
|
||||||
|
Help: "Cumulative number of requests to the PodResource endpoint. Broken down by server api version.",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
|
},
|
||||||
|
[]string{"server_api_version"},
|
||||||
|
)
|
||||||
|
|
||||||
// Metrics for node config
|
// Metrics for node config
|
||||||
|
|
||||||
// AssignedConfig is a Gauge that is set 1 if the Kubelet has a NodeConfig assigned.
|
// AssignedConfig is a Gauge that is set 1 if the Kubelet has a NodeConfig assigned.
|
||||||
|
Loading…
Reference in New Issue
Block a user