Skip to content

Commit 2573d6c

Browse files
committed
chore: refine metrics naming
1 parent d5c6b93 commit 2573d6c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pkg/blob/blob.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ const (
109109
pvcNameKey = "csi.storage.k8s.io/pvc/name"
110110
pvcNamespaceKey = "csi.storage.k8s.io/pvc/namespace"
111111
pvNameKey = "csi.storage.k8s.io/pv/name"
112+
113+
VolumeID = "volumeid"
112114
)
113115

114116
var (

pkg/blob/controllerserver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
297297
mc := metrics.NewMetricContext(blobCSIDriverName, "controller_create_volume", d.cloud.ResourceGroup, d.cloud.SubscriptionID, d.Name)
298298
isOperationSucceeded := false
299299
defer func() {
300-
mc.ObserveOperationWithResult(isOperationSucceeded, volumeID, "")
300+
mc.ObserveOperationWithResult(isOperationSucceeded, VolumeID, volumeID)
301301
}()
302302

303303
klog.V(2).Infof("begin to create container(%s) on account(%s) type(%s) rg(%s) location(%s) size(%d)", validContainerName, accountName, storageAccountType, resourceGroup, location, requestGiB)
@@ -384,7 +384,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
384384
mc := metrics.NewMetricContext(blobCSIDriverName, "controller_delete_volume", d.cloud.ResourceGroup, d.cloud.SubscriptionID, d.Name)
385385
isOperationSucceeded := false
386386
defer func() {
387-
mc.ObserveOperationWithResult(isOperationSucceeded, volumeID, "")
387+
mc.ObserveOperationWithResult(isOperationSucceeded, VolumeID, volumeID)
388388
}()
389389

390390
klog.V(2).Infof("deleting container(%s) rg(%s) account(%s) volumeID(%s)", containerName, resourceGroupName, accountName, volumeID)

pkg/blob/nodeserver.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ func (d *Driver) mountBlobfuseInsideDriver(args string, authEnv []string) (strin
174174

175175
// NodeUnpublishVolume unmount the volume from the target path
176176
func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
177-
if len(req.GetVolumeId()) == 0 {
177+
volumeID := req.GetVolumeId()
178+
if len(volumeID) == 0 {
178179
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
179180
}
180-
if len(req.GetTargetPath()) == 0 {
181+
targetPath := req.GetTargetPath()
182+
if len(targetPath) == 0 {
181183
return nil, status.Error(codes.InvalidArgument, "Target path missing in request")
182184
}
183-
targetPath := req.GetTargetPath()
184-
volumeID := req.GetVolumeId()
185185

186186
klog.V(2).Infof("NodeUnpublishVolume: unmounting volume %s on %s", volumeID, targetPath)
187187
err := mount.CleanupMountPoint(targetPath, d.mounter, true /*extensiveMountPointCheck*/)

0 commit comments

Comments
 (0)