@azure/storage-queue 12.20.0-alpha.20230615.1 → 12.20.0-alpha.20230616.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -330,6 +330,8 @@ function ipRangeToString(ipRange) {
330
330
  }
331
331
 
332
332
  // Copyright (c) Microsoft Corporation.
333
+ // Licensed under the MIT license.
334
+ const SDK_VERSION$1 = "12.20.0";
333
335
  const SERVICE_VERSION = "2021-10-04";
334
336
  const DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
335
337
  AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
@@ -5040,8 +5042,9 @@ function getStorageClientContext(url, pipeline) {
5040
5042
  * Creates a span using the global tracer.
5041
5043
  * @internal
5042
5044
  */
5043
- const createSpan = coreTracing.createSpanFunction({
5044
- packagePrefix: "Azure.Storage.Queue",
5045
+ const tracingClient = coreTracing.createTracingClient({
5046
+ packageName: "@azure/storage-queue",
5047
+ packageVersion: SDK_VERSION$1,
5045
5048
  namespace: "Microsoft.Storage",
5046
5049
  });
5047
5050
 
@@ -5280,20 +5283,9 @@ class QueueClient extends StorageClient {
5280
5283
  * ```
5281
5284
  */
5282
5285
  async create(options = {}) {
5283
- const { span, updatedOptions } = createSpan("QueueClient-create", options);
5284
- try {
5286
+ return tracingClient.withSpan("QueueClient-create", options, async (updatedOptions) => {
5285
5287
  return assertResponse(await this.queueContext.create(updatedOptions));
5286
- }
5287
- catch (e) {
5288
- span.setStatus({
5289
- code: coreTracing.SpanStatusCode.ERROR,
5290
- message: e.message,
5291
- });
5292
- throw e;
5293
- }
5294
- finally {
5295
- span.end();
5296
- }
5288
+ });
5297
5289
  }
5298
5290
  /**
5299
5291
  * Creates a new queue under the specified account if it doesn't already exist.
@@ -5303,35 +5295,25 @@ class QueueClient extends StorageClient {
5303
5295
  * @param options -
5304
5296
  */
5305
5297
  async createIfNotExists(options = {}) {
5306
- var _a, _b;
5307
- const { span, updatedOptions } = createSpan("QueueClient-createIfNotExists", options);
5308
- try {
5309
- const response = await this.create(updatedOptions);
5310
- // When a queue with the specified name already exists, the Queue service checks the metadata associated with the existing queue.
5311
- // If the existing metadata is identical to the metadata specified on the Create Queue request, status code 204 (No Content) is returned.
5312
- // If the existing metadata does not match, the operation fails and status code 409 (Conflict) is returned.
5313
- if (response._response.status === 204) {
5314
- return Object.assign({ succeeded: false }, response);
5298
+ return tracingClient.withSpan("QueueClient-createIfNotExists", options, async (updatedOptions) => {
5299
+ var _a, _b;
5300
+ try {
5301
+ const response = await this.create(updatedOptions);
5302
+ // When a queue with the specified name already exists, the Queue service checks the metadata associated with the existing queue.
5303
+ // If the existing metadata is identical to the metadata specified on the Create Queue request, status code 204 (No Content) is returned.
5304
+ // If the existing metadata does not match, the operation fails and status code 409 (Conflict) is returned.
5305
+ if (response._response.status === 204) {
5306
+ return Object.assign({ succeeded: false }, response);
5307
+ }
5308
+ return Object.assign({ succeeded: true }, response);
5315
5309
  }
5316
- return Object.assign({ succeeded: true }, response);
5317
- }
5318
- catch (e) {
5319
- if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "QueueAlreadyExists") {
5320
- span.setStatus({
5321
- code: coreTracing.SpanStatusCode.ERROR,
5322
- message: "Expected exception when creating a queue only if it does not already exist.",
5323
- });
5324
- return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
5310
+ catch (e) {
5311
+ if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "QueueAlreadyExists") {
5312
+ return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
5313
+ }
5314
+ throw e;
5325
5315
  }
5326
- span.setStatus({
5327
- code: coreTracing.SpanStatusCode.ERROR,
5328
- message: e.message,
5329
- });
5330
- throw e;
5331
- }
5332
- finally {
5333
- span.end();
5334
- }
5316
+ });
5335
5317
  }
5336
5318
  /**
5337
5319
  * Deletes the specified queue permanently if it exists.
@@ -5340,29 +5322,19 @@ class QueueClient extends StorageClient {
5340
5322
  * @param options -
5341
5323
  */
5342
5324
  async deleteIfExists(options = {}) {
5343
- var _a, _b;
5344
- const { span, updatedOptions } = createSpan("QueueClient-deleteIfExists", options);
5345
- try {
5346
- const res = await this.delete(updatedOptions);
5347
- return Object.assign({ succeeded: true }, res);
5348
- }
5349
- catch (e) {
5350
- if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "QueueNotFound") {
5351
- span.setStatus({
5352
- code: coreTracing.SpanStatusCode.ERROR,
5353
- message: "Expected exception when deleting a queue only if it exists.",
5354
- });
5355
- return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
5325
+ return tracingClient.withSpan("QueueClient-deleteIfExists", options, async (updatedOptions) => {
5326
+ var _a, _b;
5327
+ try {
5328
+ const res = await this.delete(updatedOptions);
5329
+ return Object.assign({ succeeded: true }, res);
5356
5330
  }
5357
- span.setStatus({
5358
- code: coreTracing.SpanStatusCode.ERROR,
5359
- message: e.message,
5360
- });
5361
- throw e;
5362
- }
5363
- finally {
5364
- span.end();
5365
- }
5331
+ catch (e) {
5332
+ if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "QueueNotFound") {
5333
+ return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
5334
+ }
5335
+ throw e;
5336
+ }
5337
+ });
5366
5338
  }
5367
5339
  /**
5368
5340
  * Deletes the specified queue permanently.
@@ -5381,23 +5353,12 @@ class QueueClient extends StorageClient {
5381
5353
  * ```
5382
5354
  */
5383
5355
  async delete(options = {}) {
5384
- const { span, updatedOptions } = createSpan("QueueClient-delete", options);
5385
- try {
5356
+ return tracingClient.withSpan("QueueClient-delete", options, async (updatedOptions) => {
5386
5357
  return assertResponse(await this.queueContext.delete({
5387
5358
  abortSignal: options.abortSignal,
5388
5359
  tracingOptions: updatedOptions.tracingOptions,
5389
5360
  }));
5390
- }
5391
- catch (e) {
5392
- span.setStatus({
5393
- code: coreTracing.SpanStatusCode.ERROR,
5394
- message: e.message,
5395
- });
5396
- throw e;
5397
- }
5398
- finally {
5399
- span.end();
5400
- }
5361
+ });
5401
5362
  }
5402
5363
  /**
5403
5364
  * Returns true if the specified queue exists; false otherwise.
@@ -5409,31 +5370,18 @@ class QueueClient extends StorageClient {
5409
5370
  * @param options - options to Exists operation.
5410
5371
  */
5411
5372
  async exists(options = {}) {
5412
- const { span, updatedOptions } = createSpan("QueueClient-exists", options);
5413
- try {
5414
- await this.getProperties({
5415
- abortSignal: options.abortSignal,
5416
- tracingOptions: updatedOptions.tracingOptions,
5417
- });
5418
- return true;
5419
- }
5420
- catch (e) {
5421
- if (e.statusCode === 404) {
5422
- span.setStatus({
5423
- code: coreTracing.SpanStatusCode.ERROR,
5424
- message: "Expected exception when checking queue existence",
5425
- });
5426
- return false;
5373
+ return tracingClient.withSpan("QueueClient-exists", options, async (updatedOptions) => {
5374
+ try {
5375
+ await this.getProperties(updatedOptions);
5376
+ return true;
5427
5377
  }
5428
- span.setStatus({
5429
- code: coreTracing.SpanStatusCode.ERROR,
5430
- message: e.message,
5431
- });
5432
- throw e;
5433
- }
5434
- finally {
5435
- span.end();
5436
- }
5378
+ catch (e) {
5379
+ if (e.statusCode === 404) {
5380
+ return false;
5381
+ }
5382
+ throw e;
5383
+ }
5384
+ });
5437
5385
  }
5438
5386
  /**
5439
5387
  * Gets all user-defined metadata and system properties for the specified
@@ -5449,23 +5397,9 @@ class QueueClient extends StorageClient {
5449
5397
  * @returns Response data for the Queue get properties operation.
5450
5398
  */
5451
5399
  async getProperties(options = {}) {
5452
- const { span, updatedOptions } = createSpan("QueueClient-getProperties", options);
5453
- try {
5454
- return assertResponse(await this.queueContext.getProperties({
5455
- abortSignal: options.abortSignal,
5456
- tracingOptions: updatedOptions.tracingOptions,
5457
- }));
5458
- }
5459
- catch (e) {
5460
- span.setStatus({
5461
- code: coreTracing.SpanStatusCode.ERROR,
5462
- message: e.message,
5463
- });
5464
- throw e;
5465
- }
5466
- finally {
5467
- span.end();
5468
- }
5400
+ return tracingClient.withSpan("QueueClient-getProperties", options, async (updatedOptions) => {
5401
+ return assertResponse(await this.queueContext.getProperties(updatedOptions));
5402
+ });
5469
5403
  }
5470
5404
  /**
5471
5405
  * Sets one or more user-defined name-value pairs for the specified queue.
@@ -5479,24 +5413,9 @@ class QueueClient extends StorageClient {
5479
5413
  * @returns Response data for the Queue set metadata operation.
5480
5414
  */
5481
5415
  async setMetadata(metadata, options = {}) {
5482
- const { span, updatedOptions } = createSpan("QueueClient-setMetadata", options);
5483
- try {
5484
- return assertResponse(await this.queueContext.setMetadata({
5485
- abortSignal: options.abortSignal,
5486
- metadata,
5487
- tracingOptions: updatedOptions.tracingOptions,
5488
- }));
5489
- }
5490
- catch (e) {
5491
- span.setStatus({
5492
- code: coreTracing.SpanStatusCode.ERROR,
5493
- message: e.message,
5494
- });
5495
- throw e;
5496
- }
5497
- finally {
5498
- span.end();
5499
- }
5416
+ return tracingClient.withSpan("QueueClient-setMetadata", options, async (updatedOptions) => {
5417
+ return assertResponse(await this.queueContext.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
5418
+ });
5500
5419
  }
5501
5420
  /**
5502
5421
  * Gets details about any stored access policies specified on the queue that may be used with Shared Access Signatures.
@@ -5510,8 +5429,7 @@ class QueueClient extends StorageClient {
5510
5429
  * @returns Response data for the Queue get access policy operation.
5511
5430
  */
5512
5431
  async getAccessPolicy(options = {}) {
5513
- const { span, updatedOptions } = createSpan("QueueClient-getAccessPolicy", options);
5514
- try {
5432
+ return tracingClient.withSpan("QueueClient-getAccessPolicy", options, async (updatedOptions) => {
5515
5433
  const response = assertResponse(await this.queueContext.getAccessPolicy({
5516
5434
  abortSignal: options.abortSignal,
5517
5435
  tracingOptions: updatedOptions.tracingOptions,
@@ -5544,17 +5462,7 @@ class QueueClient extends StorageClient {
5544
5462
  });
5545
5463
  }
5546
5464
  return res;
5547
- }
5548
- catch (e) {
5549
- span.setStatus({
5550
- code: coreTracing.SpanStatusCode.ERROR,
5551
- message: e.message,
5552
- });
5553
- throw e;
5554
- }
5555
- finally {
5556
- span.end();
5557
- }
5465
+ });
5558
5466
  }
5559
5467
  /**
5560
5468
  * Sets stored access policies for the queue that may be used with Shared Access Signatures.
@@ -5565,8 +5473,7 @@ class QueueClient extends StorageClient {
5565
5473
  * @returns Response data for the Queue set access policy operation.
5566
5474
  */
5567
5475
  async setAccessPolicy(queueAcl, options = {}) {
5568
- const { span, updatedOptions } = createSpan("QueueClient-setAccessPolicy", options);
5569
- try {
5476
+ return tracingClient.withSpan("QueueClient-setAccessPolicy", options, async (updatedOptions) => {
5570
5477
  const acl = [];
5571
5478
  for (const identifier of queueAcl || []) {
5572
5479
  acl.push({
@@ -5582,22 +5489,8 @@ class QueueClient extends StorageClient {
5582
5489
  id: identifier.id,
5583
5490
  });
5584
5491
  }
5585
- return assertResponse(await this.queueContext.setAccessPolicy({
5586
- abortSignal: options.abortSignal,
5587
- queueAcl: acl,
5588
- tracingOptions: updatedOptions.tracingOptions,
5589
- }));
5590
- }
5591
- catch (e) {
5592
- span.setStatus({
5593
- code: coreTracing.SpanStatusCode.ERROR,
5594
- message: e.message,
5595
- });
5596
- throw e;
5597
- }
5598
- finally {
5599
- span.end();
5600
- }
5492
+ return assertResponse(await this.queueContext.setAccessPolicy(Object.assign(Object.assign({}, updatedOptions), { queueAcl: acl })));
5493
+ });
5601
5494
  }
5602
5495
  /**
5603
5496
  * Clear deletes all messages from a queue.
@@ -5607,23 +5500,9 @@ class QueueClient extends StorageClient {
5607
5500
  * @returns Response data for the clear messages operation.
5608
5501
  */
5609
5502
  async clearMessages(options = {}) {
5610
- const { span, updatedOptions } = createSpan("QueueClient-clearMessages", options);
5611
- try {
5612
- return assertResponse(await this.messagesContext.clear({
5613
- abortSignal: options.abortSignal,
5614
- tracingOptions: updatedOptions.tracingOptions,
5615
- }));
5616
- }
5617
- catch (e) {
5618
- span.setStatus({
5619
- code: coreTracing.SpanStatusCode.ERROR,
5620
- message: e.message,
5621
- });
5622
- throw e;
5623
- }
5624
- finally {
5625
- span.end();
5626
- }
5503
+ return tracingClient.withSpan("QueueClient-clearMessages", options, async (updatedOptions) => {
5504
+ return assertResponse(await this.messagesContext.clear(updatedOptions));
5505
+ });
5627
5506
  }
5628
5507
  /**
5629
5508
  * sendMessage adds a new message to the back of a queue. The visibility timeout specifies how long
@@ -5647,8 +5526,7 @@ class QueueClient extends StorageClient {
5647
5526
  * ```
5648
5527
  */
5649
5528
  async sendMessage(messageText, options = {}) {
5650
- const { span, updatedOptions } = createSpan("QueueClient-sendMessage", options);
5651
- try {
5529
+ return tracingClient.withSpan("QueueClient-sendMessage", options, async (updatedOptions) => {
5652
5530
  const response = assertResponse(await this.messagesContext.enqueue({
5653
5531
  messageText: messageText,
5654
5532
  }, updatedOptions));
@@ -5666,17 +5544,7 @@ class QueueClient extends StorageClient {
5666
5544
  insertedOn: item.insertedOn,
5667
5545
  expiresOn: item.expiresOn,
5668
5546
  };
5669
- }
5670
- catch (e) {
5671
- span.setStatus({
5672
- code: coreTracing.SpanStatusCode.ERROR,
5673
- message: e.message,
5674
- });
5675
- throw e;
5676
- }
5677
- finally {
5678
- span.end();
5679
- }
5547
+ });
5680
5548
  }
5681
5549
  /**
5682
5550
  * receiveMessages retrieves one or more messages from the front of the queue.
@@ -5704,8 +5572,7 @@ class QueueClient extends StorageClient {
5704
5572
  * ```
5705
5573
  */
5706
5574
  async receiveMessages(options = {}) {
5707
- const { span, updatedOptions } = createSpan("QueueClient-receiveMessages", options);
5708
- try {
5575
+ return tracingClient.withSpan("QueueClient-receiveMessages", options, async (updatedOptions) => {
5709
5576
  const response = assertResponse(await this.messagesContext.dequeue(updatedOptions));
5710
5577
  const res = {
5711
5578
  _response: response._response,
@@ -5720,17 +5587,7 @@ class QueueClient extends StorageClient {
5720
5587
  res.receivedMessageItems.push(item);
5721
5588
  }
5722
5589
  return res;
5723
- }
5724
- catch (e) {
5725
- span.setStatus({
5726
- code: coreTracing.SpanStatusCode.ERROR,
5727
- message: e.message,
5728
- });
5729
- throw e;
5730
- }
5731
- finally {
5732
- span.end();
5733
- }
5590
+ });
5734
5591
  }
5735
5592
  /**
5736
5593
  * peekMessages retrieves one or more messages from the front of the queue but does not alter the visibility of the message.
@@ -5747,8 +5604,7 @@ class QueueClient extends StorageClient {
5747
5604
  * ```
5748
5605
  */
5749
5606
  async peekMessages(options = {}) {
5750
- const { span, updatedOptions } = createSpan("QueueClient-peekMessages", options);
5751
- try {
5607
+ return tracingClient.withSpan("QueueClient-peekMessages", options, async (updatedOptions) => {
5752
5608
  const response = assertResponse(await this.messagesContext.peek(updatedOptions));
5753
5609
  const res = {
5754
5610
  _response: response._response,
@@ -5763,17 +5619,7 @@ class QueueClient extends StorageClient {
5763
5619
  res.peekedMessageItems.push(item);
5764
5620
  }
5765
5621
  return res;
5766
- }
5767
- catch (e) {
5768
- span.setStatus({
5769
- code: coreTracing.SpanStatusCode.ERROR,
5770
- message: e.message,
5771
- });
5772
- throw e;
5773
- }
5774
- finally {
5775
- span.end();
5776
- }
5622
+ });
5777
5623
  }
5778
5624
  /**
5779
5625
  * deleteMessage permanently removes the specified message from its queue.
@@ -5785,23 +5631,9 @@ class QueueClient extends StorageClient {
5785
5631
  * @returns Response data for the delete message operation.
5786
5632
  */
5787
5633
  async deleteMessage(messageId, popReceipt, options = {}) {
5788
- const { span, updatedOptions } = createSpan("QueueClient-deleteMessage", options);
5789
- try {
5790
- return assertResponse(await this.getMessageIdContext(messageId).delete(popReceipt, {
5791
- abortSignal: options.abortSignal,
5792
- tracingOptions: updatedOptions.tracingOptions,
5793
- }));
5794
- }
5795
- catch (e) {
5796
- span.setStatus({
5797
- code: coreTracing.SpanStatusCode.ERROR,
5798
- message: e.message,
5799
- });
5800
- throw e;
5801
- }
5802
- finally {
5803
- span.end();
5804
- }
5634
+ return tracingClient.withSpan("QueueClient-deleteMessage", options, async (updatedOptions) => {
5635
+ return assertResponse(await this.getMessageIdContext(messageId).delete(popReceipt, updatedOptions));
5636
+ });
5805
5637
  }
5806
5638
  /**
5807
5639
  * Update changes a message's visibility timeout and contents.
@@ -5821,28 +5653,17 @@ class QueueClient extends StorageClient {
5821
5653
  * @returns Response data for the update message operation.
5822
5654
  */
5823
5655
  async updateMessage(messageId, popReceipt, message, visibilityTimeout, options = {}) {
5824
- const { span, updatedOptions } = createSpan("QueueClient-updateMessage", options);
5825
- let queueMessage = undefined;
5826
- if (message !== undefined) {
5827
- queueMessage = { messageText: message };
5828
- }
5829
- try {
5656
+ return tracingClient.withSpan("QueueClient-updateMessage", options, async (updatedOptions) => {
5657
+ let queueMessage = undefined;
5658
+ if (message !== undefined) {
5659
+ queueMessage = { messageText: message };
5660
+ }
5830
5661
  return assertResponse(await this.getMessageIdContext(messageId).update(popReceipt, visibilityTimeout || 0, {
5831
5662
  abortSignal: options.abortSignal,
5832
5663
  tracingOptions: updatedOptions.tracingOptions,
5833
5664
  queueMessage,
5834
5665
  }));
5835
- }
5836
- catch (e) {
5837
- span.setStatus({
5838
- code: coreTracing.SpanStatusCode.ERROR,
5839
- message: e.message,
5840
- });
5841
- throw e;
5842
- }
5843
- finally {
5844
- span.end();
5845
- }
5666
+ });
5846
5667
  }
5847
5668
  getQueueNameFromUrl() {
5848
5669
  let queueName;
@@ -5994,30 +5815,12 @@ class QueueServiceClient extends StorageClient {
5994
5815
  * @returns Response data for the list queues segment operation.
5995
5816
  */
5996
5817
  async listQueuesSegment(marker, options = {}) {
5997
- const { span, updatedOptions } = createSpan("QueueServiceClient-listQueuesSegment", options);
5998
5818
  if (options.prefix === "") {
5999
5819
  options.prefix = undefined;
6000
5820
  }
6001
- try {
6002
- return assertResponse(await this.serviceContext.listQueuesSegment({
6003
- abortSignal: options.abortSignal,
6004
- marker: marker,
6005
- maxPageSize: options.maxPageSize,
6006
- prefix: options.prefix,
6007
- include: options.include === undefined ? undefined : [options.include],
6008
- tracingOptions: updatedOptions.tracingOptions,
6009
- }));
6010
- }
6011
- catch (e) {
6012
- span.setStatus({
6013
- code: coreTracing.SpanStatusCode.ERROR,
6014
- message: e.message,
6015
- });
6016
- throw e;
6017
- }
6018
- finally {
6019
- span.end();
6020
- }
5821
+ return tracingClient.withSpan("QueueServiceClient-listQueuesSegment", options, async (updatedOptions) => {
5822
+ return assertResponse(await this.serviceContext.listQueuesSegment(Object.assign(Object.assign({}, updatedOptions), { marker, include: options.include === undefined ? undefined : [options.include] })));
5823
+ });
6021
5824
  }
6022
5825
  /**
6023
5826
  * Returns an AsyncIterableIterator for {@link ServiceListQueuesSegmentResponse} objects
@@ -6194,23 +5997,9 @@ class QueueServiceClient extends StorageClient {
6194
5997
  * @returns Response data including the queue service properties.
6195
5998
  */
6196
5999
  async getProperties(options = {}) {
6197
- const { span, updatedOptions } = createSpan("QueueServiceClient-getProperties", options);
6198
- try {
6199
- return assertResponse(await this.serviceContext.getProperties({
6200
- abortSignal: options.abortSignal,
6201
- tracingOptions: updatedOptions.tracingOptions,
6202
- }));
6203
- }
6204
- catch (e) {
6205
- span.setStatus({
6206
- code: coreTracing.SpanStatusCode.ERROR,
6207
- message: e.message,
6208
- });
6209
- throw e;
6210
- }
6211
- finally {
6212
- span.end();
6213
- }
6000
+ return tracingClient.withSpan("QueueServiceClient-getProperties", options, async (updatedOptions) => {
6001
+ return assertResponse(await this.serviceContext.getProperties(updatedOptions));
6002
+ });
6214
6003
  }
6215
6004
  /**
6216
6005
  * Sets properties for a storage account’s Queue service endpoint, including properties
@@ -6222,23 +6011,9 @@ class QueueServiceClient extends StorageClient {
6222
6011
  * @returns Response data for the Set Properties operation.
6223
6012
  */
6224
6013
  async setProperties(properties, options = {}) {
6225
- const { span, updatedOptions } = createSpan("QueueServiceClient-setProperties", options);
6226
- try {
6227
- return assertResponse(await this.serviceContext.setProperties(properties, {
6228
- abortSignal: options.abortSignal,
6229
- tracingOptions: updatedOptions.tracingOptions,
6230
- }));
6231
- }
6232
- catch (e) {
6233
- span.setStatus({
6234
- code: coreTracing.SpanStatusCode.ERROR,
6235
- message: e.message,
6236
- });
6237
- throw e;
6238
- }
6239
- finally {
6240
- span.end();
6241
- }
6014
+ return tracingClient.withSpan("QueueServiceClient-setProperties", options, async (updatedOptions) => {
6015
+ return assertResponse(await this.serviceContext.setProperties(properties, updatedOptions));
6016
+ });
6242
6017
  }
6243
6018
  /**
6244
6019
  * Retrieves statistics related to replication for the Queue service. It is only
@@ -6250,23 +6025,9 @@ class QueueServiceClient extends StorageClient {
6250
6025
  * @returns Response data for get statistics the operation.
6251
6026
  */
6252
6027
  async getStatistics(options = {}) {
6253
- const { span, updatedOptions } = createSpan("QueueServiceClient-getStatistics", options);
6254
- try {
6255
- return assertResponse(await this.serviceContext.getStatistics({
6256
- abortSignal: options.abortSignal,
6257
- tracingOptions: updatedOptions.tracingOptions,
6258
- }));
6259
- }
6260
- catch (e) {
6261
- span.setStatus({
6262
- code: coreTracing.SpanStatusCode.ERROR,
6263
- message: e.message,
6264
- });
6265
- throw e;
6266
- }
6267
- finally {
6268
- span.end();
6269
- }
6028
+ return tracingClient.withSpan("QueueServiceClient-getStatistics", options, async (updatedOptions) => {
6029
+ return assertResponse(await this.serviceContext.getStatistics(updatedOptions));
6030
+ });
6270
6031
  }
6271
6032
  /**
6272
6033
  * Creates a new queue under the specified account.
@@ -6277,20 +6038,9 @@ class QueueServiceClient extends StorageClient {
6277
6038
  * @returns Response data for the Queue create operation.
6278
6039
  */
6279
6040
  async createQueue(queueName, options = {}) {
6280
- const { span, updatedOptions } = createSpan("QueueServiceClient-createQueue", options);
6281
- try {
6282
- return await this.getQueueClient(queueName).create(updatedOptions);
6283
- }
6284
- catch (e) {
6285
- span.setStatus({
6286
- code: coreTracing.SpanStatusCode.ERROR,
6287
- message: e.message,
6288
- });
6289
- throw e;
6290
- }
6291
- finally {
6292
- span.end();
6293
- }
6041
+ return tracingClient.withSpan("QueueServiceClient-createQueue", options, async (updatedOptions) => {
6042
+ return this.getQueueClient(queueName).create(updatedOptions);
6043
+ });
6294
6044
  }
6295
6045
  /**
6296
6046
  * Deletes the specified queue permanently.
@@ -6301,20 +6051,9 @@ class QueueServiceClient extends StorageClient {
6301
6051
  * @returns Response data for the Queue delete operation.
6302
6052
  */
6303
6053
  async deleteQueue(queueName, options = {}) {
6304
- const { span, updatedOptions } = createSpan("QueueServiceClient-deleteQueue", options);
6305
- try {
6306
- return await this.getQueueClient(queueName).delete(updatedOptions);
6307
- }
6308
- catch (e) {
6309
- span.setStatus({
6310
- code: coreTracing.SpanStatusCode.ERROR,
6311
- message: e.message,
6312
- });
6313
- throw e;
6314
- }
6315
- finally {
6316
- span.end();
6317
- }
6054
+ return tracingClient.withSpan("QueueServiceClient-deleteQueue", options, async (updatedOptions) => {
6055
+ return this.getQueueClient(queueName).delete(updatedOptions);
6056
+ });
6318
6057
  }
6319
6058
  /**
6320
6059
  * Only available for QueueServiceClient constructed with a shared key credential.