diff --git a/packages/opentelemetry-sdk-trace-base/src/Span.ts b/packages/opentelemetry-sdk-trace-base/src/Span.ts index 665fbf59ab..e3e37d8213 100644 --- a/packages/opentelemetry-sdk-trace-base/src/Span.ts +++ b/packages/opentelemetry-sdk-trace-base/src/Span.ts @@ -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; @@ -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(); diff --git a/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts b/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts index 3018eb6ef6..09dfea1b94 100644 --- a/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/common/Span.test.ts @@ -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() {}, @@ -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', () => { @@ -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,