kubernetes / kube-state-metrics

Add-on agent to generate and expose cluster-level metrics.
https://kubernetes.io/docs/concepts/cluster-administration/kube-state-metrics/
Apache License 2.0
5.43k stars 2.02k forks source link

default log level should be shown in usage information #2407

Open tcurdt opened 5 months ago

tcurdt commented 5 months ago

What would you like to be added:

Currently:

 -v, --v Level                               number for the log level verbosity

Better:

 -v, --v Level                               number for the log level verbosity (default: 0)

Ideally also explain what each level means.

 -v, --v Level                               number for the log level verbosity (default: 0), increase for more verbose

Why is this needed:

Because it's hard to map the number to a value.

Describe the solution you'd like

See above.

Additional context

Based on docker run --rm -it k8s.gcr.io/kube-state-metrics/kube-state-metrics:v2.3.0 -

tcurdt commented 5 months ago

Speaking of which. I don't understand how to reduce the logging

I0530 20:40:31.458795       1 main.go:111] Using resources cronjobs,daemonsets,deployments,pods,statefulsets
I0530 20:40:31.458856       1 types.go:136] Using all namespace
I0530 20:40:31.458862       1 main.go:133] metric allow-denylisting: Excluding the following lists that were on denylist: 
W0530 20:40:31.458877       1 client_config.go:617] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0530 20:40:31.459138       1 main.go:247] Testing communication with server
I0530 20:40:31.461477       1 main.go:252] Running with Kubernetes cluster version: v1.30. git version: v1.30.1+k3s1. git tree state: clean. commit: 80978b5b9a97908c5520c5ee51984e544e168859. platform: linux/arm64
I0530 20:40:31.461503       1 main.go:254] Communication with server successful
I0530 20:40:31.461601       1 main.go:210] Starting metrics server: [::]:8080
I0530 20:40:31.461710       1 metrics_handler.go:96] Autosharding disabled
I0530 20:40:31.461738       1 main.go:199] Starting kube-state-metrics self metrics server: [::]:8081
I0530 20:40:31.461747       1 main.go:66] levelinfomsgTLS is disabled.http2false
I0530 20:40:31.461759       1 main.go:66] levelinfomsgTLS is disabled.http2false
I0530 20:40:31.461851       1 builder.go:192] Active resources: cronjobs,daemonsets,deployments,pods,statefulsets
W0530 20:40:31.463933       1 reflector.go:324] pkg/mod/k8s.io/client-go@v0.23.0/tools/cache/reflector.go:167: failed to list *v1beta1.CronJob: the server could not find the requested resource
E0530 20:40:31.463957       1 reflector.go:138] pkg/mod/k8s.io/client-go@v0.23.0/tools/cache/reflector.go:167: Failed to watch *v1beta1.CronJob: failed to list *v1beta1.CronJob: the server could not find the requested resource

which here is with --v=0.

dgrisonnet commented 5 months ago

/assign @richabanker /triage accepted