UNPKG

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