kubernetes-csi / csi-lib-utils

Common code for Kubernetes CSI sidecar containers (e.g. `external-attacher`, `external-provisioner`, etc.)
Apache License 2.0
41 stars 53 forks source link

Add support for pprof for CSI sidecars #137

Closed Fricounet closed 1 year ago

Fricounet commented 1 year ago

Currently, some of the CSI sidecars support pprof profliing (like the azuredisk-csi-driver, the secrets-store-csi-driver or the node-driver-registrar but not all. I believe it could be useful to add this option on all CSI components and this repo seems like a good place to do it.

It could probably go in the metrics.go file in the CSIMetricsManager interface with a RegisterPprofToServer function that would register the pprof handlers.

What do you folks think about it? I would be happy to contribute this (and the implementation in the CSI sidecars) if that is something folks are willing to see 😄

xing-yang commented 1 year ago

Hi @Fricounet , we discussed about this and agreed this is useful. Please go ahead and submit PRs. Thanks!

jsafrane commented 1 year ago

I like it, but please make it configurable via --enable-pprof or something similar. Some CSI drivers need to use host network, i.e. the port for metrics + pprof will be open on the node. And at the same time, people may not like exposing CPU profiles, heap data and whatnot publicly on that node.