@@ -316,6 +316,13 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
316316 GetLatestAccountKey : getLatestAccountKey ,
317317 }
318318
319+ var volumeID string
320+ mc := metrics .NewMetricContext (blobCSIDriverName , "controller_create_volume" , d .cloud .ResourceGroup , d .cloud .SubscriptionID , d .Name )
321+ isOperationSucceeded := false
322+ defer func () {
323+ mc .ObserveOperationWithResult (isOperationSucceeded , VolumeID , volumeID )
324+ }()
325+
319326 var accountKey string
320327 accountName := account
321328 secrets := req .GetSecrets ()
@@ -384,13 +391,6 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
384391 setKeyValueInMap (parameters , containerNameField , validContainerName )
385392 }
386393
387- var volumeID string
388- mc := metrics .NewMetricContext (blobCSIDriverName , "controller_create_volume" , d .cloud .ResourceGroup , d .cloud .SubscriptionID , d .Name )
389- isOperationSucceeded := false
390- defer func () {
391- mc .ObserveOperationWithResult (isOperationSucceeded , VolumeID , volumeID )
392- }()
393-
394394 klog .V (2 ).Infof ("begin to create container(%s) on account(%s) type(%s) subsID(%s) rg(%s) location(%s) size(%d)" , validContainerName , accountName , storageAccountType , subsID , resourceGroup , location , requestGiB )
395395 if err := d .CreateBlobContainer (ctx , subsID , resourceGroup , accountName , validContainerName , secrets ); err != nil {
396396 return nil , status .Errorf (codes .Internal , "failed to create container(%s) on account(%s) type(%s) rg(%s) location(%s) size(%d), error: %v" , validContainerName , accountName , storageAccountType , resourceGroup , location , requestGiB , err )
0 commit comments