Commit Graph

125 Commits

Author SHA1 Message Date
Min Wang bde6d151ef
fix linter check 2021-10-19 11:20:18 -07:00
Min Wang c6ec339eea
address comments 2021-10-19 11:20:18 -07:00
Min Wang 77418c7dba
Add namespace denied list 2021-10-19 11:20:17 -07:00
Sylvain Rabot 0e45534441
Merge remote-tracking branch 'origin/master' into annotations 2021-08-19 16:31:20 +02:00
Lan Liang 185687e6ad Change useApiServerCache to useAPIServerCache 2021-08-16 22:16:24 +08:00
Sylvain Rabot 96d08df5d0
Merge remote-tracking branch 'origin/master' into annotations 2021-08-16 08:50:02 +02:00
Lan Liang 3bbd8d5a88 Add arg use-api-server-cache to set resourceVersion=0 for ListWatch 2021-08-13 13:12:36 +08:00
Kubernetes Prow Robot 1d61fc1461
Merge pull request #1499 from fpetkovski/fix-multiwatcher
Replace multiListerWatcher with independent listWatchers per namespace
2021-07-14 05:32:26 -07:00
Manuel Rüger d5dcb84ee7 go.mod: Update and minimize dependencies
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2021-07-13 18:11:26 +02:00
fpetkovski a6eb25e3c6 rename buildStore to buildStores 2021-06-29 13:30:46 +02:00
Sylvain Rabot 65bc62af5c
Add kube_*_annotations metrics
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
2021-04-29 16:04:16 +02:00
Mayank Shah ec2a3ff831 Add support for native TLS
- introduce new flag `tls-config` to pass the path to tls config file

Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
2021-01-25 13:03:05 +05:30
Ben Ye 6a32904d1f add build_info metric for KSM
Signed-off-by: Ben Ye <yb532204897@gmail.com>
2021-01-06 10:50:02 -05:00
Lili Cosic 4093cb34de Adjust klog to klog/v2 2020-10-05 15:29:12 +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
Ben Ye 4d8d85f467 use promauto to register metrics
Signed-off-by: Ben Ye <yb532204897@gmail.com>
2020-09-13 19:07:47 -04:00
Lili Cosic 801690bd95 main.go: Add http request metric for kube-state-metrics main /metrics 2020-09-08 15:15:56 +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
Mathis Raguin 8f78129e66
main: make all contexts child of a root context
Signed-off-by: Mathis Raguin <mathis@cri.epita.fr>
2020-07-27 14:44:46 +02:00
Mathis Raguin f323cdb944
main: move context to local scope
Signed-off-by: Mathis Raguin <mathis@cri.epita.fr>
2020-07-27 11:35:14 +02:00
Mathis Raguin 8bb033103d
main: fix linting
Signed-off-by: Mathis Raguin <mathis@cri.epita.fr>
2020-07-27 11:34:16 +02:00
Mathis Raguin 556ee3a8d6
main: use own context for each group and a timeout
Signed-off-by: Mathis Raguin <mathis@cri.epita.fr>
2020-07-27 11:19:50 +02:00
Mathis Raguin 3b6a93a35d
main: error handling in run group 2020-07-24 18:07:15 +02:00
Mathis Raguin e38b7aaefe
main: graceful shutdown
Signed-off-by: Mathis Raguin <mathis@cri.epita.fr>
2020-07-24 17:59:17 +02:00
Mathis Raguin 56ce7ed701
main: move to run groups
The current implementation can be improved by handling Graceful
Shutdowns of the HTTP Servers.

Signed-off-by: Mathis Raguin <mathis@cri.epita.fr>
2020-07-24 17:25:18 +02:00
Alexander-Carpenter 69fe7da267 Rename collector to resource 2020-02-05 19:43:23 -06: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
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
Tariq Ibrahim 51def15afa
use MustRegister instead of Register 2019-08-29 13:53:10 -07: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
tariqibrahim 44319dbb0d vendor: remove unnecessary dependencies from the project. 2019-07-21 14:59:22 -07:00
Kubernetes Prow Robot 0ffcc30a0f
Merge pull request #791 from monzo/vertical-pod-autoscaler-metrics
store: add metrics for VerticalPodAutoscaler objects
2019-06-20 06:02:49 -07:00
Miles Bryant 67ef5ecc9c
store: add verticalpodautoscaler metrics 2019-06-20 12:24:37 +01:00
Kubernetes Prow Robot 3b1c7c268d
Merge pull request #773 from tariq1890/regex
feat: implement black/white- listing of metrics by regex
2019-06-19 06:48:32 -07:00
Tariq Ibrahim 2a3c696347
feat: implement black/white- listing of metrics by regex 2019-06-19 02:16:52 -07:00
Miles Bryant e1b45de7f6
builder/main: allow collectors not enabled by default
This fixes an issue where it was impossible to specify a collector that
was available but not selected by default.

Instead of checking whether chosen collectors are valid at flag parse
time, this moves the check into the builder, where we can reference it
against the availableStores in the builder. As a bonus, the error
message also prints out a list of available collectors:

```
kube-state-metrics --collectors non-existent-collector
I0618 15:23:34.517532   50719 main.go:88] Using collectors non-existent-collector
F0618 15:23:34.519132   50719 main.go:90] Error: collector non-existent-collector does not exist. Available collectors: persistentvolumeclaims,configmaps,limitranges,nodes,namespaces,persistentvolumes,pods,replicasets,services,cronjobs,deployments,ingresses,horizontalpodautoscalers,jobs,poddisruptionbudgets,secrets,certificatesigningrequests,daemonsets,endpoints,storageclasses,replicationcontrollers,resourcequotas,statefulsets
```
2019-06-18 16:28:11 +01: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
Tariq Ibrahim 9bcb1959a5
return standardized test for health endpoint 2019-05-24 09:51:04 -07:00
tariqibrahim d1c88bd26a use a more idiomatic way of handling error messages 2019-04-14 00:00:51 -07:00
tariqibrahim 169d841e41 update the prometheus_client_golang dependency to the latest version: v0.9.2 2019-03-28 13:13:01 -07:00
tariqibrahim 1d4c741f84 use klog instead of glog 2019-02-19 20:03:04 -08:00
tariqibrahim cd5711c8f4 use cancelable context instead of context.TODO() 2019-02-13 10:13:21 -08:00
tariqibrahim ab128fedf4 correct some typographical mistakes in kube-state-metrics 2019-02-02 21:55:12 -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
Andreas Kohn 509a0dbc33
Remove the obsolete metrics code
These stopped getting populated with 234d788a0d, and
cannot be restored easily.

Related-to: #623
2019-01-10 12:08:12 +01:00