Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for calculating time for all node servers method #153

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/ibmcsidriver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (csiCS *CSIControllerServer) ControllerPublishVolume(ctx context.Context, r
lockWaitStart := time.Now()
csiCS.mutex.Lock(nodeID)
defer csiCS.mutex.Unlock(nodeID)
metrics.UpdateDurationFromStart(ctxLogger, metrics.FunctionLabel("ControllerPublishVolume.Lock"), lockWaitStart)
defer metrics.UpdateDurationFromStart(ctxLogger, metrics.FunctionLabel("ControllerPublishVolume.Lock"), lockWaitStart)

volumeCapabilities := []*csi.VolumeCapability{volumeCapability}
// Validate volume capabilities, are all capabilities supported by driver or not
Expand Down
17 changes: 9 additions & 8 deletions pkg/ibmcsidriver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ package ibmcsidriver

import (
"fmt"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog/v2"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog/v2"

"os/exec"
"time"

Expand Down Expand Up @@ -110,7 +111,7 @@ func (csiNS *CSINodeServer) NodePublishVolume(ctx context.Context, req *csi.Node
controlleRequestID := publishContext[PublishInfoRequestID]
ctxLogger, requestID := utils.GetContextLoggerWithRequestID(ctx, false, &controlleRequestID)
ctxLogger.Info("CSINodeServer-NodePublishVolume...", zap.Reflect("Request", *req))
metrics.UpdateDurationFromStart(ctxLogger, "NodePublishVolume", time.Now())
defer metrics.UpdateDurationFromStart(ctxLogger, "NodePublishVolume", time.Now())
csiNS.mux.Lock()
defer csiNS.mux.Unlock()

Expand Down Expand Up @@ -184,7 +185,7 @@ func (csiNS *CSINodeServer) NodePublishVolume(ctx context.Context, req *csi.Node
func (csiNS *CSINodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
ctxLogger, requestID := utils.GetContextLogger(ctx, false)
ctxLogger.Info("CSINodeServer-NodeUnpublishVolume...", zap.Reflect("Request", *req))
metrics.UpdateDurationFromStart(ctxLogger, "NodeUnpublishVolume", time.Now())
defer metrics.UpdateDurationFromStart(ctxLogger, "NodeUnpublishVolume", time.Now())
csiNS.mux.Lock()
defer csiNS.mux.Unlock()
// Validate Arguments
Expand Down Expand Up @@ -214,7 +215,7 @@ func (csiNS *CSINodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeSt
controlleRequestID := publishContext[PublishInfoRequestID]
ctxLogger, requestID := utils.GetContextLoggerWithRequestID(ctx, false, &controlleRequestID)
ctxLogger.Info("CSINodeServer-NodeStageVolume...", zap.Reflect("Request", *req))
metrics.UpdateDurationFromStart(ctxLogger, "NodeStageVolume", time.Now())
defer metrics.UpdateDurationFromStart(ctxLogger, "NodeStageVolume", time.Now())

csiNS.mux.Lock()
defer csiNS.mux.Unlock()
Expand Down Expand Up @@ -314,7 +315,7 @@ func (csiNS *CSINodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeSt
func (csiNS *CSINodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
ctxLogger, requestID := utils.GetContextLogger(ctx, false)
ctxLogger.Info("CSINodeServer-NodeUnstageVolume ... ", zap.Reflect("Request", *req))
metrics.UpdateDurationFromStart(ctxLogger, "NodeUnstageVolume", time.Now())
defer metrics.UpdateDurationFromStart(ctxLogger, "NodeUnstageVolume", time.Now())
csiNS.mux.Lock()
defer csiNS.mux.Unlock()

Expand Down Expand Up @@ -400,7 +401,7 @@ func (csiNS *CSINodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.Nod
var resp *csi.NodeGetVolumeStatsResponse
ctxLogger, requestID := utils.GetContextLogger(ctx, false)
ctxLogger.Info("CSINodeServer-NodeGetVolumeStats... ", zap.Reflect("Request", *req)) //nolint:staticcheck
metrics.UpdateDurationFromStart(ctxLogger, "NodeGetVolumeStats", time.Now())
defer metrics.UpdateDurationFromStart(ctxLogger, "NodeGetVolumeStats", time.Now())
if req == nil || req.VolumeId == "" { //nolint:staticcheck
return nil, commonError.GetCSIError(ctxLogger, commonError.EmptyVolumeID, requestID, nil)
}
Expand Down