Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core-auth] remove core-tracing dependency #13075

Merged
merged 3 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/core/core-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.1.4 (Unreleased)

- Updated to use OpenTelemetry 0.10.2 via `@azure/core-tracing`
- Removed direct dependency on `@opentelemetry/api` and `@azure/core-tracing`.

## 1.1.3 (2020-06-30)

Expand Down
2 changes: 0 additions & 2 deletions sdk/core/core-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
"sideEffects": false,
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-tracing": "1.0.0-preview.9",
"@opentelemetry/api": "^0.10.2",
"tslib": "^2.0.0"
},
"devDependencies": {
Expand Down
16 changes: 15 additions & 1 deletion sdk/core/core-auth/review/core-auth.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
```ts

import { AbortSignalLike } from '@azure/abort-controller';
import { SpanOptions } from '@azure/core-tracing';

// @public
export interface AccessToken {
Expand Down Expand Up @@ -39,6 +38,21 @@ export interface KeyCredential {
readonly key: string;
}

// @public
export interface SpanContext {
spanId: string;
traceFlags: number;
traceId: string;
}

// @public
export interface SpanOptions {
attributes?: {
[key: string]: unknown;
};
parent?: SpanContext | null;
}

// @public
export interface TokenCredential {
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
Expand Down
2 changes: 2 additions & 0 deletions sdk/core/core-auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export {
AccessToken,
isTokenCredential
} from "./tokenCredential";

export { SpanContext, SpanOptions } from "./tracing";
2 changes: 1 addition & 1 deletion sdk/core/core-auth/src/tokenCredential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.

import { AbortSignalLike } from "@azure/abort-controller";
import { SpanOptions } from "@azure/core-tracing";
import { SpanOptions } from "./tracing";

/**
* Represents a credential capable of providing an authentication token.
Expand Down
41 changes: 41 additions & 0 deletions sdk/core/core-auth/src/tracing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put a comment in this file that it should be kept in sync with the version in core-tracing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note added! Now hopefully we'll see that note when we update core-tracing...

// The interfaces in this file should be kept in sync with those
// found in the `@azure/core-tracing` package.

/**
* An interface that enables manual propagation of Spans.
*/
export interface SpanOptions {
/**
* The SpanContext that refers to a parent span, if any.
* A null value indicates that this should be a new root span,
* rather than potentially detecting a span via a context manager.
*/
parent?: SpanContext | null;
/**
* Attributes to set on the Span
*/
attributes?: {
[key: string]: unknown;
};
}

/**
* A light interface that tries to be structurally compatible with OpenTelemetry.
*/
export declare interface SpanContext {
/**
* UUID of a trace.
*/
traceId: string;
/**
* UUID of a Span.
*/
spanId: string;
/**
* https://www.w3.org/TR/trace-context/#trace-flags
*/
traceFlags: number;
}