util: added logs for slow gRPC calls

This commit adds a gRPC middleware that logs calls that
keep running after their deadline.

Adds --logslowopinterval cmdline argument to pass the log rate.

Signed-off-by: Robert Vasek <robert.vasek@clyso.com>
This commit is contained in:
Robert Vasek
2024-09-17 15:52:30 +02:00
committed by mergify[bot]
parent 56d08e1b4d
commit 7a727c2a43
8 changed files with 114 additions and 14 deletions

View File

@ -199,7 +199,9 @@ func (fs *Driver) Run(conf *util.Config) {
NS: fs.ns,
GS: fs.cs,
}
server.Start(conf.Endpoint, srv)
server.Start(conf.Endpoint, srv, csicommon.MiddlewareServerOptionConfig{
LogSlowOpInterval: conf.LogSlowOpInterval,
})
if conf.EnableProfiling {
go util.StartMetricsServer(conf)
@ -230,7 +232,9 @@ func (fs *Driver) setupCSIAddonsServer(conf *util.Config) error {
}
// start the server, this does not block, it runs a new go-routine
err = fs.cas.Start()
err = fs.cas.Start(csicommon.MiddlewareServerOptionConfig{
LogSlowOpInterval: conf.LogSlowOpInterval,
})
if err != nil {
return fmt.Errorf("failed to start CSI-Addons server: %w", err)
}