Skip to content

Commit 01df6ac

Browse files
authored
[Mixed Reality] Update mixed reality to core-tracing 1.0 (Azure#22868)
1 parent 6d21fc9 commit 01df6ac

File tree

7 files changed

+133
-44
lines changed

7 files changed

+133
-44
lines changed

sdk/mixedreality/mixed-reality-authentication/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"@azure/core-auth": "^1.3.0",
6565
"@azure/core-client": "^1.4.0",
6666
"@azure/core-rest-pipeline": "^1.4.0",
67-
"@azure/core-tracing": "1.0.0-preview.13",
67+
"@azure/core-tracing": "^1.0.0",
6868
"@azure/logger": "^1.0.0",
6969
"tslib": "^2.2.0"
7070
},

sdk/mixedreality/mixed-reality-authentication/src/generated/index.ts

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/mixedreality/mixed-reality-authentication/src/generated/mixedRealityStsRestClient.ts

Lines changed: 103 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/mixedreality/mixed-reality-authentication/src/generated/tracing.ts

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/mixedreality/mixed-reality-authentication/src/mixedRealityStsClient.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ import {
1010
import { GetTokenOptions, MixedRealityStsClientOptions } from "./models/options";
1111
import { InternalClientPipelineOptions } from "@azure/core-client";
1212
import { MixedRealityAccountKeyCredential } from "./models/auth";
13-
import { SpanStatusCode } from "@azure/core-tracing";
1413
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
1514
import { constructAuthenticationEndpointFromDomain } from "./util/authenticationEndpoint";
16-
import { createSpan } from "./tracing";
1715
import { generateCvBase } from "./util/cv";
1816
import { logger } from "./logger";
1917
import { mapToAccessToken } from "./models/mappers";
18+
import { tracingClient } from "./generated/tracing";
2019

2120
/**
2221
* Represents the Mixed Reality STS client for retrieving STS tokens used to access Mixed Reality services.
@@ -134,23 +133,14 @@ export class MixedRealityStsClient {
134133
},
135134
};
136135

137-
const { span, updatedOptions } = createSpan("MixedRealityStsClient-GetToken", internalOptions);
136+
return tracingClient.withSpan(
137+
"MixedRealityStsClient-GetToken",
138+
internalOptions,
139+
async (updatedOptions) => {
140+
const tokenResponse = await this.restClient.getToken(this.accountId, updatedOptions);
138141

139-
try {
140-
const tokenResponse = await this.restClient.getToken(this.accountId, updatedOptions);
141-
142-
return mapToAccessToken(tokenResponse);
143-
} catch (e: any) {
144-
// There are different standard codes available for different errors:
145-
// https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#status
146-
span.setStatus({
147-
code: SpanStatusCode.ERROR,
148-
message: e.message,
149-
});
150-
151-
throw e;
152-
} finally {
153-
span.end();
154-
}
142+
return mapToAccessToken(tokenResponse);
143+
}
144+
);
155145
}
156146
}

sdk/mixedreality/mixed-reality-authentication/src/tracing.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

sdk/mixedreality/mixed-reality-authentication/swagger/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ source-code-folder-path: ./src/generated
1717
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/aa19725fe79aea2a9dc580f3c66f77f89cc34563/specification/mixedreality/data-plane/Microsoft.MixedReality/preview/2019-02-28-preview/mr-sts.json
1818
add-credentials: false
1919
use-extension:
20-
"@autorest/typescript": "6.0.0-beta.15"
20+
"@autorest/typescript": "latest"
2121
hide-clients: true
2222
package-version: 1.0.0-beta.2
2323
v3: true
24+
25+
tracing-info:
26+
namespace: "Microsoft.MixedReality"
27+
packagePrefix: "Azure.MixedReality"
2428
```
2529
2630
## Customizations for Track 2 Generator

0 commit comments

Comments
 (0)