Commit Graph

95 Commits

Author SHA1 Message Date
Nour 9360a46c51
Promote metrics to stable 2025-09-14 21:59:23 +03:00
yshngg a483701408 feat(pod): add new metric for pod unscheduled time tracking
The changes introduce a new metric generator `kube_pod_status_unscheduled_time` to record the Unix timestamp when pods transition to unscheduled status. This enhances monitoring capabilities for scheduling issues by capturing exact transition times during `PodScheduled` condition changes.
2025-07-01 16:06:28 +08:00
Carlos Moreno 518db3d3cd fix: report correct values in kube_pod_status_reason metric 2025-03-31 23:01:45 -05:00
Rick Rackow 170bbd4c62
fix(kube_pod_tolerations): deduplicate tolerations before creating metric 2024-11-21 17:41:18 +01:00
Kubernetes Prow Robot 0738de0be2
Merge pull request #2539 from mrueg/expose-empty-labels
fix: expose empty labels
2024-11-05 20:41:30 +00:00
leiwingqueen f94ef65cc7 fix overflow in other occasion 2024-11-04 10:09:18 +08:00
Manuel Rüger 9f15cc1c8c pods: Expose empty labels 2024-10-31 17:40:10 +01:00
Manuel Rüger 0a86b24b08 chore: Memory align structs
pkg/metric_generator/generator.go:32:22: 16 bytes saved: struct with 96 pointer bytes could be 80
pkg/metrics_store/metrics_store.go:31:19: 40 bytes saved: struct with 64 pointer bytes could be 24
pkg/options/options.go:42:14: 24 bytes saved: struct of size 384 could be 360
internal/store/builder.go:67:14: 8 bytes saved: struct of size 200 could be 192
internal/store/pod.go:1351:16: 8 bytes saved: struct with 16 pointer bytes could be 8
internal/store/pod.go:1477:20: 8 bytes saved: struct with 16 pointer bytes could be 8
internal/store/testutils.go:32:30: 16 bytes saved: struct with 136 pointer bytes could be 120
pkg/metricshandler/metrics_handler.go:46:21: 8 bytes saved: struct of size 104 could be 96
internal/discovery/types.go:39:19: 32 bytes saved: struct with 88 pointer bytes could be 56
pkg/customresourcestate/config.go:51:15: 16 bytes saved: struct with 112 pointer bytes could be 96
pkg/customresourcestate/config.go:134:16: 8 bytes saved: struct with 88 pointer bytes could be 80
pkg/customresourcestate/config.go:150:13: 8 bytes saved: struct with 40 pointer bytes could be 32
pkg/customresourcestate/config_metrics_types.go:29:18: 8 bytes saved: struct with 64 pointer bytes could be 56
pkg/customresourcestate/config_metrics_types.go:42:17: 8 bytes saved: struct with 40 pointer bytes could be 32
pkg/customresourcestate/registry_factory.go:125:21: 8 bytes saved: struct with 40 pointer bytes could be 32
pkg/customresourcestate/registry_factory.go:212:20: 16 bytes saved: struct with 88 pointer bytes could be 72
pkg/customresourcestate/registry_factory.go:377:23: 8 bytes saved: struct with 104 pointer bytes could be 96
pkg/customresourcestate/registry_factory.go:497:21: 8 bytes saved: struct with 64 pointer bytes could be 56
pkg/customresourcestate/registry_factory.go:549:13: 8 bytes saved: struct with 24 pointer bytes could be 16
2024-08-08 19:03:28 +02:00
Tetiana Kravchenko 393430ed86 fix the description of the 'kube_pod_container_status_last_terminated_timestamp' metric
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
2024-03-04 11:40:34 +01:00
Tetiana Kravchenko 51ccb665c4 feat: add kube_pod_container_status_last_terminated_timestamp metric
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
2023-12-28 15:04:49 +01:00
changhyuni b948807ba3 modify labels key
modify label key
2023-12-15 09:18:06 +09:00
changhyuni ed1a7f992c pods: update init_cotainer_info metric 2023-12-14 22:51:38 +09:00
changhyuni fc1831d8b2 pods: update init_cotainer_info metric 2023-11-18 23:45:52 +09:00
adinhodovic e9c7e66748 fix: Rename kube_pod_scheduler_name to kube_pod_scheduler 2023-11-07 09:56:05 +01:00
adinhodovic c5c6c9a3f8 feat: Add new metric kube_pod_scheduler_name
Signed-off-by: adinhodovic <hodovicadin@gmail.com>
2023-10-19 19:41:34 +02:00
Kubernetes Prow Robot e8272ced47
Merge pull request #2145 from opeco17/feature/disable-labels-annotations-metrics-by-default
feat: disable labels and annotations metrics when metric-annotations-…
2023-08-22 06:34:54 -07:00
opeco17 6de105ebbe feat: disable labels and annotations metrics when metric-annotations-allowlist and metric-labels-allowlist are not provided 2023-08-14 14:38:23 +00:00
opeco17 3e4d91c4ba feat: implement kube_pod_status_initialized_time 2023-08-14 14:01:34 +00:00
Swarup Srinivasan 8a8b7b47fc add new metric kube_pod_service_account 2023-06-13 11:19:01 -04:00
Pranshu Srivastava b382da615a
Adhere to OTel-Prometheus standard for labels
Adhere to OTel-Prometheus standard for generated labels in CRS.

Ref.: 8946dfc6a2/specification/compatibility/prometheus_and_openmetrics.md?plain=1#L224-L229
Additional info.: OSM has a hardcoded approach for doing this right now: https://github.com/openshift/openshift-state-metrics/blob/master/pkg/collectors/utils.go#L29

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2023-04-22 19:45:48 +05:30
Kubernetes Prow Robot 86bf8f2803
Merge pull request #1971 from ryanrolds/rolds/bug_fix_pod_container_ready_time
Fixing emitting of ready time metrics when condition is false
2023-02-06 09:31:00 -08:00
Catherine Fang 4342ca7b97 Migrate all NewFamilyGenerator to NewFamilyGeneratorWithStability 2023-02-05 22:02:47 -05:00
Ryan R. Olds 67ed488ba8 Fixing emitting of ready time metrics when condition is false 2023-01-31 13:29:26 -08:00
Ryan R. Olds 59b1728783 Merge branch 'main' into rolds/pod_ready_time 2023-01-10 16:26:17 -08:00
Ryan Olds 0e4e396e34 Addressed feedback 2023-01-10 16:04:31 -08:00
Lan Liang 4d8c58ad00 Support pod_ready_time and pod_container_ready_time
Co-authored-by: Szymon Grzemski <sz.grzemski@gmail.com>
Signed-off-by: Lan Liang <gcslyp@gmail.com>
2023-01-10 16:04:03 -08:00
frezes c3004c6145 Change kube_pod_status_qos_class to experimental metric
Signed-off-by: frezes <zhangjunhao@kubesphere.io>
2023-01-03 14:25:39 +08:00
frezes 288718a71f Add kube_pod_status_qos_class gauge to pod metrics
Signed-off-by: frezes <zhangjunhao@kubesphere.io>
2022-12-12 17:38:37 +08:00
Paweł Kubica 2c3ea01cb2 Replace "<none>" with empty string for "owner_kind", "owner_name" and "owner_is_controller" dimensions.
Returning empty string instead of "<none>" value for "owner_kind", "owner_name" and "owner_is_controller" dimensions when no metadata.ownerReferences exists in Kubernetes resoures.
2022-12-03 15:17:02 +01:00
Pranshu Srivastava 5d20fd3454
Recommend kube-scheduler alternatives
Recommend metrics exposed by the kube-scheduler, in case of the ones below:
* `kube_pod_container_resource_limits`
* `kube_pod_container_resource_requests`

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
2022-11-03 23:46:20 +05:30
Catherine Fang 5995c1e2cf Add all stable metrics 2022-10-14 08:25:39 -04:00
Shaun Sabo ffb6fe77e8 remove reason from exitcode 2022-08-24 12:55:27 -07:00
Shaun Sabo e31b035319 create new metric 2022-08-24 12:55:27 -07:00
Shaun Sabo c9bb45384a add exit code 2022-08-24 12:55:27 -07:00
Julian van den Berkmortel a0980c87d1
Add metric for pod tolerations (Ref: #1744) 2022-06-29 17:56:52 +02:00
Braxton Schafer 5d57f47658 skip invalid IPs on pod_ips metric 2022-05-31 11:44:17 -05:00
Braxton Schafer f6be9edd01 fix failing lint checks 2022-05-31 11:42:59 -05:00
Braxton Schafer 08ec940c28 Add kube_pod_ips gauge to pod metrics
Add experimental kube_pod_ips metric to show all IPs on a pod.
This is useful for dual-stack clusters where pods will have at least one
IPv4 and one IPv6 address. Current kube_pod_info metric only shows
the single IP exposed by .status.podIP.

Signed-off-by: Braxton Schafer <bschafer@cloudflare.com>
2022-05-31 11:42:56 -05:00
honpey 9f3e368490 internal/store: fix metrics slice length for init containers
In https://github.com/kubernetes/kube-state-metrics/pull/1731,
the dynamic slice was introduced to fix potential panic under
Spec.Containers scenario, however there may be same panic for
Spec.InitContainers scenario.

This patch fix it referring to https://github.com/kubernetes/kube-state-metrics/pull/1731

Signed-off-by: honpey <honpey@gmail.com>
2022-05-30 15:36:09 +08:00
Jan Fajerski 85c6b44237 internal/store: fix metrics slice length
Problem: In https://github.com/kubernetes/kube-state-metrics/pull/1723 a
potential panic in the pod metrics gathering was fixed by working around
a disconnect of `Spec.Containers` and `Status.ContainerStatuses`. The
slice storing the resulting metrics however was still defined based on
the length of the `Status.ContainerStatuses` list.

Solution: Make the slice dynamic and append metrics to it.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2022-05-09 20:02:09 +02:00
Michal Fojtik 43d374b1cb
internal/store: fix potential panic in pod store 2022-04-25 13:53:50 +02:00
Kubernetes Prow Robot b4c34858cb
Merge pull request #1675 from geojaz/geojaz/add_kube_pod_nodeselector
Adds kube_pod_nodeselector metric
2022-03-01 01:07:51 -08:00
Sherif Abdel-Naby e205fee343
Extract mergeKeyValue logic into a central function 2022-02-10 04:12:35 +02:00
Eric Hole 9a6fae5fc3 kube_pod_nodeselector -> kube_pod_nodeselectors 2022-02-07 11:02:39 -08:00
Eric Hole 90689ccff3 Change kube_pod_nodeselector to be opt-in 2022-02-07 09:13:20 -08:00
Sherif Abdel-Naby 3a600f56c7
Optimize Slice Allocations 2022-02-05 18:53:35 +02:00
Eric Hole 6d1c11f148 Adds kube_pod_nodeselector metric 2022-02-04 15:01:02 -08:00
Min Wang 1b2c05c6c9 Add fieldSelector in listWatchFunc 2021-10-04 18:54:51 -07:00
Kubernetes Prow Robot 03e84f55d6
Merge pull request #1551 from dgrisonnet/revert-init-containers-requests
Revert init containers resource metrics rework
2021-09-30 06:06:08 -07:00
Gabi Davar 5016cca2de
add image_spec to pod (init)container info 2021-09-21 18:26:50 +03:00