From 5d16ee4c1ff85d57dd40963d650462a9f4f845d8 Mon Sep 17 00:00:00 2001 From: KarishmaGhiya Date: Mon, 11 Oct 2021 15:24:23 -0700 Subject: [PATCH] update tracing for consistency (#18076) --- sdk/identity/identity/CHANGELOG.md | 2 ++ .../identity/src/credentials/azureCliCredential.ts | 2 +- .../src/credentials/chainedTokenCredential.ts | 2 +- .../credentials/clientSecretCredential.browser.ts | 2 +- .../credentials/managedIdentityCredential/index.ts | 2 +- .../usernamePasswordCredential.browser.ts | 2 +- 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 +- 13 files changed, 21 insertions(+), 19 deletions(-) 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. 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/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/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/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/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 304ce8d8e785..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: [] } ]