Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

Commit b5784d3

Browse files
authored
chore: rename span#context() to span#spanContext (#45)
1 parent c1f302e commit b5784d3

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ main();
103103

104104
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.
105105

106-
## Upgrade guidelines
106+
## Upgrade Guidelines
107107

108108
### 1.0.0-rc.0 to x
109109

110110
- `HttpBaggage` renamed to `HttpBaggagePropagator`
111+
- [#45](https://github.com/open-telemetry/opentelemetry-js-api/pull/45) `Span#context` renamed to `Span#spanContext`
111112

112113
## Useful links
113114

Diff for: src/context/context.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function setSpanContext(
7575
* @param context context to get values from
7676
*/
7777
export function getSpanContext(context: Context): SpanContext | undefined {
78-
return getSpan(context)?.context();
78+
return getSpan(context)?.spanContext();
7979
}
8080

8181
/**

Diff for: src/trace/NonRecordingSpan.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class NonRecordingSpan implements Span {
3333
) {}
3434

3535
// Returns a SpanContext.
36-
context(): SpanContext {
36+
spanContext(): SpanContext {
3737
return this._spanContext;
3838
}
3939

Diff for: src/trace/span.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface Span {
3939
*
4040
* @returns the SpanContext object associated with this Span.
4141
*/
42-
context(): SpanContext;
42+
spanContext(): SpanContext;
4343

4444
/**
4545
* Sets an attribute to the span.

Diff for: test/noop-implementations/noop-span.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('NonRecordingSpan', () => {
4444
span.updateName('my-span');
4545

4646
assert.ok(!span.isRecording());
47-
assert.deepStrictEqual(span.context(), {
47+
assert.deepStrictEqual(span.spanContext(), {
4848
traceId: INVALID_TRACEID,
4949
spanId: INVALID_SPANID,
5050
traceFlags: TraceFlags.NONE,

Diff for: test/noop-implementations/noop-tracer.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ describe('NoopTracer', () => {
5252
{},
5353
setSpanContext(context.active(), parent)
5454
);
55-
assert(span.context().traceId === parent.traceId);
56-
assert(span.context().spanId === parent.spanId);
57-
assert(span.context().traceFlags === parent.traceFlags);
55+
assert(span.spanContext().traceId === parent.traceId);
56+
assert(span.spanContext().spanId === parent.spanId);
57+
assert(span.spanContext().traceFlags === parent.traceFlags);
5858
});
5959
});

0 commit comments

Comments
 (0)