1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.MultiSpanProcessor = void 0;
|
19 | const core_1 = require("@opentelemetry/core");
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | class MultiSpanProcessor {
|
25 | constructor(_spanProcessors) {
|
26 | this._spanProcessors = _spanProcessors;
|
27 | }
|
28 | forceFlush() {
|
29 | const promises = [];
|
30 | for (const spanProcessor of this._spanProcessors) {
|
31 | promises.push(spanProcessor.forceFlush());
|
32 | }
|
33 | return new Promise(resolve => {
|
34 | Promise.all(promises)
|
35 | .then(() => {
|
36 | resolve();
|
37 | })
|
38 | .catch(error => {
|
39 | core_1.globalErrorHandler(error || new Error('MultiSpanProcessor: forceFlush failed'));
|
40 | resolve();
|
41 | });
|
42 | });
|
43 | }
|
44 | onStart(span, context) {
|
45 | for (const spanProcessor of this._spanProcessors) {
|
46 | spanProcessor.onStart(span, context);
|
47 | }
|
48 | }
|
49 | onEnd(span) {
|
50 | for (const spanProcessor of this._spanProcessors) {
|
51 | spanProcessor.onEnd(span);
|
52 | }
|
53 | }
|
54 | shutdown() {
|
55 | const promises = [];
|
56 | for (const spanProcessor of this._spanProcessors) {
|
57 | promises.push(spanProcessor.shutdown());
|
58 | }
|
59 | return new Promise((resolve, reject) => {
|
60 | Promise.all(promises).then(() => {
|
61 | resolve();
|
62 | }, reject);
|
63 | });
|
64 | }
|
65 | }
|
66 | exports.MultiSpanProcessor = MultiSpanProcessor;
|
67 |
|
\ | No newline at end of file |