@azure/data-tables 13.0.2-alpha.20220217.1 → 13.1.0-alpha.20220307.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Release History
2
2
 
3
- ## 13.0.2 (Unreleased)
3
+ ## 13.1.0 (Unreleased)
4
4
 
5
5
  ### Features Added
6
6
 
@@ -12,6 +12,10 @@
12
12
 
13
13
  ### Other Changes
14
14
 
15
+ - Updated our `@azure/core-tracing` dependency to the latest version (1.0.0-preview.14)
16
+ - Notable changes include Removal of `@opentelemetry/api` as a transitive dependency and ensuring that the active context is properly propagated.
17
+ - Customers who would like to continue using OpenTelemetry driven tracing should visit our [OpenTelemetry Instrumentation](https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk) package for instructions.
18
+
15
19
  ## 13.0.1 (2022-01-12)
16
20
 
17
21
  ### Bugs Fixed
package/dist/index.js CHANGED
@@ -7,10 +7,10 @@ require('@azure/core-paging');
7
7
  var coreAuth = require('@azure/core-auth');
8
8
  var coreXml = require('@azure/core-xml');
9
9
  var coreClient = require('@azure/core-client');
10
- var coreTracing = require('@azure/core-tracing');
11
10
  var url$1 = require('url');
12
11
  var logger$1 = require('@azure/logger');
13
12
  var crypto = require('crypto');
13
+ var coreTracing = require('@azure/core-tracing');
14
14
  var coreRestPipeline = require('@azure/core-rest-pipeline');
15
15
  var uuid = require('uuid');
16
16
 
@@ -3136,7 +3136,7 @@ class GeneratedClientContext extends coreClient__namespace.ServiceClient {
3136
3136
  const defaults = {
3137
3137
  requestContentType: "application/json; charset=utf-8"
3138
3138
  };
3139
- const packageDetails = `azsdk-js-data-tables/13.0.2`;
3139
+ const packageDetails = `azsdk-js-data-tables/13.1.0`;
3140
3140
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
3141
3141
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
3142
3142
  : `${packageDetails}`;
@@ -3172,16 +3172,6 @@ class GeneratedClient extends GeneratedClientContext {
3172
3172
  }
3173
3173
  }
3174
3174
 
3175
- // Copyright (c) Microsoft Corporation.
3176
- /**
3177
- * Creates a span using the global tracer.
3178
- * @internal
3179
- */
3180
- const createSpan = coreTracing.createSpanFunction({
3181
- packagePrefix: "Azure.Data.Tables",
3182
- namespace: "Microsoft.Data.Tables",
3183
- });
3184
-
3185
3175
  // Copyright (c) Microsoft Corporation.
3186
3176
  /**
3187
3177
  * Gets client parameters from an Account Connection String
@@ -3354,8 +3344,9 @@ function getAccountNameFromUrl(url) {
3354
3344
  }
3355
3345
 
3356
3346
  // Copyright (c) Microsoft Corporation.
3347
+ // Licensed under the MIT license.
3357
3348
  function handleTableAlreadyExists(error, options = {}) {
3358
- var _a, _b, _c;
3349
+ var _a, _b;
3359
3350
  const responseError = getErrorResponse(error);
3360
3351
  if (responseError &&
3361
3352
  responseError.status === 409 &&
@@ -3366,7 +3357,6 @@ function handleTableAlreadyExists(error, options = {}) {
3366
3357
  }
3367
3358
  }
3368
3359
  else {
3369
- options === null || options === void 0 ? void 0 : options.span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: (_c = error) === null || _c === void 0 ? void 0 : _c.message });
3370
3360
  throw error;
3371
3361
  }
3372
3362
  }
@@ -3484,6 +3474,17 @@ function signURLWithSAS(request, credential) {
3484
3474
  request.url = url.toString();
3485
3475
  }
3486
3476
 
3477
+ // Copyright (c) Microsoft Corporation.
3478
+ /**
3479
+ * A tracing client that can be used to manage spans.
3480
+ * @internal
3481
+ */
3482
+ const tracingClient = coreTracing.createTracingClient({
3483
+ namespace: "Microsoft.Data.Tables",
3484
+ packageName: "@azure/data-tables",
3485
+ packageVersion: "13.1.0",
3486
+ });
3487
+
3487
3488
  // Copyright (c) Microsoft Corporation.
3488
3489
  /**
3489
3490
  * A TableServiceClient represents a Client to the Azure Tables service allowing you
@@ -3525,35 +3526,15 @@ class TableServiceClient {
3525
3526
  * @param options - The options parameters.
3526
3527
  */
3527
3528
  async getStatistics(options = {}) {
3528
- const { span, updatedOptions } = createSpan("TableServiceClient-getStatistics", options);
3529
- try {
3530
- return await this.service.getStatistics(injectSecondaryEndpointHeader(updatedOptions));
3531
- }
3532
- catch (e) {
3533
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3534
- throw e;
3535
- }
3536
- finally {
3537
- span.end();
3538
- }
3529
+ return tracingClient.withSpan("TableServiceClient.getStatistics", options, (updatedOptions) => this.service.getStatistics(injectSecondaryEndpointHeader(updatedOptions)));
3539
3530
  }
3540
3531
  /**
3541
3532
  * Gets the properties of an account's Table service, including properties for Analytics and CORS
3542
3533
  * (Cross-Origin Resource Sharing) rules.
3543
3534
  * @param options - The options parameters.
3544
3535
  */
3545
- async getProperties(options = {}) {
3546
- const { span, updatedOptions } = createSpan("TableServiceClient-getProperties", options);
3547
- try {
3548
- return await this.service.getProperties(updatedOptions);
3549
- }
3550
- catch (e) {
3551
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3552
- throw e;
3553
- }
3554
- finally {
3555
- span.end();
3556
- }
3536
+ getProperties(options = {}) {
3537
+ return tracingClient.withSpan("TableServiceClient.getProperties", options, (updatedOptions) => this.service.getProperties(updatedOptions));
3557
3538
  }
3558
3539
  /**
3559
3540
  * Sets properties for an account's Table service endpoint, including properties for Analytics and CORS
@@ -3561,58 +3542,43 @@ class TableServiceClient {
3561
3542
  * @param properties - The Table Service properties.
3562
3543
  * @param options - The options parameters.
3563
3544
  */
3564
- async setProperties(properties, options = {}) {
3565
- const { span, updatedOptions } = createSpan("TableServiceClient-setProperties", options);
3566
- try {
3567
- return await this.service.setProperties(properties, updatedOptions);
3568
- }
3569
- catch (e) {
3570
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3571
- throw e;
3572
- }
3573
- finally {
3574
- span.end();
3575
- }
3545
+ setProperties(properties, options = {}) {
3546
+ return tracingClient.withSpan("TableServiceClient.setProperties", options, (updatedOptions) => this.service.setProperties(properties, updatedOptions));
3576
3547
  }
3577
3548
  /**
3578
3549
  * Creates a new table under the given account.
3579
3550
  * @param name - The name of the table.
3580
3551
  * @param options - The options parameters.
3581
3552
  */
3582
- async createTable(name, options = {}) {
3583
- const { span, updatedOptions } = createSpan("TableServiceClient-createTable", options);
3584
- try {
3585
- await this.table.create({ name }, Object.assign({}, updatedOptions));
3586
- }
3587
- catch (e) {
3588
- handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { span, logger, tableName: name }));
3589
- }
3590
- finally {
3591
- span.end();
3592
- }
3553
+ createTable(name, options = {}) {
3554
+ return tracingClient.withSpan("TableServiceClient.createTable", options, async (updatedOptions) => {
3555
+ try {
3556
+ await this.table.create({ name }, updatedOptions);
3557
+ }
3558
+ catch (e) {
3559
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: name }));
3560
+ }
3561
+ });
3593
3562
  }
3594
3563
  /**
3595
3564
  * Operation permanently deletes the specified table.
3596
3565
  * @param name - The name of the table.
3597
3566
  * @param options - The options parameters.
3598
3567
  */
3599
- async deleteTable(name, options = {}) {
3600
- const { span, updatedOptions } = createSpan("TableServiceClient-deleteTable", options);
3601
- try {
3602
- await this.table.delete(name, updatedOptions);
3603
- }
3604
- catch (e) {
3605
- if (e.statusCode === 404) {
3606
- logger.info("TableServiceClient-deleteTable: Table doesn't exist");
3568
+ deleteTable(name, options = {}) {
3569
+ return tracingClient.withSpan("TableServiceClient.deleteTable", options, async (updatedOptions) => {
3570
+ try {
3571
+ await this.table.delete(name, updatedOptions);
3607
3572
  }
3608
- else {
3609
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3610
- throw e;
3573
+ catch (e) {
3574
+ if (e.statusCode === 404) {
3575
+ logger.info("TableServiceClient.deleteTable: Table doesn't exist");
3576
+ }
3577
+ else {
3578
+ throw e;
3579
+ }
3611
3580
  }
3612
- }
3613
- finally {
3614
- span.end();
3615
- }
3581
+ });
3616
3582
  }
3617
3583
  /**
3618
3584
  * Queries tables under the given account.
@@ -3664,22 +3630,15 @@ class TableServiceClient {
3664
3630
  }
3665
3631
  listTablesPage(options = {}) {
3666
3632
  return tslib.__asyncGenerator(this, arguments, function* listTablesPage_1() {
3667
- const { span, updatedOptions } = createSpan("TableServiceClient-listTablesPage", options);
3668
- try {
3669
- let result = yield tslib.__await(this._listTables(updatedOptions));
3633
+ let result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", options, (updatedOptions) => this._listTables(updatedOptions)));
3634
+ yield yield tslib.__await(result);
3635
+ while (result.continuationToken) {
3636
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
3637
+ result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", optionsWithContinuation, async (updatedOptions, span) => {
3638
+ span.setAttribute("continuationToken", updatedOptions.continuationToken);
3639
+ return this._listTables(updatedOptions);
3640
+ }));
3670
3641
  yield yield tslib.__await(result);
3671
- while (result.continuationToken) {
3672
- const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
3673
- result = yield tslib.__await(this._listTables(optionsWithContinuation));
3674
- yield yield tslib.__await(result);
3675
- }
3676
- }
3677
- catch (e) {
3678
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3679
- throw e;
3680
- }
3681
- finally {
3682
- span.end();
3683
3642
  }
3684
3643
  });
3685
3644
  }
@@ -4017,29 +3976,18 @@ class InternalTableTransaction {
4017
3976
  await Promise.all(this.resetableState.pendingOperations);
4018
3977
  const body = getTransactionHttpRequestBody(this.resetableState.bodyParts, this.resetableState.transactionId, this.resetableState.changesetId);
4019
3978
  const headers = getTransactionHeaders(this.resetableState.transactionId);
4020
- const { span, updatedOptions } = createSpan("TableTransaction-submitTransaction", {});
4021
- const request = coreRestPipeline.createPipelineRequest({
4022
- url: this.url,
4023
- method: "POST",
4024
- body,
4025
- headers: coreRestPipeline.createHttpHeaders(headers),
4026
- tracingOptions: updatedOptions.tracingOptions,
4027
- allowInsecureConnection: this.allowInsecureConnection,
4028
- });
4029
- try {
3979
+ return tracingClient.withSpan("TableTransaction.submitTransaction", {}, async (updatedOptions) => {
3980
+ const request = coreRestPipeline.createPipelineRequest({
3981
+ url: this.url,
3982
+ method: "POST",
3983
+ body,
3984
+ headers: coreRestPipeline.createHttpHeaders(headers),
3985
+ tracingOptions: updatedOptions.tracingOptions,
3986
+ allowInsecureConnection: this.allowInsecureConnection,
3987
+ });
4030
3988
  const rawTransactionResponse = await this.client.sendRequest(request);
4031
3989
  return parseTransactionResponse(rawTransactionResponse);
4032
- }
4033
- catch (error) {
4034
- span.setStatus({
4035
- code: coreTracing.SpanStatusCode.ERROR,
4036
- message: error.message,
4037
- });
4038
- throw error;
4039
- }
4040
- finally {
4041
- span.end();
4042
- }
3990
+ });
4043
3991
  }
4044
3992
  checkPartitionKey(partitionKey) {
4045
3993
  if (this.resetableState.partitionKey !== partitionKey) {
@@ -4500,23 +4448,17 @@ class TableClient {
4500
4448
  * ```
4501
4449
  */
4502
4450
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4503
- async deleteTable(options = {}) {
4504
- const { span, updatedOptions } = createSpan("TableClient-deleteTable", options);
4505
- try {
4506
- await this.table.delete(this.tableName, updatedOptions);
4507
- }
4508
- catch (e) {
4509
- if (e.statusCode === 404) {
4510
- logger.info("TableClient-deleteTable: Table doesn't exist");
4451
+ deleteTable(options = {}) {
4452
+ return tracingClient.withSpan("TableClient.deleteTable", options, async (updatedOptions) => {
4453
+ try {
4454
+ await this.table.delete(this.tableName, updatedOptions);
4511
4455
  }
4512
- else {
4513
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4514
- throw e;
4456
+ catch (e) {
4457
+ if (e.statusCode === 404) {
4458
+ logger.info("TableClient.deleteTable: Table doesn't exist");
4459
+ }
4515
4460
  }
4516
- }
4517
- finally {
4518
- span.end();
4519
- }
4461
+ });
4520
4462
  }
4521
4463
  /**
4522
4464
  * Creates a table with the tableName passed to the client constructor
@@ -4544,17 +4486,15 @@ class TableClient {
4544
4486
  * ```
4545
4487
  */
4546
4488
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4547
- async createTable(options = {}) {
4548
- const { span, updatedOptions } = createSpan("TableClient-createTable", options);
4549
- try {
4550
- await this.table.create({ name: this.tableName }, updatedOptions);
4551
- }
4552
- catch (e) {
4553
- handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { span, logger, tableName: this.tableName }));
4554
- }
4555
- finally {
4556
- span.end();
4557
- }
4489
+ createTable(options = {}) {
4490
+ return tracingClient.withSpan("TableClient.createTable", options, async (updatedOptions) => {
4491
+ try {
4492
+ await this.table.create({ name: this.tableName }, updatedOptions);
4493
+ }
4494
+ catch (e) {
4495
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: this.tableName }));
4496
+ }
4497
+ });
4558
4498
  }
4559
4499
  /**
4560
4500
  * Returns a single entity in the table.
@@ -4583,30 +4523,22 @@ class TableClient {
4583
4523
  * console.log(entity);
4584
4524
  * ```
4585
4525
  */
4586
- async getEntity(partitionKey, rowKey,
4526
+ getEntity(partitionKey, rowKey,
4587
4527
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4588
4528
  options = {}) {
4589
- const { span, updatedOptions } = createSpan("TableClient-getEntity", options);
4590
- let parsedBody;
4591
- function onResponse(rawResponse, flatResponse) {
4592
- parsedBody = rawResponse.parsedBody;
4593
- if (updatedOptions.onResponse) {
4594
- updatedOptions.onResponse(rawResponse, flatResponse);
4529
+ return tracingClient.withSpan("TableClient.getEntity", options, async (updatedOptions) => {
4530
+ let parsedBody;
4531
+ function onResponse(rawResponse, flatResponse) {
4532
+ parsedBody = rawResponse.parsedBody;
4533
+ if (updatedOptions.onResponse) {
4534
+ updatedOptions.onResponse(rawResponse, flatResponse);
4535
+ }
4595
4536
  }
4596
- }
4597
- try {
4598
- const _a = updatedOptions || {}, { disableTypeConversion, queryOptions } = _a, getEntityOptions = tslib.__rest(_a, ["disableTypeConversion", "queryOptions"]);
4537
+ const { disableTypeConversion, queryOptions } = updatedOptions, getEntityOptions = tslib.__rest(updatedOptions, ["disableTypeConversion", "queryOptions"]);
4599
4538
  await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
4600
4539
  const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
4601
4540
  return tableEntity;
4602
- }
4603
- catch (e) {
4604
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4605
- throw e;
4606
- }
4607
- finally {
4608
- span.end();
4609
- }
4541
+ });
4610
4542
  }
4611
4543
  /**
4612
4544
  * Queries entities in a table.
@@ -4684,25 +4616,15 @@ class TableClient {
4684
4616
  }
4685
4617
  listEntitiesPage(tableName, options = {}) {
4686
4618
  return tslib.__asyncGenerator(this, arguments, function* listEntitiesPage_1() {
4687
- const { span, updatedOptions } = createSpan("TableClient-listEntitiesPage", options);
4688
- try {
4689
- let result = yield tslib.__await(this._listEntities(tableName, updatedOptions));
4619
+ let result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", options, (updatedOptions) => this._listEntities(tableName, updatedOptions)));
4620
+ yield yield tslib.__await(result);
4621
+ while (result.continuationToken) {
4622
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
4623
+ result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", optionsWithContinuation, (updatedOptions, span) => {
4624
+ span.setAttribute("continuationToken", result.continuationToken);
4625
+ return this._listEntities(tableName, updatedOptions);
4626
+ }));
4690
4627
  yield yield tslib.__await(result);
4691
- while (result.continuationToken) {
4692
- const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
4693
- result = yield tslib.__await(this._listEntities(tableName, optionsWithContinuation));
4694
- yield yield tslib.__await(result);
4695
- }
4696
- }
4697
- catch (e) {
4698
- span.setStatus({
4699
- code: coreTracing.SpanStatusCode.ERROR,
4700
- message: e.message,
4701
- });
4702
- throw e;
4703
- }
4704
- finally {
4705
- span.end();
4706
4628
  }
4707
4629
  });
4708
4630
  }
@@ -4750,21 +4672,13 @@ class TableClient {
4750
4672
  * await client.createEntity({partitionKey: "p1", rowKey: "r1", foo: "Hello!"});
4751
4673
  * ```
4752
4674
  */
4753
- async createEntity(entity,
4675
+ createEntity(entity,
4754
4676
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4755
4677
  options = {}) {
4756
- const { span, updatedOptions } = createSpan("TableClient-createEntity", options);
4757
- try {
4678
+ return tracingClient.withSpan("TableClient.createEntity", options, (updatedOptions) => {
4758
4679
  const createTableEntity = tslib.__rest(updatedOptions || {}, []);
4759
- return await this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
4760
- }
4761
- catch (e) {
4762
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4763
- throw e;
4764
- }
4765
- finally {
4766
- span.end();
4767
- }
4680
+ return this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
4681
+ });
4768
4682
  }
4769
4683
  /**
4770
4684
  * Deletes the specified entity in the table.
@@ -4791,22 +4705,14 @@ class TableClient {
4791
4705
  * await client.deleteEntity("<partitionKey>", "<rowKey>")
4792
4706
  * ```
4793
4707
  */
4794
- async deleteEntity(partitionKey, rowKey,
4708
+ deleteEntity(partitionKey, rowKey,
4795
4709
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4796
4710
  options = {}) {
4797
- const { span, updatedOptions } = createSpan("TableClient-deleteEntity", options);
4798
- try {
4799
- const _a = updatedOptions || {}, { etag = "*" } = _a, rest = tslib.__rest(_a, ["etag"]);
4711
+ return tracingClient.withSpan("TableClient.deleteEntity", options, (updatedOptions) => {
4712
+ const { etag = "*" } = updatedOptions, rest = tslib.__rest(updatedOptions, ["etag"]);
4800
4713
  const deleteOptions = Object.assign({}, rest);
4801
- return await this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
4802
- }
4803
- catch (e) {
4804
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4805
- throw e;
4806
- }
4807
- finally {
4808
- span.end();
4809
- }
4714
+ return this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
4715
+ });
4810
4716
  }
4811
4717
  /**
4812
4718
  * Update an entity in the table.
@@ -4847,29 +4753,25 @@ class TableClient {
4847
4753
  * await client.updateEntity(entity, "Replace")
4848
4754
  * ```
4849
4755
  */
4850
- async updateEntity(entity, mode = "Merge",
4756
+ updateEntity(entity, mode = "Merge",
4851
4757
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4852
4758
  options = {}) {
4853
- const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);
4854
- try {
4759
+ return tracingClient.withSpan("TableClient.updateEntity", options, async (updatedOptions) => {
4855
4760
  const partitionKey = escapeQuotes(entity.partitionKey);
4856
4761
  const rowKey = escapeQuotes(entity.rowKey);
4857
4762
  const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
4858
4763
  if (mode === "Merge") {
4859
- return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4764
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4860
4765
  }
4861
4766
  if (mode === "Replace") {
4862
- return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4767
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4863
4768
  }
4864
4769
  throw new Error(`Unexpected value for update mode: ${mode}`);
4865
- }
4866
- catch (e) {
4867
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4868
- throw e;
4869
- }
4870
- finally {
4871
- span.end();
4872
- }
4770
+ }, {
4771
+ spanAttributes: {
4772
+ updateEntityMode: mode,
4773
+ },
4774
+ });
4873
4775
  }
4874
4776
  /**
4875
4777
  * Upsert an entity in the table.
@@ -4906,66 +4808,46 @@ class TableClient {
4906
4808
  * await client.upsertEntity(entity, "Replace")
4907
4809
  * ```
4908
4810
  */
4909
- async upsertEntity(entity, mode = "Merge",
4811
+ upsertEntity(entity, mode = "Merge",
4910
4812
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4911
4813
  options = {}) {
4912
- const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);
4913
- try {
4814
+ return tracingClient.withSpan("TableClient.upsertEntity", options, async (updatedOptions) => {
4914
4815
  const partitionKey = escapeQuotes(entity.partitionKey);
4915
4816
  const rowKey = escapeQuotes(entity.rowKey);
4916
4817
  if (mode === "Merge") {
4917
- return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4818
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4918
4819
  }
4919
4820
  if (mode === "Replace") {
4920
- return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4821
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4921
4822
  }
4922
4823
  throw new Error(`Unexpected value for update mode: ${mode}`);
4923
- }
4924
- catch (e) {
4925
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4926
- throw e;
4927
- }
4928
- finally {
4929
- span.end();
4930
- }
4824
+ }, {
4825
+ spanAttributes: {
4826
+ upsertEntityMode: mode,
4827
+ },
4828
+ });
4931
4829
  }
4932
4830
  /**
4933
4831
  * Retrieves details about any stored access policies specified on the table that may be used with
4934
4832
  * Shared Access Signatures.
4935
4833
  * @param options - The options parameters.
4936
4834
  */
4937
- async getAccessPolicy(options = {}) {
4938
- const { span, updatedOptions } = createSpan("TableClient-getAccessPolicy", options);
4939
- try {
4835
+ getAccessPolicy(options = {}) {
4836
+ return tracingClient.withSpan("TableClient.getAccessPolicy", options, async (updatedOptions) => {
4940
4837
  const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);
4941
4838
  return deserializeSignedIdentifier(signedIdentifiers);
4942
- }
4943
- catch (e) {
4944
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4945
- throw e;
4946
- }
4947
- finally {
4948
- span.end();
4949
- }
4839
+ });
4950
4840
  }
4951
4841
  /**
4952
4842
  * Sets stored access policies for the table that may be used with Shared Access Signatures.
4953
4843
  * @param tableAcl - The Access Control List for the table.
4954
4844
  * @param options - The options parameters.
4955
4845
  */
4956
- async setAccessPolicy(tableAcl, options = {}) {
4957
- const { span, updatedOptions } = createSpan("TableClient-setAccessPolicy", options);
4958
- try {
4846
+ setAccessPolicy(tableAcl, options = {}) {
4847
+ return tracingClient.withSpan("TableClient.setAccessPolicy", options, (updatedOptions) => {
4959
4848
  const serlializedAcl = serializeSignedIdentifiers(tableAcl);
4960
- return await this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
4961
- }
4962
- catch (e) {
4963
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4964
- throw e;
4965
- }
4966
- finally {
4967
- span.end();
4968
- }
4849
+ return this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
4850
+ });
4969
4851
  }
4970
4852
  /**
4971
4853
  * Submits a Transaction which is composed of a set of actions. You can provide the actions as a list