diff --git a/packages/opentelemetry-core/src/trace/NoopSpan.ts b/packages/opentelemetry-core/src/trace/NoopSpan.ts index cd4b7e4658..84a5cf4241 100644 --- a/packages/opentelemetry-core/src/trace/NoopSpan.ts +++ b/packages/opentelemetry-core/src/trace/NoopSpan.ts @@ -66,8 +66,8 @@ export class NoopSpan implements types.Span { // By default does nothing end(endTime?: types.TimeInput): void {} - // isRecordingEvents always returns false for noopSpan. - isRecordingEvents(): boolean { + // isRecording always returns false for noopSpan. + isRecording(): boolean { return false; } } diff --git a/packages/opentelemetry-core/test/trace/NoopSpan.test.ts b/packages/opentelemetry-core/test/trace/NoopSpan.test.ts index dac450162b..468c42947d 100644 --- a/packages/opentelemetry-core/test/trace/NoopSpan.test.ts +++ b/packages/opentelemetry-core/test/trace/NoopSpan.test.ts @@ -51,7 +51,7 @@ describe('NoopSpan', () => { span.updateName('my-span'); - assert.ok(!span.isRecordingEvents()); + assert.ok(!span.isRecording()); assert.deepStrictEqual(span.context(), { traceId: INVALID_TRACEID, spanId: INVALID_SPANID, diff --git a/packages/opentelemetry-core/test/trace/NoopTracer.test.ts b/packages/opentelemetry-core/test/trace/NoopTracer.test.ts index cd93d5b548..892e082105 100644 --- a/packages/opentelemetry-core/test/trace/NoopTracer.test.ts +++ b/packages/opentelemetry-core/test/trace/NoopTracer.test.ts @@ -32,7 +32,7 @@ describe('NoopTracer', () => { assert.deepStrictEqual( tracer.startSpan('span-name2', { kind: SpanKind.CLIENT, - isRecordingEvents: true, + isRecording: true, }), NOOP_SPAN ); diff --git a/packages/opentelemetry-node/test/NodeTracer.test.ts b/packages/opentelemetry-node/test/NodeTracer.test.ts index 069d4980e2..0cffd80c0d 100644 --- a/packages/opentelemetry-node/test/NodeTracer.test.ts +++ b/packages/opentelemetry-node/test/NodeTracer.test.ts @@ -146,7 +146,7 @@ describe('NodeTracer', () => { const span = tracer.startSpan('my-span'); assert.ok(span instanceof NoRecordingSpan); assert.strictEqual(span.context().traceFlags, TraceFlags.UNSAMPLED); - assert.strictEqual(span.isRecordingEvents(), false); + assert.strictEqual(span.isRecording(), false); }); // @todo: implement diff --git a/packages/opentelemetry-tracing/src/BasicTracer.ts b/packages/opentelemetry-tracing/src/BasicTracer.ts index 5e6bff441b..a9936df1a8 100644 --- a/packages/opentelemetry-tracing/src/BasicTracer.ts +++ b/packages/opentelemetry-tracing/src/BasicTracer.ts @@ -88,7 +88,7 @@ export class BasicTracer implements types.Tracer { ? TraceFlags.SAMPLED : TraceFlags.UNSAMPLED; const spanContext = { traceId, spanId, traceFlags, traceState }; - const recordEvents = options.isRecordingEvents || false; + const recordEvents = options.isRecording || false; if (!recordEvents && !samplingDecision) { this.logger.debug('Sampling is off, starting no recording span'); return new NoRecordingSpan(spanContext); diff --git a/packages/opentelemetry-tracing/src/Span.ts b/packages/opentelemetry-tracing/src/Span.ts index 618b860775..c59b96b460 100644 --- a/packages/opentelemetry-tracing/src/Span.ts +++ b/packages/opentelemetry-tracing/src/Span.ts @@ -148,7 +148,7 @@ export class Span implements types.Span, ReadableSpan { this._spanProcessor.onEnd(this); } - isRecordingEvents(): boolean { + isRecording(): boolean { return true; } diff --git a/packages/opentelemetry-tracing/src/SpanProcessor.ts b/packages/opentelemetry-tracing/src/SpanProcessor.ts index 633cfc1e56..74c3fb078e 100644 --- a/packages/opentelemetry-tracing/src/SpanProcessor.ts +++ b/packages/opentelemetry-tracing/src/SpanProcessor.ts @@ -22,14 +22,14 @@ import { Span } from '@opentelemetry/types'; */ export interface SpanProcessor { /** - * Called when a {@link Span} is started, if the `span.isRecordingEvents()` + * Called when a {@link Span} is started, if the `span.isRecording()` * returns true. * @param span the Span that just started. */ onStart(span: Span): void; /** - * Called when a {@link Span} is ended, if the `span.isRecordingEvents()` + * Called when a {@link Span} is ended, if the `span.isRecording()` * returns true. * @param span the Span that just ended. */ diff --git a/packages/opentelemetry-tracing/test/BasicTracer.test.ts b/packages/opentelemetry-tracing/test/BasicTracer.test.ts index ff44b9219b..44af7ba31e 100644 --- a/packages/opentelemetry-tracing/test/BasicTracer.test.ts +++ b/packages/opentelemetry-tracing/test/BasicTracer.test.ts @@ -251,10 +251,10 @@ describe('BasicTracer', () => { const tracer = new BasicTracer({ sampler: NEVER_SAMPLER, }); - const span = tracer.startSpan('my-span', { isRecordingEvents: true }); + const span = tracer.startSpan('my-span', { isRecording: true }); assert.ok(span instanceof Span); assert.strictEqual(span.context().traceFlags, TraceFlags.UNSAMPLED); - assert.strictEqual(span.isRecordingEvents(), true); + assert.strictEqual(span.isRecording(), true); }); it('should not create real span when not sampled and recording events false', () => { @@ -262,10 +262,10 @@ describe('BasicTracer', () => { sampler: NEVER_SAMPLER, logger: new NoopLogger(), }); - const span = tracer.startSpan('my-span', { isRecordingEvents: false }); + const span = tracer.startSpan('my-span', { isRecording: false }); assert.ok(span instanceof NoRecordingSpan); assert.strictEqual(span.context().traceFlags, TraceFlags.UNSAMPLED); - assert.strictEqual(span.isRecordingEvents(), false); + assert.strictEqual(span.isRecording(), false); }); it('should not create real span when not sampled and no recording events configured', () => { @@ -276,7 +276,7 @@ describe('BasicTracer', () => { const span = tracer.startSpan('my-span'); assert.ok(span instanceof NoRecordingSpan); assert.strictEqual(span.context().traceFlags, TraceFlags.UNSAMPLED); - assert.strictEqual(span.isRecordingEvents(), false); + assert.strictEqual(span.isRecording(), false); }); it('should create real span when sampled and recording events true', () => { @@ -284,10 +284,10 @@ describe('BasicTracer', () => { sampler: ALWAYS_SAMPLER, scopeManager: new NoopScopeManager(), }); - const span = tracer.startSpan('my-span', { isRecordingEvents: true }); + const span = tracer.startSpan('my-span', { isRecording: true }); assert.ok(span instanceof Span); assert.strictEqual(span.context().traceFlags, TraceFlags.SAMPLED); - assert.strictEqual(span.isRecordingEvents(), true); + assert.strictEqual(span.isRecording(), true); }); it('should set default attributes on span', () => { diff --git a/packages/opentelemetry-tracing/test/Span.test.ts b/packages/opentelemetry-tracing/test/Span.test.ts index 79997a8e90..45b9650876 100644 --- a/packages/opentelemetry-tracing/test/Span.test.ts +++ b/packages/opentelemetry-tracing/test/Span.test.ts @@ -93,13 +93,13 @@ describe('Span', () => { assert.strictEqual(context.traceFlags, TraceFlags.SAMPLED); assert.strictEqual(context.traceState, undefined); assert.ok(context.spanId.match(/[a-f0-9]{16}/)); - assert.ok(span.isRecordingEvents()); + assert.ok(span.isRecording()); span.end(); }); - it('should return true when isRecordingEvents:true', () => { + it('should return true when isRecording:true', () => { const span = new Span(tracer, name, spanContext, SpanKind.CLIENT); - assert.ok(span.isRecordingEvents()); + assert.ok(span.isRecording()); span.end(); }); diff --git a/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts b/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts index 1ebbe468e9..e4ef7f55ef 100644 --- a/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts +++ b/packages/opentelemetry-tracing/test/export/BatchSpanProcessor.test.ts @@ -37,7 +37,7 @@ function createUnSampledSpan(spanName: string): Span { sampler: NEVER_SAMPLER, logger: new NoopLogger(), }); - const span = tracer.startSpan(spanName, { isRecordingEvents: false }); + const span = tracer.startSpan(spanName, { isRecording: false }); span.end(); return span as Span; } diff --git a/packages/opentelemetry-types/src/trace/SpanOptions.ts b/packages/opentelemetry-types/src/trace/SpanOptions.ts index aa84497dfe..c396d2df46 100644 --- a/packages/opentelemetry-types/src/trace/SpanOptions.ts +++ b/packages/opentelemetry-types/src/trace/SpanOptions.ts @@ -29,8 +29,8 @@ export interface SpanOptions { /** A spans attributes */ attributes?: Attributes; - /** Indicates that events are being recorded for a span */ - isRecordingEvents?: boolean; + /** Indicates that if this Span is active and recording information like events with the `AddEvent` operation and attributes using `setAttributes`. */ + isRecording?: boolean; /** * A parent SpanContext (or Span, for convenience) that the newly-started diff --git a/packages/opentelemetry-types/src/trace/span.ts b/packages/opentelemetry-types/src/trace/span.ts index 0db3ef4e0d..fd0e4cf12a 100644 --- a/packages/opentelemetry-types/src/trace/span.ts +++ b/packages/opentelemetry-types/src/trace/span.ts @@ -102,5 +102,5 @@ export interface Span { * @returns true if this Span is active and recording information like events * with the AddEvent operation and attributes using setAttributes. */ - isRecordingEvents(): boolean; + isRecording(): boolean; }