@@ -19,16 +19,17 @@ package ibmcsidriver
19
19
20
20
import (
21
21
"fmt"
22
- "google.golang.org/grpc/codes"
23
- "google.golang.org/grpc/status"
24
- "k8s.io/klog/v2"
25
22
"os"
26
23
"path/filepath"
27
24
"runtime"
28
25
"strconv"
29
26
"strings"
30
27
"sync"
31
28
29
+ "google.golang.org/grpc/codes"
30
+ "google.golang.org/grpc/status"
31
+ "k8s.io/klog/v2"
32
+
32
33
"os/exec"
33
34
"time"
34
35
@@ -110,7 +111,7 @@ func (csiNS *CSINodeServer) NodePublishVolume(ctx context.Context, req *csi.Node
110
111
controlleRequestID := publishContext [PublishInfoRequestID ]
111
112
ctxLogger , requestID := utils .GetContextLoggerWithRequestID (ctx , false , & controlleRequestID )
112
113
ctxLogger .Info ("CSINodeServer-NodePublishVolume..." , zap .Reflect ("Request" , * req ))
113
- metrics .UpdateDurationFromStart (ctxLogger , "NodePublishVolume" , time .Now ())
114
+ defer metrics .UpdateDurationFromStart (ctxLogger , "NodePublishVolume" , time .Now ())
114
115
csiNS .mux .Lock ()
115
116
defer csiNS .mux .Unlock ()
116
117
@@ -184,7 +185,7 @@ func (csiNS *CSINodeServer) NodePublishVolume(ctx context.Context, req *csi.Node
184
185
func (csiNS * CSINodeServer ) NodeUnpublishVolume (ctx context.Context , req * csi.NodeUnpublishVolumeRequest ) (* csi.NodeUnpublishVolumeResponse , error ) {
185
186
ctxLogger , requestID := utils .GetContextLogger (ctx , false )
186
187
ctxLogger .Info ("CSINodeServer-NodeUnpublishVolume..." , zap .Reflect ("Request" , * req ))
187
- metrics .UpdateDurationFromStart (ctxLogger , "NodeUnpublishVolume" , time .Now ())
188
+ defer metrics .UpdateDurationFromStart (ctxLogger , "NodeUnpublishVolume" , time .Now ())
188
189
csiNS .mux .Lock ()
189
190
defer csiNS .mux .Unlock ()
190
191
// Validate Arguments
@@ -214,7 +215,7 @@ func (csiNS *CSINodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeSt
214
215
controlleRequestID := publishContext [PublishInfoRequestID ]
215
216
ctxLogger , requestID := utils .GetContextLoggerWithRequestID (ctx , false , & controlleRequestID )
216
217
ctxLogger .Info ("CSINodeServer-NodeStageVolume..." , zap .Reflect ("Request" , * req ))
217
- metrics .UpdateDurationFromStart (ctxLogger , "NodeStageVolume" , time .Now ())
218
+ defer metrics .UpdateDurationFromStart (ctxLogger , "NodeStageVolume" , time .Now ())
218
219
219
220
csiNS .mux .Lock ()
220
221
defer csiNS .mux .Unlock ()
@@ -314,7 +315,7 @@ func (csiNS *CSINodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeSt
314
315
func (csiNS * CSINodeServer ) NodeUnstageVolume (ctx context.Context , req * csi.NodeUnstageVolumeRequest ) (* csi.NodeUnstageVolumeResponse , error ) {
315
316
ctxLogger , requestID := utils .GetContextLogger (ctx , false )
316
317
ctxLogger .Info ("CSINodeServer-NodeUnstageVolume ... " , zap .Reflect ("Request" , * req ))
317
- metrics .UpdateDurationFromStart (ctxLogger , "NodeUnstageVolume" , time .Now ())
318
+ defer metrics .UpdateDurationFromStart (ctxLogger , "NodeUnstageVolume" , time .Now ())
318
319
csiNS .mux .Lock ()
319
320
defer csiNS .mux .Unlock ()
320
321
@@ -400,7 +401,7 @@ func (csiNS *CSINodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.Nod
400
401
var resp * csi.NodeGetVolumeStatsResponse
401
402
ctxLogger , requestID := utils .GetContextLogger (ctx , false )
402
403
ctxLogger .Info ("CSINodeServer-NodeGetVolumeStats... " , zap .Reflect ("Request" , * req )) //nolint:staticcheck
403
- metrics .UpdateDurationFromStart (ctxLogger , "NodeGetVolumeStats" , time .Now ())
404
+ defer metrics .UpdateDurationFromStart (ctxLogger , "NodeGetVolumeStats" , time .Now ())
404
405
if req == nil || req .VolumeId == "" { //nolint:staticcheck
405
406
return nil , commonError .GetCSIError (ctxLogger , commonError .EmptyVolumeID , requestID , nil )
406
407
}
0 commit comments