Skip to content

Commit

Permalink
update tracing for consistency (#18076)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarishmaGhiya authored Oct 11, 2021
1 parent e5a2bf2 commit 5d16ee4
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 19 deletions.
2 changes: 2 additions & 0 deletions sdk/identity/identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<className>.<operationName>` over `<className>-<operationName>`

#### 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class ClientSecretCredential implements TokenCredential {
options?: GetTokenOptions
): Promise<AccessToken | null> {
const { span, updatedOptions: newOptions } = createSpan(
"ClientSecretCredential-getToken",
"ClientSecretCredential.getToken",
options
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class ManagedIdentityCredential implements TokenCredential {
): Promise<AccessToken> {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class UsernamePasswordCredential implements TokenCredential {
options?: GetTokenOptions
): Promise<AccessToken | null> {
const { span, updatedOptions: newOptions } = createSpan(
"UsernamePasswordCredential-getToken",
"UsernamePasswordCredential.getToken",
options
);
try {
Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/identity/src/util/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { OperationOptions } from "@azure/core-client";
* @internal
*/
export const createSpan = createSpanFunction({
packagePrefix: "Azure.Identity",
packagePrefix: "",
namespace: "Microsoft.AAD"
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe("ClientCertificateCredential", function() {
},
children: [
{
name: "Azure.Identity.ClientCertificateCredential.getToken",
name: "ClientCertificateCredential.getToken",
children: []
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("ClientSecretCredential", function() {
},
children: [
{
name: "Azure.Identity.ClientSecretCredential.getToken",
name: "ClientSecretCredential.getToken",
children: []
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe("DeviceCodeCredential", function() {
},
children: [
{
name: "Azure.Identity.DeviceCodeCredential.getToken",
name: "DeviceCodeCredential.getToken",
children: []
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
}
]
Expand Down Expand Up @@ -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: []
}
]
Expand Down Expand Up @@ -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: []
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("UsernamePasswordCredential", function() {
},
children: [
{
name: "Azure.Identity.UsernamePasswordCredential.getToken",
name: "UsernamePasswordCredential.getToken",
children: []
}
]
Expand Down

0 comments on commit 5d16ee4

Please sign in to comment.