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 2f298b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 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
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

0 comments on commit 2f298b9

Please sign in to comment.