Commit Graph

85 Commits

Author SHA1 Message Date
Lili Cosic fa5e260535 internal/store/pod.go: Only create last_terminated containers series if pods are
terminated. This reduces the cardinality of this metric greatly, as it was
one of the highest cardinality metrics pre 2.0.
2021-02-24 16:59:53 +01:00
Lili Cosic 99838a5762 Adjust unit tests 2021-02-09 15:50:38 +01:00
Lili Cosic 9d147ca2b6 Adjust unit tests 2021-02-08 13:55:52 +01:00
Jimmy K Seto 9078a53265 fix container resource limits metrics, which got dropped btwn 2.0.0-alpha.1 and 2.0.0-alpha.2 2020-11-02 14:48:04 -05:00
Eric Ernst 0cb814f725 pod: add gauge for runtimeclass handler
Add a metric gauge to provide observability for the runtimeclass
used for running a pod.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2020-10-26 08:03:31 -07:00
Lili Cosic b92fd141c8 Adjust unit tests 2020-10-26 14:04:34 +01:00
Kubernetes Prow Robot 3faa773aee
Merge pull request #1248 from kubernetes/master
Merge master into release-2.0
2020-10-05 01:57:05 -07:00
Joel Whittaker-Smith a11255320a Now references closure scoped family generator
Signed-off-by: Joel Whittaker-Smith <jdws.dev@gmail.com>
2020-09-28 13:57:51 +02:00
Quentin Bisson 7250bc2b5c
Update go module path to k8s.io/kube-state-metrics/v2
Signed-off-by: Quentin Bisson <quentin@giantswarm.io>
2020-09-21 10:58:08 +02:00
Joel Whittaker-Smith 908f87b2cd apply boundaries to metrics and allow via flag what labels to include
Signed-off-by: Joel Whittaker-Smith <jdws.dev@gmail.com>
2020-08-26 12:42:30 +02:00
Prabhakar Mishra 0ff5482079 update client-go, k/api, k/apimachinery to v1.18.6 and vertical-pod-autoscaler to commit b7922d74509c
use clientgofix library

add context parameter in verticalpodautoscaler

rename PodDisruptionsAllowed to DisruptionsAllowed because of PR 85863 in k8s repo

lint fixes and rename PodDisruptionsAllowed to DisruptionsAllowed in test file

run go mod tidy
2020-07-30 01:54:34 +02:00
vikkyomkar 692c597993 updated main_test.go file 2020-07-26 12:12:37 +05:30
Frederic Branczyk cd42164e42
internal/store: Add named resource pod overhead metrics
This patch turns the generic pod overhead metrics into one metric per
resource as per Prometheus best practices.
2020-07-16 10:34:52 +02:00
Frederic Branczyk fb261a1499
main_test.go: Fix named resource metrics 2020-07-15 16:17:59 +02:00
qw1mb0 bdb2e9284e add UnexpectedAdmissionError to kube_pod_status_reason metric 2020-05-16 21:19:25 +03:00
Frederic Branczyk 1610b64df8
pod: Add init container requests 2020-04-15 22:03:27 +02:00
Rustam Zagirov b61a3b320a add host_network to kube_pod_info 2020-03-18 21:23:37 +03:00
Olivier Lemasle 6fac7a2ddd Rename kube_pod_deleted to kube_pod_deletion_timestamp 2020-02-24 11:32:59 +01:00
Kubernetes Prow Robot a618eab33d
Merge pull request #1053 from egernst/overhead
pod: add gauges for pod overhead
2020-02-10 11:11:54 -08:00
Kubernetes Prow Robot 8dc870e47a Merge pull request #1006 from Alexander-Carpenter/resourceRename
v2: Rename collector to resource
2020-02-10 02:55:53 -08:00
Eric Ernst c1895cdec3 pod: add gauges for pod overhead
Add a metric guage to provide observability for the overhead associated
with running a pod.

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2020-02-07 22:15:36 -08:00
Philip Gough 58e7c50270
store: Remove non-identifying labels from pod metrics
Fixes #979

test:store - Updates unit test to reflect removal of 'node' name from labels

test: Update main_test for removal of node label from pod metrics
2020-02-07 14:00:16 +00:00
Alexander-Carpenter 69fe7da267 Rename collector to resource 2020-02-05 19:43:23 -06:00
cedric lamoriniere 8f45cd8444 Add kube_pod_deleted and kube_pod_status_reason
Aim of this PullRequest is to add several new pod metrics:
- kube_pod_deleted: Unix deletion timestamp
- kube_pod_status_reason: The pod status reasons (NodeLost, Evicted)
These new metrics can be used to determine the `pod.status.phase`
displayed by `kubectl`: Running, Terminated, Unknown…
It will allow removing the `kubectl` display logic added previously
to compute the “Unknown” phase.

Signed-off-by: cedric lamoriniere <cedric.lamoriniere@datadoghq.com>
2020-02-05 18:55:21 +01:00
yeya24 da2dadcd3e remove deprecated metrics
Signed-off-by: yeya24 <yb532204897@gmail.com>

remove deprecated options

Signed-off-by: yeya24 <yb532204897@gmail.com>
2020-02-05 08:48:23 -05:00
Thibault Le Reste cb655340d6 Rename black-/whitelist to allow/deny-list 2020-02-03 17:05:11 +01:00
cedric lamoriniere 369470d6ea builder.WithGenerateStoreFunc() is now mandatory
This commit introduces the fact that build.WithGenerateStoreFunc()
needs to be used for configuring properly the `Builder` (like any other
`With...` method.

* rename: `WithCustomGenerateStoreFunc` to `WithGenerateStoreFunc`.
* remove buildStorFunc defaulting in `NewBuilder()` function
* add `DefaultGenerateStoreFunc()` method in `BuilderInterface`
* update `Builder initialisation` in `main.go`

Signed-off-by: cedric lamoriniere <cedric.lamoriniere@datadoghq.com>
2020-01-08 13:45:05 +01:00
rmartinez3 e818d5af0c adding Evicted to reasons terminated
adding evict reason to pod_test

adding to main_test evicted reason metrics
2019-11-26 12:54:58 -06:00
Frederic Branczyk f3d41de450
Add auto detecting of sharding
main_test.go: Add model based test for sharding

In order to ensure a sharded system behaves equal to an unsharded
system, a model based test has been introduced. It scrapes an unsharded
setup and compares its output with the union of a sharded setup
therefore ensuring semantic equality.
2019-08-30 22:45:35 +02:00
Frederic Branczyk 84d61f9a93
Introduce sharding 2019-08-30 13:51:30 +02:00
Lili Cosic 177916445a Address PR comments 2019-08-29 10:21:07 +02:00
Lili Cosic 21b1f61285 *: Add list/watch success/error count total metrics
When kube-state-metrics does not have the correct roles to list or watch
 on a resource, it just logs this error but not actually error out. This
is a problem as the pod never restars and it is hard to catch any
problems as other resource metrics continue to be created correctly. We
only see this error in the noisy kube-state-metrics logs.

This registers two metrics `kube_state_metrics_watch_total` and
`kube_state_metrics_list_total`. With the following labels:
"result" label is the type of action count relates to, error or success.
"resource" label contains the resource <apiVersion.Kind>.

This way we can do a rate alert when kube-state-metrics error rate is
too high.

Example of the metrics:
kube_state_metrics_list_total{resource="*v1.Namespace",result="success"} 1
kube_state_metrics_list_total{resource="*v1.Node",result="error"} 52
kube_state_metrics_watch_total{resource="*v1beta1.Ingress",result="success"} 1
2019-08-28 13:29:07 +02:00
Kubernetes Prow Robot beacbf9169
Merge pull request #835 from pigletfly/pod-unschedulable
feat: add kube_pod_status_unschedulable metric
2019-08-12 01:39:11 -07:00
pigletfly c37f9ae305 feat: add kube_pod_status_unschedulable metric 2019-08-09 23:31:42 +08:00
Tariq Ibrahim 9799ac0e61
Merge release-1.7 into upstream/master 2019-08-05 10:46:00 -07:00
Clayton Coleman a02f1bc874
pods: Add pod_restart_policy metric
Report pod_restart_policy{...,type="Always|OnFailure|Never"} 1 for the
pod.spec.restartPolicy which allows an admin to know how many batch vs
service workload pods are running on the cluster.
2019-07-23 16:10:07 -04:00
Andrey Sidorov 5ae00bb93f add kube_*_annotations metrics for all objects 2019-06-25 22:29:27 +03:00
Kubernetes Prow Robot 5d9ecd2699
Merge pull request #784 from brancz/fair-bench
main_test.go: Fair benchmark
2019-06-14 11:12:23 -07:00
Lili Cosic 68aea02d26 Makefile,internal/collector: Rename collector -> store
Since the removal of collector, this introduces both the concept of the
store and the resources instead of collectors that the user passes in.

The user facing logs and flags were not changed as that would be a
regression.
2019-06-11 16:18:53 +02:00
Lili Cosic cbb7762dc5 *: Remove collector package
collector package was an unnecessary wrapper. This replaces the
.Collect with a call to Store.WriteAll every time a collect is needed.
2019-06-11 16:18:52 +02:00
Frederic Branczyk 035562d5c7
main_test.go: Fair benchmark 2019-06-10 12:48:26 +02:00
Tariq Ibrahim 050ab046ed Add pod init container metrics
Co-Authored-By: Tariq Ibrahim <tariq181290@gmail.com>
Co-Authored-By: Sumit Vij <sumitvij11+github@gmail.com>
2019-05-19 23:18:06 -07:00
Joshua DeWald 25fbfa4bbf Add CreateContainerError and InvalidImageName waiting reasons 2019-05-17 15:10:52 -07:00
Daniel Pacrami b5234baf9c Add DeadlineExceeded pod termination reason
This adds DeadlineExceeded as a valid reason for
kube_pod_container_status_terminated_reason and
kube_pod_container_status_last_terminated_reason
2019-05-06 12:43:55 -04:00
chenk008 f3468ad5d0 change unit test 2019-04-05 02:08:16 +08:00
chenk008 6e866d473f change unit test 2019-04-05 02:05:45 +08:00
tariqibrahim d34c6dc785 lint: add golangci-lint to the CI pipeline of kube-state-metrics 2019-03-04 10:13:18 -08:00
tariqibrahim cd5711c8f4 use cancelable context instead of context.TODO() 2019-02-13 10:13:21 -08:00
Lili Cosic 3498aa7e9e *: Move collectors pkg to internal directory
This makes the rest of the packages useful to be used in a standalone
library without importing the kube-state-metrics specific collectors.

* Rename collectors -> collector package

* Rename metrics -> metric package

* Add metricFamily mocking in tests to prevent cyclic dependency.
2019-01-23 10:51:30 +01:00
tariqibrahim 07dcabadc7 run gofmt -s on all of the source files 2019-01-18 19:33:11 -08:00