From 2f298b9d5660e560a32f4595e2eb72e28f940c6e Mon Sep 17 00:00:00 2001 From: Andre Cruz Date: Mon, 13 Nov 2023 13:15:45 +0000 Subject: [PATCH] Rename initAttributes to attributes --- packages/opentelemetry-sdk-trace-base/src/Span.ts | 6 +++--- .../opentelemetry-sdk-trace-base/test/common/Span.test.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/opentelemetry-sdk-trace-base/src/Span.ts b/packages/opentelemetry-sdk-trace-base/src/Span.ts index 665fbf59ab0..e3e37d82136 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 3018eb6ef6e..8a45cf4ce30 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', () => {