Skip to content

Commit

Permalink
Rename initAttributes to attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
satazor committed Nov 13, 2023
1 parent 190fbf4 commit 1411439
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/opentelemetry-sdk-trace-base/src/Span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class Span implements APISpan, ReadableSpan {
links: Link[] = [],
startTime?: TimeInput,
_deprecatedClock?: unknown, // keeping this argument even though it is unused to ensure backwards compatibility
initAttributes?: SpanAttributes
attributes?: SpanAttributes
) {
this.name = spanName;
this._spanContext = spanContext;
Expand All @@ -121,8 +121,8 @@ export class Span implements APISpan, ReadableSpan {
this.instrumentationLibrary = parentTracer.instrumentationLibrary;
this._spanLimits = parentTracer.getSpanLimits();

if (initAttributes != null) {
this.setAttributes(initAttributes);
if (attributes != null) {
this.setAttributes(attributes);
}

this._spanProcessor = parentTracer.getActiveSpanProcessor();
Expand Down
10 changes: 5 additions & 5 deletions packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1054,11 +1054,11 @@ describe('Span', () => {
assert.ok(started);
});

it('include initial attributes in onStart', () => {
let initAttributes;
it('include attributes in onStart', () => {
let attributes;
const processor: SpanProcessor = {
onStart: span => {
initAttributes = { ...span.attributes };
attributes = { ...span.attributes };
},
forceFlush: () => Promise.resolve(),
onEnd() {},
Expand All @@ -1072,7 +1072,7 @@ describe('Span', () => {
provider
.getTracer('default')
.startSpan('test', { attributes: { foo: 'bar' } });
assert.deepStrictEqual(initAttributes, { foo: 'bar' });
assert.deepStrictEqual(attributes, { foo: 'bar' });
});

it('should call onEnd synchronously when span is ended', () => {
Expand Down Expand Up @@ -1244,7 +1244,7 @@ describe('Span', () => {
});
});

describe('when initial attributes are specified', () => {
describe('when attributes are specified', () => {
it('should store specified attributes', () => {
const span = new Span(
tracer,
Expand Down

0 comments on commit 1411439

Please sign in to comment.