Skip to content

Commit 38de342

Browse files
authored
Merge pull request #667 from andyzhangx/refine-metrics-naming
chore: refine metrics naming
2 parents d5c6b93 + 42bf2c9 commit 38de342

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
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*/)

pkg/blobplugin/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM k8s.gcr.io/build-image/debian-base:bullseye-v1.1.0
15+
FROM registry.k8s.io/build-image/debian-base:bullseye-v1.2.0
1616

1717
ARG ARCH=amd64
1818
ARG binary=./_output/${ARCH}/blobplugin
1919
COPY ${binary} /blobplugin
2020

21-
RUN apt update && apt upgrade -y && apt-mark unhold libcap2
22-
RUN clean-install ca-certificates uuid-dev util-linux mount udev wget e2fsprogs nfs-common netbase
21+
RUN apt update && apt upgrade -y && apt-mark unhold libcap2 && clean-install ca-certificates uuid-dev util-linux mount udev wget e2fsprogs nfs-common netbase
2322

2423
RUN mkdir /blobfuse-proxy/
2524
COPY ./_output/blobfuse-proxy.deb /blobfuse-proxy/

0 commit comments

Comments
 (0)