1 | ;
|
2 | /**
|
3 | * Copyright 2018, OpenCensus 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 | * http://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 | */
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.RootSpan = void 0;
|
19 | const logger = require("../../common/console-logger");
|
20 | const span_1 = require("./span");
|
21 | /** Defines a root span */
|
22 | class RootSpan extends span_1.Span {
|
23 | /**
|
24 | * Constructs a new RootSpanImpl instance.
|
25 | * @param tracer A tracer object.
|
26 | * @param name The displayed name for the new span.
|
27 | * @param kind The kind of new span.
|
28 | * @param traceId The trace Id.
|
29 | * @param parentSpanId The id of the parent span, or empty if the new span is
|
30 | * a root span.
|
31 | * @param traceState An optional traceState.
|
32 | */
|
33 | constructor(tracer, name, kind, traceId, parentSpanId, traceState) {
|
34 | super(tracer);
|
35 | this.tracer = tracer;
|
36 | this.traceIdLocal = traceId;
|
37 | this.name = name;
|
38 | this.kind = kind;
|
39 | this.parentSpanIdLocal = parentSpanId;
|
40 | if (traceState) {
|
41 | this.traceStateLocal = traceState;
|
42 | }
|
43 | this.logger = tracer.logger || logger.logger();
|
44 | this.activeTraceParams = tracer.activeTraceParams;
|
45 | }
|
46 | /** Returns whether a span is root or not. */
|
47 | isRootSpan() {
|
48 | return true;
|
49 | }
|
50 | /** Gets trace id from rootspan instance. */
|
51 | get traceId() {
|
52 | return this.traceIdLocal;
|
53 | }
|
54 | /** Gets trace state from rootspan instance */
|
55 | get traceState() {
|
56 | return this.traceStateLocal;
|
57 | }
|
58 | get parentSpanId() {
|
59 | return this.parentSpanIdLocal;
|
60 | }
|
61 | }
|
62 | exports.RootSpan = RootSpan;
|
63 | //# sourceMappingURL=root-span.js.map |
\ | No newline at end of file |