@azure/data-tables 13.0.2-alpha.20220214.1 → 13.1.0-alpha.20220216.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/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
 
@@ -10,6 +10,10 @@
10
10
 
11
11
  ### Other Changes
12
12
 
13
+ - Updated our `@azure/core-tracing` dependency to the latest version (1.0.0-preview.14)
14
+ - Notable changes include Removal of `@opentelemetry/api` as a transitive dependency and ensuring that the active context is properly propagated.
15
+ - 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.
16
+
13
17
  ## 13.0.1 (2022-01-12)
14
18
 
15
19
  ### 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
 
@@ -3090,7 +3090,7 @@ class GeneratedClientContext extends coreClient__namespace.ServiceClient {
3090
3090
  const defaults = {
3091
3091
  requestContentType: "application/json; charset=utf-8"
3092
3092
  };
3093
- const packageDetails = `azsdk-js-data-tables/13.0.2`;
3093
+ const packageDetails = `azsdk-js-data-tables/13.1.0`;
3094
3094
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
3095
3095
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
3096
3096
  : `${packageDetails}`;
@@ -3126,16 +3126,6 @@ class GeneratedClient extends GeneratedClientContext {
3126
3126
  }
3127
3127
  }
3128
3128
 
3129
- // Copyright (c) Microsoft Corporation.
3130
- /**
3131
- * Creates a span using the global tracer.
3132
- * @internal
3133
- */
3134
- const createSpan = coreTracing.createSpanFunction({
3135
- packagePrefix: "Azure.Data.Tables",
3136
- namespace: "Microsoft.Data.Tables",
3137
- });
3138
-
3139
3129
  // Copyright (c) Microsoft Corporation.
3140
3130
  /**
3141
3131
  * Gets client parameters from an Account Connection String
@@ -3308,8 +3298,9 @@ function getAccountNameFromUrl(url) {
3308
3298
  }
3309
3299
 
3310
3300
  // Copyright (c) Microsoft Corporation.
3301
+ // Licensed under the MIT license.
3311
3302
  function handleTableAlreadyExists(error, options = {}) {
3312
- var _a, _b, _c;
3303
+ var _a, _b;
3313
3304
  const responseError = getErrorResponse(error);
3314
3305
  if (responseError &&
3315
3306
  responseError.status === 409 &&
@@ -3320,7 +3311,6 @@ function handleTableAlreadyExists(error, options = {}) {
3320
3311
  }
3321
3312
  }
3322
3313
  else {
3323
- 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 });
3324
3314
  throw error;
3325
3315
  }
3326
3316
  }
@@ -3438,6 +3428,17 @@ function signURLWithSAS(request, credential) {
3438
3428
  request.url = url.toString();
3439
3429
  }
3440
3430
 
3431
+ // Copyright (c) Microsoft Corporation.
3432
+ /**
3433
+ * A tracing client that can be used to manage spans.
3434
+ * @internal
3435
+ */
3436
+ const tracingClient = coreTracing.createTracingClient({
3437
+ namespace: "Microsoft.Data.Tables",
3438
+ packageName: "@azure/data-tables",
3439
+ packageVersion: "13.1.0",
3440
+ });
3441
+
3441
3442
  // Copyright (c) Microsoft Corporation.
3442
3443
  /**
3443
3444
  * A TableServiceClient represents a Client to the Azure Tables service allowing you
@@ -3477,36 +3478,16 @@ class TableServiceClient {
3477
3478
  * secondary location endpoint when read-access geo-redundant replication is enabled for the account.
3478
3479
  * @param options - The options parameters.
3479
3480
  */
3480
- async getStatistics(options = {}) {
3481
- const { span, updatedOptions } = createSpan("TableServiceClient-getStatistics", options);
3482
- try {
3483
- return await this.service.getStatistics(updatedOptions);
3484
- }
3485
- catch (e) {
3486
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3487
- throw e;
3488
- }
3489
- finally {
3490
- span.end();
3491
- }
3481
+ getStatistics(options = {}) {
3482
+ return tracingClient.withSpan("TableServiceClient.getStatistics", options, (updatedOptions) => this.service.getStatistics(updatedOptions));
3492
3483
  }
3493
3484
  /**
3494
3485
  * Gets the properties of an account's Table service, including properties for Analytics and CORS
3495
3486
  * (Cross-Origin Resource Sharing) rules.
3496
3487
  * @param options - The options parameters.
3497
3488
  */
3498
- async getProperties(options = {}) {
3499
- const { span, updatedOptions } = createSpan("TableServiceClient-getProperties", options);
3500
- try {
3501
- return await this.service.getProperties(updatedOptions);
3502
- }
3503
- catch (e) {
3504
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3505
- throw e;
3506
- }
3507
- finally {
3508
- span.end();
3509
- }
3489
+ getProperties(options = {}) {
3490
+ return tracingClient.withSpan("TableServiceClient.getProperties", options, (updatedOptions) => this.service.getProperties(updatedOptions));
3510
3491
  }
3511
3492
  /**
3512
3493
  * Sets properties for an account's Table service endpoint, including properties for Analytics and CORS
@@ -3514,58 +3495,43 @@ class TableServiceClient {
3514
3495
  * @param properties - The Table Service properties.
3515
3496
  * @param options - The options parameters.
3516
3497
  */
3517
- async setProperties(properties, options = {}) {
3518
- const { span, updatedOptions } = createSpan("TableServiceClient-setProperties", options);
3519
- try {
3520
- return await this.service.setProperties(properties, updatedOptions);
3521
- }
3522
- catch (e) {
3523
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3524
- throw e;
3525
- }
3526
- finally {
3527
- span.end();
3528
- }
3498
+ setProperties(properties, options = {}) {
3499
+ return tracingClient.withSpan("TableServiceClient.setProperties", options, (updatedOptions) => this.service.setProperties(properties, updatedOptions));
3529
3500
  }
3530
3501
  /**
3531
3502
  * Creates a new table under the given account.
3532
3503
  * @param name - The name of the table.
3533
3504
  * @param options - The options parameters.
3534
3505
  */
3535
- async createTable(name, options = {}) {
3536
- const { span, updatedOptions } = createSpan("TableServiceClient-createTable", options);
3537
- try {
3538
- await this.table.create({ name }, Object.assign({}, updatedOptions));
3539
- }
3540
- catch (e) {
3541
- handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { span, logger, tableName: name }));
3542
- }
3543
- finally {
3544
- span.end();
3545
- }
3506
+ createTable(name, options = {}) {
3507
+ return tracingClient.withSpan("TableServiceClient.createTable", options, async (updatedOptions) => {
3508
+ try {
3509
+ await this.table.create({ name }, updatedOptions);
3510
+ }
3511
+ catch (e) {
3512
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: name }));
3513
+ }
3514
+ });
3546
3515
  }
3547
3516
  /**
3548
3517
  * Operation permanently deletes the specified table.
3549
3518
  * @param name - The name of the table.
3550
3519
  * @param options - The options parameters.
3551
3520
  */
3552
- async deleteTable(name, options = {}) {
3553
- const { span, updatedOptions } = createSpan("TableServiceClient-deleteTable", options);
3554
- try {
3555
- await this.table.delete(name, updatedOptions);
3556
- }
3557
- catch (e) {
3558
- if (e.statusCode === 404) {
3559
- logger.info("TableServiceClient-deleteTable: Table doesn't exist");
3521
+ deleteTable(name, options = {}) {
3522
+ return tracingClient.withSpan("TableServiceClient.deleteTable", options, async (updatedOptions) => {
3523
+ try {
3524
+ await this.table.delete(name, updatedOptions);
3560
3525
  }
3561
- else {
3562
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3563
- throw e;
3526
+ catch (e) {
3527
+ if (e.statusCode === 404) {
3528
+ logger.info("TableServiceClient-deleteTable: Table doesn't exist");
3529
+ }
3530
+ else {
3531
+ throw e;
3532
+ }
3564
3533
  }
3565
- }
3566
- finally {
3567
- span.end();
3568
- }
3534
+ });
3569
3535
  }
3570
3536
  /**
3571
3537
  * Queries tables under the given account.
@@ -3617,22 +3583,15 @@ class TableServiceClient {
3617
3583
  }
3618
3584
  listTablesPage(options = {}) {
3619
3585
  return tslib.__asyncGenerator(this, arguments, function* listTablesPage_1() {
3620
- const { span, updatedOptions } = createSpan("TableServiceClient-listTablesPage", options);
3621
- try {
3622
- let result = yield tslib.__await(this._listTables(updatedOptions));
3586
+ let result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", options, (updatedOptions) => this._listTables(updatedOptions)));
3587
+ yield yield tslib.__await(result);
3588
+ while (result.continuationToken) {
3589
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
3590
+ result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", optionsWithContinuation, async (updatedOptions, span) => {
3591
+ span.setAttribute("continuationToken", updatedOptions.continuationToken);
3592
+ return this._listTables(updatedOptions);
3593
+ }));
3623
3594
  yield yield tslib.__await(result);
3624
- while (result.continuationToken) {
3625
- const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
3626
- result = yield tslib.__await(this._listTables(optionsWithContinuation));
3627
- yield yield tslib.__await(result);
3628
- }
3629
- }
3630
- catch (e) {
3631
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3632
- throw e;
3633
- }
3634
- finally {
3635
- span.end();
3636
3595
  }
3637
3596
  });
3638
3597
  }
@@ -3970,29 +3929,18 @@ class InternalTableTransaction {
3970
3929
  await Promise.all(this.resetableState.pendingOperations);
3971
3930
  const body = getTransactionHttpRequestBody(this.resetableState.bodyParts, this.resetableState.transactionId, this.resetableState.changesetId);
3972
3931
  const headers = getTransactionHeaders(this.resetableState.transactionId);
3973
- const { span, updatedOptions } = createSpan("TableTransaction-submitTransaction", {});
3974
- const request = coreRestPipeline.createPipelineRequest({
3975
- url: this.url,
3976
- method: "POST",
3977
- body,
3978
- headers: coreRestPipeline.createHttpHeaders(headers),
3979
- tracingOptions: updatedOptions.tracingOptions,
3980
- allowInsecureConnection: this.allowInsecureConnection,
3981
- });
3982
- try {
3932
+ return tracingClient.withSpan("TableTransaction.submitTransaction", {}, async (updatedOptions) => {
3933
+ const request = coreRestPipeline.createPipelineRequest({
3934
+ url: this.url,
3935
+ method: "POST",
3936
+ body,
3937
+ headers: coreRestPipeline.createHttpHeaders(headers),
3938
+ tracingOptions: updatedOptions.tracingOptions,
3939
+ allowInsecureConnection: this.allowInsecureConnection,
3940
+ });
3983
3941
  const rawTransactionResponse = await this.client.sendRequest(request);
3984
3942
  return parseTransactionResponse(rawTransactionResponse);
3985
- }
3986
- catch (error) {
3987
- span.setStatus({
3988
- code: coreTracing.SpanStatusCode.ERROR,
3989
- message: error.message,
3990
- });
3991
- throw error;
3992
- }
3993
- finally {
3994
- span.end();
3995
- }
3943
+ });
3996
3944
  }
3997
3945
  checkPartitionKey(partitionKey) {
3998
3946
  if (this.resetableState.partitionKey !== partitionKey) {
@@ -4453,23 +4401,17 @@ class TableClient {
4453
4401
  * ```
4454
4402
  */
4455
4403
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4456
- async deleteTable(options = {}) {
4457
- const { span, updatedOptions } = createSpan("TableClient-deleteTable", options);
4458
- try {
4459
- await this.table.delete(this.tableName, updatedOptions);
4460
- }
4461
- catch (e) {
4462
- if (e.statusCode === 404) {
4463
- logger.info("TableClient-deleteTable: Table doesn't exist");
4404
+ deleteTable(options = {}) {
4405
+ return tracingClient.withSpan("TableClient.deleteTable", options, async (updatedOptions) => {
4406
+ try {
4407
+ await this.table.delete(this.tableName, updatedOptions);
4464
4408
  }
4465
- else {
4466
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4467
- throw e;
4409
+ catch (e) {
4410
+ if (e.statusCode === 404) {
4411
+ logger.info("TableClient.deleteTable: Table doesn't exist");
4412
+ }
4468
4413
  }
4469
- }
4470
- finally {
4471
- span.end();
4472
- }
4414
+ });
4473
4415
  }
4474
4416
  /**
4475
4417
  * Creates a table with the tableName passed to the client constructor
@@ -4497,17 +4439,15 @@ class TableClient {
4497
4439
  * ```
4498
4440
  */
4499
4441
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4500
- async createTable(options = {}) {
4501
- const { span, updatedOptions } = createSpan("TableClient-createTable", options);
4502
- try {
4503
- await this.table.create({ name: this.tableName }, updatedOptions);
4504
- }
4505
- catch (e) {
4506
- handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { span, logger, tableName: this.tableName }));
4507
- }
4508
- finally {
4509
- span.end();
4510
- }
4442
+ createTable(options = {}) {
4443
+ return tracingClient.withSpan("TableClient.createTable", options, async (updatedOptions) => {
4444
+ try {
4445
+ await this.table.create({ name: this.tableName }, updatedOptions);
4446
+ }
4447
+ catch (e) {
4448
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: this.tableName }));
4449
+ }
4450
+ });
4511
4451
  }
4512
4452
  /**
4513
4453
  * Returns a single entity in the table.
@@ -4536,30 +4476,22 @@ class TableClient {
4536
4476
  * console.log(entity);
4537
4477
  * ```
4538
4478
  */
4539
- async getEntity(partitionKey, rowKey,
4479
+ getEntity(partitionKey, rowKey,
4540
4480
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4541
4481
  options = {}) {
4542
- const { span, updatedOptions } = createSpan("TableClient-getEntity", options);
4543
- let parsedBody;
4544
- function onResponse(rawResponse, flatResponse) {
4545
- parsedBody = rawResponse.parsedBody;
4546
- if (updatedOptions.onResponse) {
4547
- updatedOptions.onResponse(rawResponse, flatResponse);
4482
+ return tracingClient.withSpan("TableClient.getEntity", options, async (updatedOptions) => {
4483
+ let parsedBody;
4484
+ function onResponse(rawResponse, flatResponse) {
4485
+ parsedBody = rawResponse.parsedBody;
4486
+ if (updatedOptions.onResponse) {
4487
+ updatedOptions.onResponse(rawResponse, flatResponse);
4488
+ }
4548
4489
  }
4549
- }
4550
- try {
4551
- const _a = updatedOptions || {}, { disableTypeConversion, queryOptions } = _a, getEntityOptions = tslib.__rest(_a, ["disableTypeConversion", "queryOptions"]);
4490
+ const { disableTypeConversion, queryOptions } = updatedOptions, getEntityOptions = tslib.__rest(updatedOptions, ["disableTypeConversion", "queryOptions"]);
4552
4491
  await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
4553
4492
  const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
4554
4493
  return tableEntity;
4555
- }
4556
- catch (e) {
4557
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4558
- throw e;
4559
- }
4560
- finally {
4561
- span.end();
4562
- }
4494
+ });
4563
4495
  }
4564
4496
  /**
4565
4497
  * Queries entities in a table.
@@ -4637,25 +4569,15 @@ class TableClient {
4637
4569
  }
4638
4570
  listEntitiesPage(tableName, options = {}) {
4639
4571
  return tslib.__asyncGenerator(this, arguments, function* listEntitiesPage_1() {
4640
- const { span, updatedOptions } = createSpan("TableClient-listEntitiesPage", options);
4641
- try {
4642
- let result = yield tslib.__await(this._listEntities(tableName, updatedOptions));
4572
+ let result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", options, (updatedOptions) => this._listEntities(tableName, updatedOptions)));
4573
+ yield yield tslib.__await(result);
4574
+ while (result.continuationToken) {
4575
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
4576
+ result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", optionsWithContinuation, (updatedOptions, span) => {
4577
+ span.setAttribute("continuationToken", result.continuationToken);
4578
+ return this._listEntities(tableName, updatedOptions);
4579
+ }));
4643
4580
  yield yield tslib.__await(result);
4644
- while (result.continuationToken) {
4645
- const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
4646
- result = yield tslib.__await(this._listEntities(tableName, optionsWithContinuation));
4647
- yield yield tslib.__await(result);
4648
- }
4649
- }
4650
- catch (e) {
4651
- span.setStatus({
4652
- code: coreTracing.SpanStatusCode.ERROR,
4653
- message: e.message,
4654
- });
4655
- throw e;
4656
- }
4657
- finally {
4658
- span.end();
4659
4581
  }
4660
4582
  });
4661
4583
  }
@@ -4703,21 +4625,13 @@ class TableClient {
4703
4625
  * await client.createEntity({partitionKey: "p1", rowKey: "r1", foo: "Hello!"});
4704
4626
  * ```
4705
4627
  */
4706
- async createEntity(entity,
4628
+ createEntity(entity,
4707
4629
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4708
4630
  options = {}) {
4709
- const { span, updatedOptions } = createSpan("TableClient-createEntity", options);
4710
- try {
4631
+ return tracingClient.withSpan("TableClient.createEntity", options, (updatedOptions) => {
4711
4632
  const createTableEntity = tslib.__rest(updatedOptions || {}, []);
4712
- return await this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
4713
- }
4714
- catch (e) {
4715
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4716
- throw e;
4717
- }
4718
- finally {
4719
- span.end();
4720
- }
4633
+ return this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
4634
+ });
4721
4635
  }
4722
4636
  /**
4723
4637
  * Deletes the specified entity in the table.
@@ -4744,22 +4658,14 @@ class TableClient {
4744
4658
  * await client.deleteEntity("<partitionKey>", "<rowKey>")
4745
4659
  * ```
4746
4660
  */
4747
- async deleteEntity(partitionKey, rowKey,
4661
+ deleteEntity(partitionKey, rowKey,
4748
4662
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4749
4663
  options = {}) {
4750
- const { span, updatedOptions } = createSpan("TableClient-deleteEntity", options);
4751
- try {
4752
- const _a = updatedOptions || {}, { etag = "*" } = _a, rest = tslib.__rest(_a, ["etag"]);
4664
+ return tracingClient.withSpan("TableClient.deleteEntity", options, (updatedOptions) => {
4665
+ const { etag = "*" } = updatedOptions, rest = tslib.__rest(updatedOptions, ["etag"]);
4753
4666
  const deleteOptions = Object.assign({}, rest);
4754
- return await this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
4755
- }
4756
- catch (e) {
4757
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4758
- throw e;
4759
- }
4760
- finally {
4761
- span.end();
4762
- }
4667
+ return this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
4668
+ });
4763
4669
  }
4764
4670
  /**
4765
4671
  * Update an entity in the table.
@@ -4800,29 +4706,25 @@ class TableClient {
4800
4706
  * await client.updateEntity(entity, "Replace")
4801
4707
  * ```
4802
4708
  */
4803
- async updateEntity(entity, mode = "Merge",
4709
+ updateEntity(entity, mode = "Merge",
4804
4710
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4805
4711
  options = {}) {
4806
- const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);
4807
- try {
4712
+ return tracingClient.withSpan("TableClient.updateEntity", options, async (updatedOptions) => {
4808
4713
  const partitionKey = escapeQuotes(entity.partitionKey);
4809
4714
  const rowKey = escapeQuotes(entity.rowKey);
4810
4715
  const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
4811
4716
  if (mode === "Merge") {
4812
- return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4717
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4813
4718
  }
4814
4719
  if (mode === "Replace") {
4815
- return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4720
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4816
4721
  }
4817
4722
  throw new Error(`Unexpected value for update mode: ${mode}`);
4818
- }
4819
- catch (e) {
4820
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4821
- throw e;
4822
- }
4823
- finally {
4824
- span.end();
4825
- }
4723
+ }, {
4724
+ spanAttributes: {
4725
+ updateEntityMode: mode,
4726
+ },
4727
+ });
4826
4728
  }
4827
4729
  /**
4828
4730
  * Upsert an entity in the table.
@@ -4859,66 +4761,46 @@ class TableClient {
4859
4761
  * await client.upsertEntity(entity, "Replace")
4860
4762
  * ```
4861
4763
  */
4862
- async upsertEntity(entity, mode = "Merge",
4764
+ upsertEntity(entity, mode = "Merge",
4863
4765
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4864
4766
  options = {}) {
4865
- const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);
4866
- try {
4767
+ return tracingClient.withSpan("TableClient.upsertEntity", options, async (updatedOptions) => {
4867
4768
  const partitionKey = escapeQuotes(entity.partitionKey);
4868
4769
  const rowKey = escapeQuotes(entity.rowKey);
4869
4770
  if (mode === "Merge") {
4870
- return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4771
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4871
4772
  }
4872
4773
  if (mode === "Replace") {
4873
- return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4774
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4874
4775
  }
4875
4776
  throw new Error(`Unexpected value for update mode: ${mode}`);
4876
- }
4877
- catch (e) {
4878
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4879
- throw e;
4880
- }
4881
- finally {
4882
- span.end();
4883
- }
4777
+ }, {
4778
+ spanAttributes: {
4779
+ upsertEntityMode: mode,
4780
+ },
4781
+ });
4884
4782
  }
4885
4783
  /**
4886
4784
  * Retrieves details about any stored access policies specified on the table that may be used with
4887
4785
  * Shared Access Signatures.
4888
4786
  * @param options - The options parameters.
4889
4787
  */
4890
- async getAccessPolicy(options = {}) {
4891
- const { span, updatedOptions } = createSpan("TableClient-getAccessPolicy", options);
4892
- try {
4788
+ getAccessPolicy(options = {}) {
4789
+ return tracingClient.withSpan("TableClient.getAccessPolicy", options, async (updatedOptions) => {
4893
4790
  const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);
4894
4791
  return deserializeSignedIdentifier(signedIdentifiers);
4895
- }
4896
- catch (e) {
4897
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4898
- throw e;
4899
- }
4900
- finally {
4901
- span.end();
4902
- }
4792
+ });
4903
4793
  }
4904
4794
  /**
4905
4795
  * Sets stored access policies for the table that may be used with Shared Access Signatures.
4906
4796
  * @param tableAcl - The Access Control List for the table.
4907
4797
  * @param options - The options parameters.
4908
4798
  */
4909
- async setAccessPolicy(tableAcl, options = {}) {
4910
- const { span, updatedOptions } = createSpan("TableClient-setAccessPolicy", options);
4911
- try {
4799
+ setAccessPolicy(tableAcl, options = {}) {
4800
+ return tracingClient.withSpan("TableClient.setAccessPolicy", options, (updatedOptions) => {
4912
4801
  const serlializedAcl = serializeSignedIdentifiers(tableAcl);
4913
- return await this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
4914
- }
4915
- catch (e) {
4916
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4917
- throw e;
4918
- }
4919
- finally {
4920
- span.end();
4921
- }
4802
+ return this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
4803
+ });
4922
4804
  }
4923
4805
  /**
4924
4806
  * Submits a Transaction which is composed of a set of actions. You can provide the actions as a list