1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | var MockReport = (function () {
|
8 | function MockReport(spans) {
|
9 | var _this = this;
|
10 | this.spans = spans;
|
11 | this.spansByUUID = {};
|
12 | this.spansByTag = {};
|
13 | this.debugSpans = [];
|
14 | this.unfinishedSpans = [];
|
15 | spans.forEach(function (span) {
|
16 | if (span._finishMs === 0) {
|
17 | _this.unfinishedSpans.push(span);
|
18 | }
|
19 | _this.spansByUUID[span.uuid()] = span;
|
20 | _this.debugSpans.push(span.debug());
|
21 | var tags = span.tags();
|
22 | Object.keys(tags).forEach(function (key) {
|
23 | var val = tags[key];
|
24 | _this.spansByTag[key] = _this.spansByTag[key] || {};
|
25 | _this.spansByTag[key][val] = _this.spansByTag[key][val] || [];
|
26 | _this.spansByTag[key][val].push(span);
|
27 | });
|
28 | });
|
29 | }
|
30 | MockReport.prototype.firstSpanWithTagValue = function (key, val) {
|
31 | var m = this.spansByTag[key];
|
32 | if (!m) {
|
33 | return null;
|
34 | }
|
35 | var n = m[val];
|
36 | if (!n) {
|
37 | return null;
|
38 | }
|
39 | return n[0];
|
40 | };
|
41 | return MockReport;
|
42 | }());
|
43 | exports.MockReport = MockReport;
|
44 | exports.default = MockReport;
|
45 |
|
\ | No newline at end of file |