UNPKG

@opentelemetry/api

Version:
54 lines 1.37 kB
/* * Copyright The OpenTelemetry Authors * SPDX-License-Identifier: Apache-2.0 */ import { INVALID_SPAN_CONTEXT } from './invalid-span-constants'; /** * The NonRecordingSpan is the default {@link Span} that is used when no Span * implementation is available. All operations are no-op including context * propagation. */ export class NonRecordingSpan { constructor(spanContext = INVALID_SPAN_CONTEXT) { this._spanContext = spanContext; } // Returns a SpanContext. spanContext() { return this._spanContext; } // By default does nothing setAttribute(_key, _value) { return this; } // By default does nothing setAttributes(_attributes) { return this; } // By default does nothing addEvent(_name, _attributes) { return this; } addLink(_link) { return this; } addLinks(_links) { return this; } // By default does nothing setStatus(_status) { return this; } // By default does nothing updateName(_name) { return this; } // By default does nothing end(_endTime) { } // isRecording always returns false for NonRecordingSpan. isRecording() { return false; } // By default does nothing recordException(_exception, _time) { } } //# sourceMappingURL=NonRecordingSpan.js.map