UNPKG

2.46 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;
19var 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 */
25var NonRecordingSpan = /** @class */ (function () {
26 function NonRecordingSpan(_spanContext) {
27 if (_spanContext === void 0) { _spanContext = invalid_span_constants_1.INVALID_SPAN_CONTEXT; }
28 this._spanContext = _spanContext;
29 }
30 // Returns a SpanContext.
31 NonRecordingSpan.prototype.spanContext = function () {
32 return this._spanContext;
33 };
34 // By default does nothing
35 NonRecordingSpan.prototype.setAttribute = function (_key, _value) {
36 return this;
37 };
38 // By default does nothing
39 NonRecordingSpan.prototype.setAttributes = function (_attributes) {
40 return this;
41 };
42 // By default does nothing
43 NonRecordingSpan.prototype.addEvent = function (_name, _attributes) {
44 return this;
45 };
46 // By default does nothing
47 NonRecordingSpan.prototype.setStatus = function (_status) {
48 return this;
49 };
50 // By default does nothing
51 NonRecordingSpan.prototype.updateName = function (_name) {
52 return this;
53 };
54 // By default does nothing
55 NonRecordingSpan.prototype.end = function (_endTime) { };
56 // isRecording always returns false for NonRecordingSpan.
57 NonRecordingSpan.prototype.isRecording = function () {
58 return false;
59 };
60 // By default does nothing
61 NonRecordingSpan.prototype.recordException = function (_exception, _time) { };
62 return NonRecordingSpan;
63}());
64exports.NonRecordingSpan = NonRecordingSpan;
65//# sourceMappingURL=NonRecordingSpan.js.map
\No newline at end of file