From 131a93bce30e80d3b6e32684e284d4f301f0af54 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Thu, 7 Oct 2021 02:26:35 -0700 Subject: [PATCH 1/5] update tracing --- .../src/credentials/authorizationCodeCredential.ts | 2 +- .../src/credentials/azurePowerShellCredential.ts | 2 +- .../src/credentials/clientCertificateCredential.ts | 2 +- .../src/credentials/clientSecretCredential.ts | 2 +- .../identity/src/credentials/deviceCodeCredential.ts | 2 +- .../src/credentials/environmentCredential.ts | 2 +- .../interactiveBrowserCredential.browser.ts | 2 +- .../src/credentials/interactiveBrowserCredential.ts | 2 +- .../src/credentials/usernamePasswordCredential.ts | 2 +- .../public/node/azureApplicationCredential.spec.ts | 4 ++-- .../public/node/clientCertificateCredential.spec.ts | 2 +- .../test/public/node/clientSecretCredential.spec.ts | 2 +- .../test/public/node/deviceCodeCredential.spec.ts | 2 +- .../test/public/node/environmentCredential.spec.ts | 12 ++++++------ .../public/node/usernamePasswordCredential.spec.ts | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts b/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts index f87c72b3924d..d3acd6d30b6f 100644 --- a/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts +++ b/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts @@ -130,7 +130,7 @@ export class AuthorizationCodeCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts b/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts index 47eecd8036a0..20f37594a54b 100644 --- a/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts +++ b/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts @@ -164,7 +164,7 @@ export class AzurePowerShellCredential implements TokenCredential { scopes: string | string[], options: GetTokenOptions = {} ): Promise { - return trace(`${this.constructor.name}.getToken`, options, async () => { + return trace(`${this.constructor.name}-getToken`, options, async () => { const tenantId = processMultiTenantRequest(this.tenantId, options); if (tenantId) { checkTenantId(logger, tenantId); diff --git a/sdk/identity/identity/src/credentials/clientCertificateCredential.ts b/sdk/identity/identity/src/credentials/clientCertificateCredential.ts index cf484db3565c..8d10f1cee56d 100644 --- a/sdk/identity/identity/src/credentials/clientCertificateCredential.ts +++ b/sdk/identity/identity/src/credentials/clientCertificateCredential.ts @@ -62,7 +62,7 @@ export class ClientCertificateCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, newOptions); }); diff --git a/sdk/identity/identity/src/credentials/clientSecretCredential.ts b/sdk/identity/identity/src/credentials/clientSecretCredential.ts index 55dd6f001a4d..4f100b44d4f4 100644 --- a/sdk/identity/identity/src/credentials/clientSecretCredential.ts +++ b/sdk/identity/identity/src/credentials/clientSecretCredential.ts @@ -62,7 +62,7 @@ export class ClientSecretCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, newOptions); }); diff --git a/sdk/identity/identity/src/credentials/deviceCodeCredential.ts b/sdk/identity/identity/src/credentials/deviceCodeCredential.ts index da37fec03675..cb584b083c9a 100644 --- a/sdk/identity/identity/src/credentials/deviceCodeCredential.ts +++ b/sdk/identity/identity/src/credentials/deviceCodeCredential.ts @@ -71,7 +71,7 @@ export class DeviceCodeCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/environmentCredential.ts b/sdk/identity/identity/src/credentials/environmentCredential.ts index d5a1c378a64c..2412dac3ae8d 100644 --- a/sdk/identity/identity/src/credentials/environmentCredential.ts +++ b/sdk/identity/identity/src/credentials/environmentCredential.ts @@ -124,7 +124,7 @@ export class EnvironmentCredential implements TokenCredential { * @param options - Optional parameters. See {@link GetTokenOptions}. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace("EnvironmentCredential.getToken", options, async (newOptions) => { + return trace("EnvironmentCredential-getToken", options, async (newOptions) => { if (this._credential) { try { const result = await this._credential.getToken(scopes, newOptions); diff --git a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts index b4f0b79ae14f..fec1e4ebe745 100644 --- a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts +++ b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts @@ -88,7 +88,7 @@ export class InteractiveBrowserCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts index 12ea80bcab64..657c39fb81f4 100644 --- a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts +++ b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts @@ -67,7 +67,7 @@ export class InteractiveBrowserCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts b/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts index 6cf85eab6638..5bc4e894ccc4 100644 --- a/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts +++ b/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts @@ -67,7 +67,7 @@ export class UsernamePasswordCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, newOptions); }); diff --git a/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts b/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts index 304ce8d8e785..265e329fd841 100644 --- a/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts @@ -64,10 +64,10 @@ describe("AzureApplicationCredential", function() { name: "Azure.Identity.ChainedTokenCredential-getToken", children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "Azure.Identity.EnvironmentCredential-getToken", children: [ { - name: "Azure.Identity.ClientSecretCredential.getToken", + name: "Azure.Identity.ClientSecretCredential-getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts b/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts index 849cdaf4dce1..396c13478d85 100644 --- a/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts @@ -122,7 +122,7 @@ describe("ClientCertificateCredential", function() { }, children: [ { - name: "Azure.Identity.ClientCertificateCredential.getToken", + name: "Azure.Identity.ClientCertificateCredential-getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts b/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts index f34671245ba6..a704137240e5 100644 --- a/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts @@ -74,7 +74,7 @@ describe("ClientSecretCredential", function() { }, children: [ { - name: "Azure.Identity.ClientSecretCredential.getToken", + name: "Azure.Identity.ClientSecretCredential-getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts b/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts index 057046c4fdb6..e7515ba6e314 100644 --- a/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts @@ -160,7 +160,7 @@ describe("DeviceCodeCredential", function() { }, children: [ { - name: "Azure.Identity.DeviceCodeCredential.getToken", + name: "Azure.Identity.DeviceCodeCredential-getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/environmentCredential.spec.ts b/sdk/identity/identity/test/public/node/environmentCredential.spec.ts index 0b33c382e671..957f784a3db5 100644 --- a/sdk/identity/identity/test/public/node/environmentCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/environmentCredential.spec.ts @@ -122,10 +122,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "Azure.Identity.EnvironmentCredential-getToken", children: [ { - name: "Azure.Identity.ClientSecretCredential.getToken", + name: "Azure.Identity.ClientSecretCredential-getToken", children: [] } ] @@ -161,10 +161,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "Azure.Identity.EnvironmentCredential-getToken", children: [ { - name: "Azure.Identity.ClientCertificateCredential.getToken", + name: "Azure.Identity.ClientCertificateCredential-getToken", children: [] } ] @@ -197,10 +197,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "Azure.Identity.EnvironmentCredential-getToken", children: [ { - name: "Azure.Identity.UsernamePasswordCredential.getToken", + name: "Azure.Identity.UsernamePasswordCredential-getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts b/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts index 66f632e66e51..0bbf9b4aa11e 100644 --- a/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts @@ -84,7 +84,7 @@ describe("UsernamePasswordCredential", function() { }, children: [ { - name: "Azure.Identity.UsernamePasswordCredential.getToken", + name: "Azure.Identity.UsernamePasswordCredential-getToken", children: [] } ] From c116fa4bda35943e683b8719a201d3014711a282 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 8 Oct 2021 02:36:37 -0700 Subject: [PATCH 2/5] tracing update to crenetialname.getToken --- .../src/credentials/authorizationCodeCredential.ts | 2 +- .../identity/src/credentials/azureCliCredential.ts | 2 +- .../src/credentials/azurePowerShellCredential.ts | 2 +- .../src/credentials/chainedTokenCredential.ts | 2 +- .../src/credentials/clientCertificateCredential.ts | 2 +- .../credentials/clientSecretCredential.browser.ts | 2 +- .../src/credentials/clientSecretCredential.ts | 2 +- .../identity/src/credentials/deviceCodeCredential.ts | 2 +- .../src/credentials/environmentCredential.ts | 2 +- .../interactiveBrowserCredential.browser.ts | 2 +- .../src/credentials/interactiveBrowserCredential.ts | 2 +- .../credentials/managedIdentityCredential/index.ts | 2 +- .../usernamePasswordCredential.browser.ts | 2 +- .../src/credentials/usernamePasswordCredential.ts | 2 +- .../public/node/azureApplicationCredential.spec.ts | 6 +++--- .../public/node/clientCertificateCredential.spec.ts | 2 +- .../test/public/node/clientSecretCredential.spec.ts | 2 +- .../test/public/node/deviceCodeCredential.spec.ts | 2 +- .../test/public/node/environmentCredential.spec.ts | 12 ++++++------ .../public/node/usernamePasswordCredential.spec.ts | 2 +- 20 files changed, 27 insertions(+), 27 deletions(-) diff --git a/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts b/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts index d3acd6d30b6f..f87c72b3924d 100644 --- a/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts +++ b/sdk/identity/identity/src/credentials/authorizationCodeCredential.ts @@ -130,7 +130,7 @@ export class AuthorizationCodeCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/azureCliCredential.ts b/sdk/identity/identity/src/credentials/azureCliCredential.ts index cf743d0d1332..03b1a2e823a3 100644 --- a/sdk/identity/identity/src/credentials/azureCliCredential.ts +++ b/sdk/identity/identity/src/credentials/azureCliCredential.ts @@ -117,7 +117,7 @@ export class AzureCliCredential implements TokenCredential { let responseData = ""; - const { span } = createSpan("AzureCliCredential-getToken", options); + const { span } = createSpan("AzureCliCredential.getToken", options); try { const obj = await cliCredentialInternals.getAzureCliAccessToken(resource, tenantId); diff --git a/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts b/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts index 20f37594a54b..47eecd8036a0 100644 --- a/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts +++ b/sdk/identity/identity/src/credentials/azurePowerShellCredential.ts @@ -164,7 +164,7 @@ export class AzurePowerShellCredential implements TokenCredential { scopes: string | string[], options: GetTokenOptions = {} ): Promise { - return trace(`${this.constructor.name}-getToken`, options, async () => { + return trace(`${this.constructor.name}.getToken`, options, async () => { const tenantId = processMultiTenantRequest(this.tenantId, options); if (tenantId) { checkTenantId(logger, tenantId); diff --git a/sdk/identity/identity/src/credentials/chainedTokenCredential.ts b/sdk/identity/identity/src/credentials/chainedTokenCredential.ts index 1276318648bd..5bb053c57c01 100644 --- a/sdk/identity/identity/src/credentials/chainedTokenCredential.ts +++ b/sdk/identity/identity/src/credentials/chainedTokenCredential.ts @@ -60,7 +60,7 @@ export class ChainedTokenCredential implements TokenCredential { let successfulCredentialName = ""; const errors = []; - const { span, updatedOptions } = createSpan("ChainedTokenCredential-getToken", options); + const { span, updatedOptions } = createSpan("ChainedTokenCredential.getToken", options); for (let i = 0; i < this._sources.length && token === null; i++) { try { diff --git a/sdk/identity/identity/src/credentials/clientCertificateCredential.ts b/sdk/identity/identity/src/credentials/clientCertificateCredential.ts index 8d10f1cee56d..cf484db3565c 100644 --- a/sdk/identity/identity/src/credentials/clientCertificateCredential.ts +++ b/sdk/identity/identity/src/credentials/clientCertificateCredential.ts @@ -62,7 +62,7 @@ export class ClientCertificateCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, newOptions); }); diff --git a/sdk/identity/identity/src/credentials/clientSecretCredential.browser.ts b/sdk/identity/identity/src/credentials/clientSecretCredential.browser.ts index ae69db511ce1..f7fe26741556 100644 --- a/sdk/identity/identity/src/credentials/clientSecretCredential.browser.ts +++ b/sdk/identity/identity/src/credentials/clientSecretCredential.browser.ts @@ -66,7 +66,7 @@ export class ClientSecretCredential implements TokenCredential { options?: GetTokenOptions ): Promise { const { span, updatedOptions: newOptions } = createSpan( - "ClientSecretCredential-getToken", + "ClientSecretCredential.getToken", options ); diff --git a/sdk/identity/identity/src/credentials/clientSecretCredential.ts b/sdk/identity/identity/src/credentials/clientSecretCredential.ts index 4f100b44d4f4..55dd6f001a4d 100644 --- a/sdk/identity/identity/src/credentials/clientSecretCredential.ts +++ b/sdk/identity/identity/src/credentials/clientSecretCredential.ts @@ -62,7 +62,7 @@ export class ClientSecretCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, newOptions); }); diff --git a/sdk/identity/identity/src/credentials/deviceCodeCredential.ts b/sdk/identity/identity/src/credentials/deviceCodeCredential.ts index cb584b083c9a..da37fec03675 100644 --- a/sdk/identity/identity/src/credentials/deviceCodeCredential.ts +++ b/sdk/identity/identity/src/credentials/deviceCodeCredential.ts @@ -71,7 +71,7 @@ export class DeviceCodeCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/environmentCredential.ts b/sdk/identity/identity/src/credentials/environmentCredential.ts index 2412dac3ae8d..c6de2ae60dcb 100644 --- a/sdk/identity/identity/src/credentials/environmentCredential.ts +++ b/sdk/identity/identity/src/credentials/environmentCredential.ts @@ -124,7 +124,7 @@ export class EnvironmentCredential implements TokenCredential { * @param options - Optional parameters. See {@link GetTokenOptions}. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace("EnvironmentCredential-getToken", options, async (newOptions) => { + return trace("EnvironmentCredentia..getToken", options, async (newOptions) => { if (this._credential) { try { const result = await this._credential.getToken(scopes, newOptions); diff --git a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts index fec1e4ebe745..b4f0b79ae14f 100644 --- a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts +++ b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.browser.ts @@ -88,7 +88,7 @@ export class InteractiveBrowserCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts index 657c39fb81f4..12ea80bcab64 100644 --- a/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts +++ b/sdk/identity/identity/src/credentials/interactiveBrowserCredential.ts @@ -67,7 +67,7 @@ export class InteractiveBrowserCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, { ...newOptions, diff --git a/sdk/identity/identity/src/credentials/managedIdentityCredential/index.ts b/sdk/identity/identity/src/credentials/managedIdentityCredential/index.ts index 503627090ba8..5e42e897965a 100644 --- a/sdk/identity/identity/src/credentials/managedIdentityCredential/index.ts +++ b/sdk/identity/identity/src/credentials/managedIdentityCredential/index.ts @@ -136,7 +136,7 @@ export class ManagedIdentityCredential implements TokenCredential { ): Promise { let result: AccessToken | null = null; - const { span, updatedOptions } = createSpan("ManagedIdentityCredential-getToken", options); + const { span, updatedOptions } = createSpan("ManagedIdentityCredential.getToken", options); try { // isEndpointAvailable can be true, false, or null, diff --git a/sdk/identity/identity/src/credentials/usernamePasswordCredential.browser.ts b/sdk/identity/identity/src/credentials/usernamePasswordCredential.browser.ts index 77805f7fd4f5..53a8932005ff 100644 --- a/sdk/identity/identity/src/credentials/usernamePasswordCredential.browser.ts +++ b/sdk/identity/identity/src/credentials/usernamePasswordCredential.browser.ts @@ -67,7 +67,7 @@ export class UsernamePasswordCredential implements TokenCredential { options?: GetTokenOptions ): Promise { const { span, updatedOptions: newOptions } = createSpan( - "UsernamePasswordCredential-getToken", + "UsernamePasswordCredential.getToken", options ); try { diff --git a/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts b/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts index 5bc4e894ccc4..6cf85eab6638 100644 --- a/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts +++ b/sdk/identity/identity/src/credentials/usernamePasswordCredential.ts @@ -67,7 +67,7 @@ export class UsernamePasswordCredential implements TokenCredential { * TokenCredential implementation might make. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace(`${this.constructor.name}-getToken`, options, async (newOptions) => { + return trace(`${this.constructor.name}.getToken`, options, async (newOptions) => { const arrayScopes = Array.isArray(scopes) ? scopes : [scopes]; return this.msalFlow.getToken(arrayScopes, newOptions); }); diff --git a/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts b/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts index 265e329fd841..f7aceb1b054f 100644 --- a/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts @@ -61,13 +61,13 @@ describe("AzureApplicationCredential", function() { }, children: [ { - name: "Azure.Identity.ChainedTokenCredential-getToken", + name: "Azure.Identity.ChainedTokenCredential.getToken", children: [ { - name: "Azure.Identity.EnvironmentCredential-getToken", + name: "Azure.Identity.EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.ClientSecretCredential-getToken", + name: "Azure.Identity.ClientSecretCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts b/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts index 396c13478d85..849cdaf4dce1 100644 --- a/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts @@ -122,7 +122,7 @@ describe("ClientCertificateCredential", function() { }, children: [ { - name: "Azure.Identity.ClientCertificateCredential-getToken", + name: "Azure.Identity.ClientCertificateCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts b/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts index a704137240e5..f34671245ba6 100644 --- a/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts @@ -74,7 +74,7 @@ describe("ClientSecretCredential", function() { }, children: [ { - name: "Azure.Identity.ClientSecretCredential-getToken", + name: "Azure.Identity.ClientSecretCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts b/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts index e7515ba6e314..057046c4fdb6 100644 --- a/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts @@ -160,7 +160,7 @@ describe("DeviceCodeCredential", function() { }, children: [ { - name: "Azure.Identity.DeviceCodeCredential-getToken", + name: "Azure.Identity.DeviceCodeCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/environmentCredential.spec.ts b/sdk/identity/identity/test/public/node/environmentCredential.spec.ts index 957f784a3db5..0b33c382e671 100644 --- a/sdk/identity/identity/test/public/node/environmentCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/environmentCredential.spec.ts @@ -122,10 +122,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential-getToken", + name: "Azure.Identity.EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.ClientSecretCredential-getToken", + name: "Azure.Identity.ClientSecretCredential.getToken", children: [] } ] @@ -161,10 +161,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential-getToken", + name: "Azure.Identity.EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.ClientCertificateCredential-getToken", + name: "Azure.Identity.ClientCertificateCredential.getToken", children: [] } ] @@ -197,10 +197,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential-getToken", + name: "Azure.Identity.EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.UsernamePasswordCredential-getToken", + name: "Azure.Identity.UsernamePasswordCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts b/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts index 0bbf9b4aa11e..66f632e66e51 100644 --- a/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts @@ -84,7 +84,7 @@ describe("UsernamePasswordCredential", function() { }, children: [ { - name: "Azure.Identity.UsernamePasswordCredential-getToken", + name: "Azure.Identity.UsernamePasswordCredential.getToken", children: [] } ] From 2ae7f8b69189150047331f6543bf3d38adbcb08c Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 8 Oct 2021 02:44:43 -0700 Subject: [PATCH 3/5] update changelog --- sdk/identity/identity/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/identity/identity/CHANGELOG.md b/sdk/identity/identity/CHANGELOG.md index ba3c5298ad29..91f5ac8e1510 100644 --- a/sdk/identity/identity/CHANGELOG.md +++ b/sdk/identity/identity/CHANGELOG.md @@ -100,6 +100,8 @@ Azure Service Fabric support hasn't been added on the initial version 2 of Ident - Identity v2 also removes the `postLogoutRedirectUri` from the options to the constructor for `InteractiveBrowserCredential`. This option wasn't being used. Instead of using this option, use MSAL directly. For more information, see [Authenticating with the @azure/msal-browser Public Client](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-the-azuremsal-browser-public-client). - In Identity v2, `VisualStudioCodeCredential` throws a `CredentialUnavailableError` unless the new [@azure/identity-vscode](https://www.npmjs.com/package/@azure/identity-vscode) plugin is used. +- Standardizing the tracing span names to be `.` over `-` + #### Breaking Changes from 2.0.0-beta.4 - Removed the `allowMultiTenantAuthentication` option from all of the credentials. Multi-tenant authentication is now enabled by default. On Node.js, it can be disabled with the `AZURE_IDENTITY_DISABLE_MULTITENANTAUTH` environment variable. From c8741cfa31ea65c6245b9eadffa9f8ca1e686558 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 8 Oct 2021 03:35:56 -0700 Subject: [PATCH 4/5] fix bug --- sdk/identity/identity/src/credentials/environmentCredential.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/identity/identity/src/credentials/environmentCredential.ts b/sdk/identity/identity/src/credentials/environmentCredential.ts index c6de2ae60dcb..d5a1c378a64c 100644 --- a/sdk/identity/identity/src/credentials/environmentCredential.ts +++ b/sdk/identity/identity/src/credentials/environmentCredential.ts @@ -124,7 +124,7 @@ export class EnvironmentCredential implements TokenCredential { * @param options - Optional parameters. See {@link GetTokenOptions}. */ async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise { - return trace("EnvironmentCredentia..getToken", options, async (newOptions) => { + return trace("EnvironmentCredential.getToken", options, async (newOptions) => { if (this._credential) { try { const result = await this._credential.getToken(scopes, newOptions); From 04ed60a218fffcd31f016e5391f55f9691bf9281 Mon Sep 17 00:00:00 2001 From: Karishma Ghiya Date: Fri, 8 Oct 2021 14:53:06 -0700 Subject: [PATCH 5/5] update tracing packagePrefix --- sdk/identity/identity/src/util/tracing.ts | 2 +- .../public/node/azureApplicationCredential.spec.ts | 6 +++--- .../public/node/clientCertificateCredential.spec.ts | 2 +- .../test/public/node/clientSecretCredential.spec.ts | 2 +- .../test/public/node/deviceCodeCredential.spec.ts | 2 +- .../test/public/node/environmentCredential.spec.ts | 12 ++++++------ .../public/node/usernamePasswordCredential.spec.ts | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sdk/identity/identity/src/util/tracing.ts b/sdk/identity/identity/src/util/tracing.ts index 7192fa0ce34d..b4471b3e3694 100644 --- a/sdk/identity/identity/src/util/tracing.ts +++ b/sdk/identity/identity/src/util/tracing.ts @@ -9,7 +9,7 @@ import { OperationOptions } from "@azure/core-client"; * @internal */ export const createSpan = createSpanFunction({ - packagePrefix: "Azure.Identity", + packagePrefix: "", namespace: "Microsoft.AAD" }); diff --git a/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts b/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts index f7aceb1b054f..53aebe1663d7 100644 --- a/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/azureApplicationCredential.spec.ts @@ -61,13 +61,13 @@ describe("AzureApplicationCredential", function() { }, children: [ { - name: "Azure.Identity.ChainedTokenCredential.getToken", + name: "ChainedTokenCredential.getToken", children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.ClientSecretCredential.getToken", + name: "ClientSecretCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts b/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts index 849cdaf4dce1..25d090cd23ce 100644 --- a/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/clientCertificateCredential.spec.ts @@ -122,7 +122,7 @@ describe("ClientCertificateCredential", function() { }, children: [ { - name: "Azure.Identity.ClientCertificateCredential.getToken", + name: "ClientCertificateCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts b/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts index f34671245ba6..aa04f188ae62 100644 --- a/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/clientSecretCredential.spec.ts @@ -74,7 +74,7 @@ describe("ClientSecretCredential", function() { }, children: [ { - name: "Azure.Identity.ClientSecretCredential.getToken", + name: "ClientSecretCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts b/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts index 057046c4fdb6..2dae07b2930e 100644 --- a/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/deviceCodeCredential.spec.ts @@ -160,7 +160,7 @@ describe("DeviceCodeCredential", function() { }, children: [ { - name: "Azure.Identity.DeviceCodeCredential.getToken", + name: "DeviceCodeCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/environmentCredential.spec.ts b/sdk/identity/identity/test/public/node/environmentCredential.spec.ts index 0b33c382e671..cd50573b64a1 100644 --- a/sdk/identity/identity/test/public/node/environmentCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/environmentCredential.spec.ts @@ -122,10 +122,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.ClientSecretCredential.getToken", + name: "ClientSecretCredential.getToken", children: [] } ] @@ -161,10 +161,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.ClientCertificateCredential.getToken", + name: "ClientCertificateCredential.getToken", children: [] } ] @@ -197,10 +197,10 @@ describe("EnvironmentCredential", function() { }, children: [ { - name: "Azure.Identity.EnvironmentCredential.getToken", + name: "EnvironmentCredential.getToken", children: [ { - name: "Azure.Identity.UsernamePasswordCredential.getToken", + name: "UsernamePasswordCredential.getToken", children: [] } ] diff --git a/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts b/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts index 66f632e66e51..31e8b588c5da 100644 --- a/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts +++ b/sdk/identity/identity/test/public/node/usernamePasswordCredential.spec.ts @@ -84,7 +84,7 @@ describe("UsernamePasswordCredential", function() { }, children: [ { - name: "Azure.Identity.UsernamePasswordCredential.getToken", + name: "UsernamePasswordCredential.getToken", children: [] } ]