UNPKG

1.98 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright The OpenTelemetry Authors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.NonRecordingSpan = void 0;
19const invalid_span_constants_1 = require("./invalid-span-constants");
20/**
21 * The NonRecordingSpan is the default {@link Span} that is used when no Span
22 * implementation is available. All operations are no-op including context
23 * propagation.
24 */
25class NonRecordingSpan {
26 constructor(_spanContext = invalid_span_constants_1.INVALID_SPAN_CONTEXT) {
27 this._spanContext = _spanContext;
28 }
29 // Returns a SpanContext.
30 spanContext() {
31 return this._spanContext;
32 }
33 // By default does nothing
34 setAttribute(_key, _value) {
35 return this;
36 }
37 // By default does nothing
38 setAttributes(_attributes) {
39 return this;
40 }
41 // By default does nothing
42 addEvent(_name, _attributes) {
43 return this;
44 }
45 // By default does nothing
46 setStatus(_status) {
47 return this;
48 }
49 // By default does nothing
50 updateName(_name) {
51 return this;
52 }
53 // By default does nothing
54 end(_endTime) { }
55 // isRecording always returns false for NonRecordingSpan.
56 isRecording() {
57 return false;
58 }
59 // By default does nothing
60 recordException(_exception, _time) { }
61}
62exports.NonRecordingSpan = NonRecordingSpan;
63//# sourceMappingURL=NonRecordingSpan.js.map
\No newline at end of file