From 86a9f2b59a9871bf4585521dc866ae6a9b2810a9 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 23 Apr 2021 15:32:52 -0400 Subject: [PATCH 1/2] chore: rename `span#context()` to `span#spanContext` --- src/context/context.ts | 2 +- src/trace/NoopSpan.ts | 2 +- src/trace/span.ts | 2 +- test/noop-implementations/noop-span.test.ts | 2 +- test/noop-implementations/noop-tracer.test.ts | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/context/context.ts b/src/context/context.ts index 6e59831b..e5555dd3 100644 --- a/src/context/context.ts +++ b/src/context/context.ts @@ -75,7 +75,7 @@ export function setSpanContext( * @param context context to get values from */ export function getSpanContext(context: Context): SpanContext | undefined { - return getSpan(context)?.context(); + return getSpan(context)?.spanContext(); } /** diff --git a/src/trace/NoopSpan.ts b/src/trace/NoopSpan.ts index 40f238d3..7688c7e8 100644 --- a/src/trace/NoopSpan.ts +++ b/src/trace/NoopSpan.ts @@ -33,7 +33,7 @@ export class NoopSpan implements Span { ) {} // Returns a SpanContext. - context(): SpanContext { + spanContext(): SpanContext { return this._spanContext; } diff --git a/src/trace/span.ts b/src/trace/span.ts index 7d8b94b5..d80b8c26 100644 --- a/src/trace/span.ts +++ b/src/trace/span.ts @@ -39,7 +39,7 @@ export interface Span { * * @returns the SpanContext object associated with this Span. */ - context(): SpanContext; + spanContext(): SpanContext; /** * Sets an attribute to the span. diff --git a/test/noop-implementations/noop-span.test.ts b/test/noop-implementations/noop-span.test.ts index d2974fca..ef268c89 100644 --- a/test/noop-implementations/noop-span.test.ts +++ b/test/noop-implementations/noop-span.test.ts @@ -44,7 +44,7 @@ describe('NoopSpan', () => { span.updateName('my-span'); assert.ok(!span.isRecording()); - assert.deepStrictEqual(span.context(), { + assert.deepStrictEqual(span.spanContext(), { traceId: INVALID_TRACEID, spanId: INVALID_SPANID, traceFlags: TraceFlags.NONE, diff --git a/test/noop-implementations/noop-tracer.test.ts b/test/noop-implementations/noop-tracer.test.ts index 661ff34d..a6a1c2c9 100644 --- a/test/noop-implementations/noop-tracer.test.ts +++ b/test/noop-implementations/noop-tracer.test.ts @@ -52,8 +52,8 @@ describe('NoopTracer', () => { {}, setSpanContext(context.active(), parent) ); - assert(span.context().traceId === parent.traceId); - assert(span.context().spanId === parent.spanId); - assert(span.context().traceFlags === parent.traceFlags); + assert(span.spanContext().traceId === parent.traceId); + assert(span.spanContext().spanId === parent.spanId); + assert(span.spanContext().traceFlags === parent.traceFlags); }); }); From 991e55072dd446de74cc9a3a74c52a5abb70f9b6 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Mon, 26 Apr 2021 13:41:05 -0400 Subject: [PATCH 2/2] chore: add upgrade guidelines --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 96bbc542..ee426fd5 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ main(); Because the npm installer and node module resolution algorithm could potentially allow two or more copies of any given package to exist within the same `node_modules` structure, the OpenTelemetry API takes advantage of a variable on the `global` object to store the global API. When an API method in the API package is called, it checks if this `global` API exists and proxies calls to it if and only if it is a compatible API version. This means if a package has a dependency on an OpenTelemetry API version which is not compatible with the API used by the end user, the package will receive a no-op implementation of the API. +## Upgrade Guidelines + +- `1.0.0-rc.1` + +[#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext` + ## Useful links - For more information on OpenTelemetry, visit: