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-tracing] Update to OpenTelemetry 0.6 #7998

Merged
merged 38 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
113e8e4
Move to core-tracing to OpenTelemetry 0.5
xirzec Mar 24, 2020
513a49a
Migrate all packages to OpenTelemetry 0.5
xirzec Mar 24, 2020
4b4533c
Bump version of core-tracing
xirzec Mar 24, 2020
d7d5691
Bump cache version
xirzec Mar 24, 2020
37cb01b
Fixup changelog
xirzec Mar 25, 2020
ac2011a
Fix build breaks
xirzec Mar 25, 2020
a06d2e5
Fix named export
xirzec Mar 25, 2020
f2b1a77
Revert using OT noop
xirzec Mar 25, 2020
8e455ba
fix build break
xirzec Mar 25, 2020
3f4d0f4
Merge remote-tracking branch 'upstream/master' into OT05
xirzec Mar 26, 2020
3bb121d
update lockfil
xirzec Mar 26, 2020
2b85d20
Create new tracing interfaces
xirzec Mar 27, 2020
f508508
Try to adopt
xirzec Mar 27, 2020
15d6c1c
Fix build breaks
xirzec Mar 27, 2020
2109b5b
Merge remote-tracking branch 'upstream/master' into OT05
xirzec Mar 27, 2020
e2d872b
Update lockfile
xirzec Mar 27, 2020
5fa208d
Merge remote-tracking branch 'upstream/master' into OT05
xirzec Mar 27, 2020
ad0301d
Update lockfile
xirzec Mar 28, 2020
7cb934f
Merge branch 'master' into OT05
xirzec Mar 28, 2020
5d40a9b
Merge branch 'master' into OT05
xirzec Mar 30, 2020
04e4699
Update lockfile
xirzec Mar 30, 2020
4b49cf7
Fix test break
xirzec Mar 30, 2020
d203333
Merge remote-tracking branch 'upstream/master' into OT05
xirzec Apr 16, 2020
e53ce32
fixup
xirzec Apr 16, 2020
3bbb73c
update lockfile
xirzec Apr 16, 2020
b04875e
Fix identity and search
xirzec Apr 16, 2020
76c875a
Fix form recognizer
xirzec Apr 16, 2020
d96896b
Update min version of core-http
xirzec Apr 17, 2020
00be357
Update to OpenTelemetry 0.6.1
xirzec Apr 17, 2020
3fee5c8
Merge remote-tracking branch 'origin' into pr/xirzec/7998
ramya-rao-a Apr 20, 2020
a01b8eb
Update sdk/core/core-tracing/CHANGELOG.md
xirzec Apr 21, 2020
0831e8b
Update sdk/core/core-tracing/src/utils/cache.ts
xirzec Apr 21, 2020
938ea38
Merge remote-tracking branch 'upstream/master' into OT05
xirzec Apr 22, 2020
1ed0928
Fix merge conflicts
xirzec Apr 22, 2020
e09ff90
Fix broken eventhubs test
xirzec Apr 22, 2020
bd0a000
Ensure datalake depends on latest blob
xirzec Apr 23, 2020
3aed715
Merge remote-tracking branch 'upstream/master' into OT05
xirzec Apr 23, 2020
ab0796a
Update deps
xirzec Apr 23, 2020
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
3 changes: 0 additions & 3 deletions common/config/rush/common-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
*/
"allowedAlternativeVersions": {
"@azure/ms-rest-js": ["^2.0.0"],
"@azure/core-http": ["^1.1.0"],
"@azure/core-auth": ["^1.1.0"],
"@azure/core-tracing": ["1.0.0-preview.7"],
/**
* For example, allow some projects to use an older TypeScript compiler
* (in addition to whatever "usual" version is being used by other projects in the repo):
Expand Down
101 changes: 69 additions & 32 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions dataplane.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
{
"path": "sdk\\eventhub\\event-processor-host"
},
{
"path": "sdk\\formrecognizer\\ai-form-recognizer",
"name": "form-recognizer"
},
{
"path": "sdk\\eventhub\\testhub"
},
Expand Down Expand Up @@ -103,6 +107,9 @@
{
"name": "eslint plugin",
"path": "common\\tools\\eslint-plugin-azure-sdk"
},
{
"path": "sdk\\test-utils\\perfstress"
}
],
"settings": {
Expand Down
4 changes: 2 additions & 2 deletions sdk/appconfiguration/app-configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
},
"dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.0",
"@azure/core-http": "^1.0.0",
"@azure/core-http": "^1.1.1",
"@azure/core-paging": "^1.1.0",
"@azure/core-tracing": "1.0.0-preview.8",
"@opentelemetry/types": "^0.2.0",
"@opentelemetry/api": "^0.6.1",
"tslib": "^1.10.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Licensed under the MIT License.

import { getTracer } from "@azure/core-tracing";
import { Span, SpanOptions, SpanKind, CanonicalCode } from "@opentelemetry/types";
import { Span, SpanKind, CanonicalCode } from "@opentelemetry/api";
import { SpanOptions } from "@azure/core-tracing";

import { RestError } from "@azure/core-http";

Expand Down Expand Up @@ -90,7 +91,7 @@ export class Spanner<TClient> {
...options,
spanOptions: {
...spanOptions,
parent: span,
parent: span.context(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd expect the parent of a span to also be of type span... this would be one of the things the user can pass in right?
We are changing that now, or was that never the case?

Copy link
Member Author

Choose a reason for hiding this comment

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

OpenTelemetry lets you pass either a Span or a SpanContext. This is mostly for convenience as it is not hard to get the context.

However, since Span is a much bigger surface area than context, the proposal is to not support direct passing of spans in our options in order to avoid having to risk breaking changes in Span.

Copy link
Member Author

Choose a reason for hiding this comment

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

But yes, this is a breaking change.

attributes: {
...spanOptions.attributes,
"az.namespace": "Microsoft.AppConfiguration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import { Spanner } from "../src/internal/tracingHelpers";
import { RestError } from "@azure/core-http";
import { getTracer } from "@azure/core-tracing";
import { SpanOptions, SpanKind, CanonicalCode } from "@opentelemetry/types";
import { SpanKind, CanonicalCode } from "@opentelemetry/api";
import { SpanOptions } from "@azure/core-tracing";

import * as assert from "assert";

interface FakeOptions {
Expand All @@ -17,7 +19,6 @@ describe("tracingHelpers", () => {
const fakeOptions: FakeOptions = {
name: "fakeName",
spanOptions: {
kind: SpanKind.PRODUCER,
attributes: {
testAttribute: "testAttributeValue"
}
Expand All @@ -31,8 +32,7 @@ describe("tracingHelpers", () => {
const newOptions = Spanner["addParentToOptions"](fakeOptions, parentSpan);

assert.equal("fakeName", newOptions.name);
assert.equal(parentSpan, newOptions.spanOptions.parent);
assert.equal(SpanKind.PRODUCER, newOptions.spanOptions.kind);
assert.deepEqual(parentSpan.context(), newOptions.spanOptions.parent);
assert.ok(newOptions.spanOptions.attributes, "Should have attributes set");
if (newOptions.spanOptions.attributes) {
assert.equal("Microsoft.AppConfiguration", newOptions.spanOptions.attributes["az.namespace"]);
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-arm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
]
},
"dependencies": {
"@azure/core-http": "^1.0.0",
"@azure/core-http": "^1.1.1",
"tslib": "^1.10.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-tracing": "1.0.0-preview.8",
"@opentelemetry/types": "^0.2.0",
"@opentelemetry/api": "^0.6.1",
"tslib": "^1.10.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 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,7 @@
```ts

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

// @public
export interface AccessToken {
Expand Down
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 "@opentelemetry/types";
import { SpanOptions } from "@azure/core-tracing";

/**
* Represents a credential capable of providing an authentication token.
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"@azure/core-auth": "^1.1.2",
"@azure/core-tracing": "1.0.0-preview.8",
"@azure/logger": "^1.0.0",
"@opentelemetry/types": "^0.2.0",
"@opentelemetry/api": "^0.6.1",
"@types/node-fetch": "^2.5.0",
"@types/tunnel": "^0.0.1",
"cross-env": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-http/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function browserConfig(test = false, production = false) {
namedExports: {
chai: ["assert", "AssertionError", "should", "expect"],
events: ["EventEmitter"],
"@opentelemetry/types": ["CanonicalCode", "SpanKind", "TraceFlags"]
"@opentelemetry/api": ["CanonicalCode", "SpanKind", "TraceFlags"]
ramya-rao-a marked this conversation as resolved.
Show resolved Hide resolved
}
}),
viz({ filename: "dist-browser/browser-stats.html", sourcemap: false })
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-http/src/policies/tracingPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import { getTracer, getTraceParentHeader } from "@azure/core-tracing";
import { SpanOptions, SpanKind } from "@opentelemetry/types";
import { SpanOptions, SpanKind } from "@opentelemetry/api";
ramya-rao-a marked this conversation as resolved.
Show resolved Hide resolved
import {
RequestPolicyFactory,
RequestPolicy,
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-http/src/webResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { HttpOperationResponse } from "./httpOperationResponse";
import { OperationResponse } from "./operationResponse";
import { ProxySettings } from "./serviceClient";
import { AbortSignalLike } from "@azure/abort-controller";
import { SpanOptions } from "@opentelemetry/types";
import { SpanOptions } from "@azure/core-tracing";

export type HttpMethods =
| "GET"
Expand Down
14 changes: 7 additions & 7 deletions sdk/core/core-http/test/policies/tracingPolicyTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
HttpHeaders,
RequestPolicyOptions
} from "../../src/coreHttp";
import { SpanOptions, SpanContext, TraceFlags } from "@opentelemetry/types";
import { SpanOptions, SpanContext, TraceFlags } from "@opentelemetry/api";
import { setTracer, NoOpTracer, NoOpSpan } from "@azure/core-tracing";
import { tracingPolicy } from "../../src/policies/tracingPolicy";

Expand Down Expand Up @@ -60,7 +60,7 @@ class MockTracer extends NoOpTracer {
constructor(
private traceId = "",
private spanId = "",
private flags = TraceFlags.UNSAMPLED,
private flags = TraceFlags.NONE,
private state = ""
) {
super();
Expand Down Expand Up @@ -114,7 +114,7 @@ describe("tracingPolicy", function() {
setTracer(mockTracer);
const request = new WebResource();
request.spanOptions = {
parent: ROOT_SPAN
parent: ROOT_SPAN.context()
};
const policy = tracingPolicy().create(mockPolicy, new RequestPolicyOptions());
await policy.sendRequest(request);
Expand All @@ -141,7 +141,7 @@ describe("tracingPolicy", function() {
setTracer(mockTracer);
const request = new WebResource();
request.spanOptions = {
parent: ROOT_SPAN
parent: ROOT_SPAN.context()
};
const policy = tracingPolicy().create(mockPolicy, new RequestPolicyOptions());
await policy.sendRequest(request);
Expand All @@ -168,7 +168,7 @@ describe("tracingPolicy", function() {
setTracer(mockTracer);
const request = new WebResource();
request.spanOptions = {
parent: ROOT_SPAN
parent: ROOT_SPAN.context()
};
const policy = tracingPolicy().create(mockPolicy, new RequestPolicyOptions());
await policy.sendRequest(request);
Expand All @@ -195,7 +195,7 @@ describe("tracingPolicy", function() {
setTracer(mockTracer);
const request = new WebResource();
request.spanOptions = {
parent: ROOT_SPAN
parent: ROOT_SPAN.context()
};
const policy = tracingPolicy().create(
{
Expand Down Expand Up @@ -233,7 +233,7 @@ describe("tracingPolicy", function() {
setTracer(new NoOpTracer());
const request = new WebResource();
request.spanOptions = {
parent: ROOT_SPAN
parent: ROOT_SPAN.context()
};
const policy = tracingPolicy().create(mockPolicy, new RequestPolicyOptions());
await policy.sendRequest(request);
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/core-lro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@
"sideEffects": false,
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^1.0.0",
"@azure/core-http": "^1.1.1",
"events": "^3.0.0",
"tslib": "^1.10.0"
},
"devDependencies": {
"@opentelemetry/types": "^0.2.0",
"@opentelemetry/api": "^0.6.1",
"@microsoft/api-extractor": "7.7.11",
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-multi-entry": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-lro/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function browserConfig(test = false) {
cjs({
namedExports: {
assert: ["ok", "equal", "strictEqual"],
"@opentelemetry/types": ["CanonicalCode", "SpanKind", "TraceFlags"]
"@opentelemetry/api": ["CanonicalCode", "SpanKind", "TraceFlags"]
}
})
]
Expand Down
5 changes: 5 additions & 0 deletions sdk/core/core-tracing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
## 1.0.0-preview.8 (Unreleased)

- Update `TestSpan` to allow setting span attributes [PR link](https://github.com/Azure/azure-sdk-for-js/pull/6565).
- [BREAKING] Migrate to OpenTelemetry 0.6 using the new `@opentelemetry/api` package. There were a few breaking changes:
- `SpanContext` now requires traceFlags to be set.
- `Tracer` has removed `recordSpanData`, `getBinaryFormat`, and `getHttpTextFormat`.
- `Tracer.getCurrentSpan` returns `undefined` instead of `null` when unset.
- `Link` objects renamed `spanContext` property to `context`.

## 1.0.0-preview.7 (2019-12-03)

Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"sideEffects": false,
"dependencies": {
"@opencensus/web-types": "0.0.7",
"@opentelemetry/types": "^0.2.0",
"@opentelemetry/api": "^0.6.1",
"tslib": "^1.10.0"
},
"devDependencies": {
Expand Down
Loading