1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.wrapSpanContext = exports.isSpanContextValid = exports.isValidSpanId = exports.isValidTraceId = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | const invalid_span_constants_1 = require("./invalid-span-constants");
|
20 | const NonRecordingSpan_1 = require("./NonRecordingSpan");
|
21 | const VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;
|
22 | const VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
|
23 | function isValidTraceId(traceId) {
|
24 | return VALID_TRACEID_REGEX.test(traceId) && traceId !== invalid_span_constants_1.INVALID_TRACEID;
|
25 | }
|
26 | exports.isValidTraceId = isValidTraceId;
|
27 | function isValidSpanId(spanId) {
|
28 | return VALID_SPANID_REGEX.test(spanId) && spanId !== invalid_span_constants_1.INVALID_SPANID;
|
29 | }
|
30 | exports.isValidSpanId = isValidSpanId;
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | function isSpanContextValid(spanContext) {
|
36 | return (isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId));
|
37 | }
|
38 | exports.isSpanContextValid = isSpanContextValid;
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | function wrapSpanContext(spanContext) {
|
46 | return new NonRecordingSpan_1.NonRecordingSpan(spanContext);
|
47 | }
|
48 | exports.wrapSpanContext = wrapSpanContext;
|
49 |
|
\ | No newline at end of file |