@evref-bl/plexus 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/answers/index.d.ts +35 -13
- package/dist/answers/index.d.ts.map +1 -1
- package/dist/answers/index.js +96 -48
- package/dist/answers/index.js.map +1 -1
- package/dist/answers/texts.d.ts +36 -9
- package/dist/answers/texts.d.ts.map +1 -1
- package/dist/answers/texts.js +54 -14
- package/dist/answers/texts.js.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commandLine.d.ts +5 -1
- package/dist/commandLine.d.ts.map +1 -1
- package/dist/commandLine.js +7 -5
- package/dist/commandLine.js.map +1 -1
- package/dist/config/pharoMcpVersion.d.ts +3 -4
- package/dist/config/pharoMcpVersion.d.ts.map +1 -1
- package/dist/config/pharoMcpVersion.js +3 -4
- package/dist/config/pharoMcpVersion.js.map +1 -1
- package/dist/forward/index.d.ts +7 -2
- package/dist/forward/index.d.ts.map +1 -1
- package/dist/forward/index.js +3 -12
- package/dist/forward/index.js.map +1 -1
- package/dist/forward/jsonRpc.d.ts +3 -1
- package/dist/forward/jsonRpc.d.ts.map +1 -1
- package/dist/forward/jsonRpc.js +8 -2
- package/dist/forward/jsonRpc.js.map +1 -1
- package/dist/home.d.ts +6 -1
- package/dist/home.d.ts.map +1 -1
- package/dist/home.js +7 -2
- package/dist/home.js.map +1 -1
- package/dist/images/bases.d.ts +37 -9
- package/dist/images/bases.d.ts.map +1 -1
- package/dist/images/bases.js +194 -62
- package/dist/images/bases.js.map +1 -1
- package/dist/images/context.d.ts +2 -0
- package/dist/images/context.d.ts.map +1 -1
- package/dist/images/context.js +1 -0
- package/dist/images/context.js.map +1 -1
- package/dist/images/create.d.ts +2 -1
- package/dist/images/create.d.ts.map +1 -1
- package/dist/images/create.js +11 -9
- package/dist/images/create.js.map +1 -1
- package/dist/images/endpoint.d.ts +7 -5
- package/dist/images/endpoint.d.ts.map +1 -1
- package/dist/images/endpoint.js +5 -2
- package/dist/images/endpoint.js.map +1 -1
- package/dist/images/index.d.ts +14 -4
- package/dist/images/index.d.ts.map +1 -1
- package/dist/images/index.js +28 -8
- package/dist/images/index.js.map +1 -1
- package/dist/images/list.d.ts +24 -1
- package/dist/images/list.d.ts.map +1 -1
- package/dist/images/list.js +91 -15
- package/dist/images/list.js.map +1 -1
- package/dist/images/prepare.d.ts +9 -2
- package/dist/images/prepare.d.ts.map +1 -1
- package/dist/images/prepare.js +46 -7
- package/dist/images/prepare.js.map +1 -1
- package/dist/images/scripts.d.ts +18 -6
- package/dist/images/scripts.d.ts.map +1 -1
- package/dist/images/scripts.js +63 -15
- package/dist/images/scripts.js.map +1 -1
- package/dist/images/start.d.ts +10 -3
- package/dist/images/start.d.ts.map +1 -1
- package/dist/images/start.js +29 -15
- package/dist/images/start.js.map +1 -1
- package/dist/images/stop.d.ts +9 -5
- package/dist/images/stop.d.ts.map +1 -1
- package/dist/images/stop.js +69 -8
- package/dist/images/stop.js.map +1 -1
- package/dist/images/store.d.ts +7 -1
- package/dist/images/store.d.ts.map +1 -1
- package/dist/images/store.js +34 -0
- package/dist/images/store.js.map +1 -1
- package/dist/images/templates.js +4 -3
- package/dist/images/templates.js.map +1 -1
- package/dist/launcher/pharoLauncherMcpClient.d.ts +4 -4
- package/dist/launcher/pharoLauncherMcpClient.d.ts.map +1 -1
- package/dist/launcher/pharoLauncherMcpClient.js +23 -34
- package/dist/launcher/pharoLauncherMcpClient.js.map +1 -1
- package/dist/launcher/vmRenewal.d.ts +6 -5
- package/dist/launcher/vmRenewal.d.ts.map +1 -1
- package/dist/launcher/vmRenewal.js +9 -19
- package/dist/launcher/vmRenewal.js.map +1 -1
- package/dist/mcp/server.d.ts +28 -2
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +222 -54
- package/dist/mcp/server.js.map +1 -1
- package/dist/telemetry/reachability.d.ts +21 -3
- package/dist/telemetry/reachability.d.ts.map +1 -1
- package/dist/telemetry/reachability.js +50 -9
- package/dist/telemetry/reachability.js.map +1 -1
- package/dist/telemetry/sdk.d.ts +17 -6
- package/dist/telemetry/sdk.d.ts.map +1 -1
- package/dist/telemetry/sdk.js +18 -9
- package/dist/telemetry/sdk.js.map +1 -1
- package/dist/telemetry/settings.d.ts +19 -7
- package/dist/telemetry/settings.d.ts.map +1 -1
- package/dist/telemetry/settings.js +49 -22
- package/dist/telemetry/settings.js.map +1 -1
- package/dist/telemetry/trace.d.ts +22 -14
- package/dist/telemetry/trace.d.ts.map +1 -1
- package/dist/telemetry/trace.js +44 -8
- package/dist/telemetry/trace.js.map +1 -1
- package/dist/types.d.ts +28 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What the `plexus` command remembers of a collector it could not reach, so
|
|
3
3
|
* that an unreachable collector costs a command nothing: while an endpoint's
|
|
4
|
-
* time to try again is in the future, no SDK
|
|
5
|
-
* process that
|
|
4
|
+
* time to try again is in the future, a command installs no SDK for it, and a
|
|
5
|
+
* process that serves (`plexus mcp`) sends nothing to it until then.
|
|
6
|
+
*
|
|
7
|
+
* A collector on this machine is never left alone: a refused connection to
|
|
8
|
+
* it costs nothing, and one that comes back, restarted or upgraded, is sent
|
|
9
|
+
* to at once.
|
|
6
10
|
*
|
|
7
11
|
* The state is a JSON object in the user's cache directory, keyed by the
|
|
8
12
|
* traces endpoint, whose values are `{ "failures": n, "retryAt": epochMillis }`.
|
|
@@ -46,6 +50,20 @@ export function tracesEndpoint(env) {
|
|
|
46
50
|
}
|
|
47
51
|
return `${general.endsWith("/") ? general : `${general}/`}v1/traces`;
|
|
48
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether the endpoint is on this machine: its host is `localhost`, an
|
|
55
|
+
* address of 127.0.0.0/8, or `::1`.
|
|
56
|
+
*/
|
|
57
|
+
export function isLoopback(endpoint) {
|
|
58
|
+
let host;
|
|
59
|
+
try {
|
|
60
|
+
host = new URL(endpoint).hostname;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
return host === "localhost" || host === "[::1]" || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host);
|
|
66
|
+
}
|
|
49
67
|
/** The state in `file`, or none when it is missing, unreadable or not a JSON object. */
|
|
50
68
|
export function readReachability(file) {
|
|
51
69
|
try {
|
|
@@ -93,33 +111,49 @@ export function writeReachability(file, state) {
|
|
|
93
111
|
}
|
|
94
112
|
}
|
|
95
113
|
}
|
|
96
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* One endpoint's breaker: whether to send to it, and what each export says of
|
|
116
|
+
* it. An endpoint on this machine has none: it is always sent to, and its
|
|
117
|
+
* failures are not recorded.
|
|
118
|
+
*/
|
|
97
119
|
export class Reachability {
|
|
98
120
|
file;
|
|
99
121
|
endpoint;
|
|
100
122
|
now;
|
|
101
123
|
retryAt;
|
|
124
|
+
breaks;
|
|
102
125
|
constructor(file, endpoint, now = Date.now) {
|
|
103
126
|
this.file = file;
|
|
104
127
|
this.endpoint = endpoint;
|
|
105
128
|
this.now = now;
|
|
129
|
+
this.breaks = !isLoopback(endpoint);
|
|
106
130
|
}
|
|
107
131
|
/** Whether the state says to leave the endpoint alone for now. */
|
|
108
132
|
isOpen() {
|
|
109
|
-
|
|
110
|
-
return entry !== undefined && entry.retryAt > this.now();
|
|
133
|
+
return this.breaks && this.sharedRetryAt() > this.now();
|
|
111
134
|
}
|
|
112
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* Whether this process may send now: not before the time to try again that
|
|
137
|
+
* its last failure set, nor before the one the state keeps, which another
|
|
138
|
+
* process's failure may have set since.
|
|
139
|
+
*/
|
|
113
140
|
allows() {
|
|
114
|
-
return this.
|
|
141
|
+
return !this.breaks || this.now() >= Math.max(this.retryAt ?? -Infinity, this.sharedRetryAt());
|
|
142
|
+
}
|
|
143
|
+
sharedRetryAt() {
|
|
144
|
+
return readReachability(this.file)[this.endpoint]?.retryAt ?? -Infinity;
|
|
115
145
|
}
|
|
116
146
|
failed() {
|
|
147
|
+
if (!this.breaks) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
117
150
|
const state = readReachability(this.file);
|
|
118
151
|
const failures = (state[this.endpoint]?.failures ?? 0) + 1;
|
|
119
152
|
const retryAt = this.now() + retryDelayMs(failures);
|
|
120
153
|
this.retryAt = retryAt;
|
|
121
154
|
writeReachability(this.file, { ...state, [this.endpoint]: { failures, retryAt } });
|
|
122
155
|
}
|
|
156
|
+
/** The endpoint answered: its entry goes, one an earlier PLexus wrote for an endpoint on this machine included. */
|
|
123
157
|
succeeded() {
|
|
124
158
|
this.retryAt = undefined;
|
|
125
159
|
const state = readReachability(this.file);
|
|
@@ -134,7 +168,9 @@ export class Reachability {
|
|
|
134
168
|
* export at once, without the network, while `reachability` does not allow
|
|
135
169
|
* sending. An export that has not ended `deadlineMs` after it began has
|
|
136
170
|
* failed: the OTLP exporter's own timeout does not cover a connection that
|
|
137
|
-
* is still being made, nor an answer that trickles in.
|
|
171
|
+
* is still being made, nor an answer that trickles in. A collector that
|
|
172
|
+
* refused the batch itself, as malformed (400) or too large (413), answered:
|
|
173
|
+
* the export failed, and the collector is reachable.
|
|
138
174
|
*/
|
|
139
175
|
export class GuardedExporter {
|
|
140
176
|
exporter;
|
|
@@ -160,7 +196,7 @@ export class GuardedExporter {
|
|
|
160
196
|
}
|
|
161
197
|
settled = true;
|
|
162
198
|
clearTimeout(deadline);
|
|
163
|
-
if (result.code === this.codes.SUCCESS) {
|
|
199
|
+
if (result.code === this.codes.SUCCESS || refusedContent(result)) {
|
|
164
200
|
this.reachability.succeeded();
|
|
165
201
|
}
|
|
166
202
|
else {
|
|
@@ -190,4 +226,9 @@ export class GuardedExporter {
|
|
|
190
226
|
return this.exporter.forceFlush?.() ?? Promise.resolve();
|
|
191
227
|
}
|
|
192
228
|
}
|
|
229
|
+
/** Whether the collector answered that it refuses the batch, with the HTTP status the OTLP exporter gives its error as `code`. */
|
|
230
|
+
function refusedContent(result) {
|
|
231
|
+
const status = result.error?.code;
|
|
232
|
+
return status === 400 || status === 413;
|
|
233
|
+
}
|
|
193
234
|
//# sourceMappingURL=reachability.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reachability.js","sourceRoot":"","sources":["../../src/telemetry/reachability.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"reachability.js","sourceRoot":"","sources":["../../src/telemetry/reachability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAY7B,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC;AAChC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;AAEvC,+HAA+H;AAC/H,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAsB,EACtB,WAA4B,OAAO,CAAC,QAAQ,EAC5C,OAAe,EAAE,CAAC,OAAO,EAAE;IAE3B,MAAM,KAAK,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC7D,MAAM,SAAS,GACb,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE;QAC1B,CAAC,QAAQ,KAAK,OAAO;YACnB,CAAC,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,I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C;YAC3G,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;QACD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAa,IAAI,CAAC,QAAQ,CAAC,MAA0C,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACnG,IAAI,QAAQ,YAAY,OAAO,EAAE,CAAC;gBAChC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3D,CAAC;CACF;AAED,kIAAkI;AAClI,SAAS,cAAc,CAAC,MAAoB;IAC1C,MAAM,MAAM,GAAI,MAAM,CAAC,KAAwC,EAAE,IAAI,CAAC;IACtE,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;AAC1C,CAAC"}
|
package/dist/telemetry/sdk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The SDK the command installed, or none: what to run the command in, and how to end it. */
|
|
2
2
|
export interface Telemetry {
|
|
3
|
-
/** Runs the command's work under the parent `TRACEPARENT` names, when it names one. */
|
|
3
|
+
/** Runs the command's work under the parent `TRACEPARENT` names, when it names one and the process does not serve. */
|
|
4
4
|
within<T>(work: () => T): T;
|
|
5
5
|
/** Exports what is left, waiting no longer than a second, or the export timeout when it is shorter. */
|
|
6
6
|
shutdown(): Promise<void>;
|
|
@@ -8,8 +8,11 @@ export interface Telemetry {
|
|
|
8
8
|
export interface TelemetryOptions {
|
|
9
9
|
/**
|
|
10
10
|
* The process serves until its input closes (`plexus mcp`): its batches go
|
|
11
|
-
* in the background with the whole export timeout
|
|
12
|
-
*
|
|
11
|
+
* in the background with the whole export timeout, the SDK is installed
|
|
12
|
+
* even while the collector is left alone, which its exports then wait out,
|
|
13
|
+
* and its work has no parent from the environment, since each request
|
|
14
|
+
* names its own. Otherwise each export is given no more than the process
|
|
15
|
+
* waits at its end.
|
|
13
16
|
*/
|
|
14
17
|
longLived?: boolean;
|
|
15
18
|
/** Where reachability is kept, instead of the user's cache directory. */
|
|
@@ -17,9 +20,15 @@ export interface TelemetryOptions {
|
|
|
17
20
|
/** The clock reachability is kept by. */
|
|
18
21
|
now?: () => number;
|
|
19
22
|
}
|
|
20
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* How long an export may take, when one that has not ended has failed, and
|
|
25
|
+
* how long the process waits for its spans as it ends. A command's export
|
|
26
|
+
* fails a little before the command stops waiting, so that a collector that
|
|
27
|
+
* does not answer is remembered before the process exits.
|
|
28
|
+
*/
|
|
21
29
|
export declare function exportTimings(traces: TracesExport, longLived?: boolean): {
|
|
22
30
|
exportTimeoutMs: number;
|
|
31
|
+
deadlineMs: number;
|
|
23
32
|
exitWaitMs: number;
|
|
24
33
|
};
|
|
25
34
|
export interface TracesExport {
|
|
@@ -59,8 +68,10 @@ export declare function batchSettings(env: NodeJS.ProcessEnv): BatchSettings;
|
|
|
59
68
|
* it. The host and process detectors are not used: they would send the
|
|
60
69
|
* hostname, the command line and the executable's path.
|
|
61
70
|
*
|
|
62
|
-
* When
|
|
63
|
-
*
|
|
71
|
+
* When a collector elsewhere failed recently and its time to try again has
|
|
72
|
+
* not come, a command installs nothing and loads no SDK module; a process
|
|
73
|
+
* that serves installs the SDK all the same, so that the trace context and
|
|
74
|
+
* the session still reach its images, and sends once that time has come.
|
|
64
75
|
*/
|
|
65
76
|
export declare function startTelemetry(env: NodeJS.ProcessEnv, options?: TelemetryOptions): Promise<Telemetry>;
|
|
66
77
|
/** The parent a caller passes in `TRACEPARENT`, `TRACESTATE` and `BAGGAGE`, as the environment carrier has it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/telemetry/sdk.ts"],"names":[],"mappings":"AAgBA,6FAA6F;AAC7F,MAAM,WAAW,SAAS;IACxB,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/telemetry/sdk.ts"],"names":[],"mappings":"AAgBA,6FAA6F;AAC7F,MAAM,WAAW,SAAS;IACxB,sHAAsH;IACtH,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,uGAAuG;IACvG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAaD,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,SAAS,UAAQ,GAChB;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAKrE;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,eAAe,GAAG,WAAW,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,6GAA6G;IAC7G,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,iJAAiJ;AACjJ,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,YAAY,GAAG,SAAS,CAyB7E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,aAAa,CASnE;AAOD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgE/G;AAED,kHAAkH;AAClH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,wCAa3D"}
|
package/dist/telemetry/sdk.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Nothing here reaches a command's answer or its exit status: an SDK that is
|
|
8
8
|
* missing, fails to load, or fails to export leaves the command as it was,
|
|
9
|
-
* and nothing is printed. A collector that could not be reached is
|
|
9
|
+
* and nothing is printed. A collector elsewhere that could not be reached is
|
|
10
10
|
* remembered, and left alone for a while (see `reachability.ts`).
|
|
11
11
|
*/
|
|
12
12
|
import os from "node:os";
|
|
@@ -21,10 +21,17 @@ const none = {
|
|
|
21
21
|
const defaultTimeoutMs = 2_000;
|
|
22
22
|
/** The longest a process waits for its spans as it ends. */
|
|
23
23
|
const longestExitWaitMs = 1_000;
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* How long an export may take, when one that has not ended has failed, and
|
|
26
|
+
* how long the process waits for its spans as it ends. A command's export
|
|
27
|
+
* fails a little before the command stops waiting, so that a collector that
|
|
28
|
+
* does not answer is remembered before the process exits.
|
|
29
|
+
*/
|
|
25
30
|
export function exportTimings(traces, longLived = false) {
|
|
26
31
|
const exitWaitMs = Math.min(longestExitWaitMs, traces.timeoutMs);
|
|
27
|
-
return
|
|
32
|
+
return longLived
|
|
33
|
+
? { exportTimeoutMs: traces.timeoutMs, deadlineMs: traces.timeoutMs, exitWaitMs }
|
|
34
|
+
: { exportTimeoutMs: exitWaitMs, deadlineMs: Math.max(1, Math.floor(exitWaitMs * 0.9)), exitWaitMs };
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
37
|
* What the environment asks of traces: an OTLP export over HTTP, or nothing.
|
|
@@ -89,8 +96,10 @@ function positive(value) {
|
|
|
89
96
|
* it. The host and process detectors are not used: they would send the
|
|
90
97
|
* hostname, the command line and the executable's path.
|
|
91
98
|
*
|
|
92
|
-
* When
|
|
93
|
-
*
|
|
99
|
+
* When a collector elsewhere failed recently and its time to try again has
|
|
100
|
+
* not come, a command installs nothing and loads no SDK module; a process
|
|
101
|
+
* that serves installs the SDK all the same, so that the trace context and
|
|
102
|
+
* the session still reach its images, and sends once that time has come.
|
|
94
103
|
*/
|
|
95
104
|
export async function startTelemetry(env, options = {}) {
|
|
96
105
|
const traces = tracesExport(env);
|
|
@@ -99,10 +108,10 @@ export async function startTelemetry(env, options = {}) {
|
|
|
99
108
|
return none;
|
|
100
109
|
}
|
|
101
110
|
const reachability = new Reachability(options.reachabilityFile ?? reachabilityFile(env), endpoint, options.now);
|
|
102
|
-
if (reachability.isOpen()) {
|
|
111
|
+
if (!options.longLived && reachability.isOpen()) {
|
|
103
112
|
return none;
|
|
104
113
|
}
|
|
105
|
-
const { exportTimeoutMs, exitWaitMs } = exportTimings(traces, options.longLived);
|
|
114
|
+
const { exportTimeoutMs, deadlineMs, exitWaitMs } = exportTimings(traces, options.longLived);
|
|
106
115
|
try {
|
|
107
116
|
const [sdk, hooks, core, resources, exporters] = await Promise.all([
|
|
108
117
|
import("@opentelemetry/sdk-trace"),
|
|
@@ -128,7 +137,7 @@ export async function startTelemetry(env, options = {}) {
|
|
|
128
137
|
spanProcessors: [
|
|
129
138
|
new sdk.BatchSpanProcessor({
|
|
130
139
|
...traces.batch,
|
|
131
|
-
exporter: new GuardedExporter(new exporters.OTLPTraceExporter({ timeoutMillis: exportTimeoutMs }), reachability, core.ExportResultCode,
|
|
140
|
+
exporter: new GuardedExporter(new exporters.OTLPTraceExporter({ timeoutMillis: exportTimeoutMs }), reachability, core.ExportResultCode, deadlineMs),
|
|
132
141
|
exportTimeoutMillis: exportTimeoutMs,
|
|
133
142
|
}),
|
|
134
143
|
],
|
|
@@ -138,7 +147,7 @@ export async function startTelemetry(env, options = {}) {
|
|
|
138
147
|
propagators: [new core.W3CTraceContextPropagator(), new core.W3CBaggagePropagator()],
|
|
139
148
|
}));
|
|
140
149
|
trace.setGlobalTracerProvider(provider);
|
|
141
|
-
const parent = parentFromEnvironment(env);
|
|
150
|
+
const parent = options.longLived ? ROOT_CONTEXT : parentFromEnvironment(env);
|
|
142
151
|
return {
|
|
143
152
|
within: (work) => context.with(parent, work),
|
|
144
153
|
shutdown: () => within(exitWaitMs, provider.shutdown()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/telemetry/sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAUpG,MAAM,IAAI,GAAc;IACtB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;IACxB,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS;CAChC,CAAC;AAEF,sHAAsH;AACtH,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,4DAA4D;AAC5D,MAAM,iBAAiB,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/telemetry/sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,WAAW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AAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,4EAA4E;AAC5E,KAAK,UAAU,MAAM,CAAC,OAAe,EAAE,IAAsB;IAC3D,IAAI,KAAiC,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,IAAI,CAAC;YACjB,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;YAC3B,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACtB,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACvC,CAAC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,+CAA+C;AAC/C,SAAS,MAAM;IACb,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AACxF,CAAC"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
/** Where the settings live. */
|
|
2
2
|
export declare function settingsFile(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string;
|
|
3
3
|
/**
|
|
4
|
-
* The OTEL_* settings a file's lines give
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The OTEL_* settings a file's lines give, as a dotenv file reads, lines
|
|
5
|
+
* ending in LF, CRLF or a lone CR, as a Pharo image writes them. Blank
|
|
6
|
+
* lines and `#` comments are skipped, as is a leading `export`. A value in
|
|
7
|
+
* single or double quotes is what they hold, `#` included, and may be followed
|
|
8
|
+
* by a comment; any other value ends where a `#` begins it or follows
|
|
9
|
+
* whitespace. Any other key is not ours to set.
|
|
7
10
|
*/
|
|
8
11
|
export declare function parseSettings(text: string): Record<string, string>;
|
|
9
12
|
/**
|
|
10
|
-
* Puts the file's settings into the environment
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* Puts the file's settings into the environment in place of every OTEL_* it
|
|
14
|
+
* inherited, when the file gives any: the file, not what an agent host
|
|
15
|
+
* passed on, decides where PLexus and its images send. With no file, or a file
|
|
16
|
+
* that gives none, the environment decides. The images PLexus starts run in
|
|
17
|
+
* this environment, so they read the same settings. Answers what it set.
|
|
14
18
|
*/
|
|
15
19
|
export declare function applySettingsFile(env?: NodeJS.ProcessEnv, file?: string): Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Turns the OpenTelemetry SDK's own diagnostics off for the images PLexus
|
|
22
|
+
* starts, unless the environment sets a level: they run in this environment,
|
|
23
|
+
* and opentelemetry-pharo writes its diagnostics to the VM's standard output,
|
|
24
|
+
* as `OTEL_LOG_LEVEL` allows. Applied after the settings file, so that a
|
|
25
|
+
* level the file sets is the one kept.
|
|
26
|
+
*/
|
|
27
|
+
export declare function quietImageDiagnostics(env?: NodeJS.ProcessEnv): void;
|
|
16
28
|
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/telemetry/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/telemetry/settings.ts"],"names":[],"mappings":"AAYA,+BAA+B;AAC/B,wBAAgB,YAAY,CAC1B,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,IAAI,GAAE,MAAqB,GAC1B,MAAM,CAMR;AAID;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYlE;AAaD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,GAAE,MAA0B,GAC/B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcxB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,IAAI,CAEhF"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* PLexus's telemetry settings file: `KEY=value` lines of standard OTEL_*
|
|
3
|
+
* variables. When it gives settings, they replace every OTEL_* the process
|
|
4
|
+
* inherited: an agent host passes its whole environment to the servers it
|
|
5
|
+
* starts, its own OpenTelemetry settings among them, and those are the host's,
|
|
6
|
+
* not PLexus's. Applied to the process's environment, they reach the images it
|
|
7
|
+
* starts too, which read only their environment.
|
|
6
8
|
*/
|
|
7
9
|
import fs from "node:fs";
|
|
8
10
|
import os from "node:os";
|
|
@@ -12,20 +14,23 @@ export function settingsFile(env = process.env, platform = process.platform, hom
|
|
|
12
14
|
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
13
15
|
const xdg = env.XDG_CONFIG_HOME;
|
|
14
16
|
if (xdg && paths.isAbsolute(xdg))
|
|
15
|
-
return paths.join(xdg, "
|
|
17
|
+
return paths.join(xdg, "plexus", "otel.env");
|
|
16
18
|
if (platform === "win32" && env.APPDATA)
|
|
17
|
-
return paths.join(env.APPDATA, "
|
|
18
|
-
return paths.join(home, ".config", "
|
|
19
|
+
return paths.join(env.APPDATA, "plexus", "otel.env");
|
|
20
|
+
return paths.join(home, ".config", "plexus", "otel.env");
|
|
19
21
|
}
|
|
20
22
|
const settingName = /^OTEL_[A-Z0-9_]+$/;
|
|
21
23
|
/**
|
|
22
|
-
* The OTEL_* settings a file's lines give
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* The OTEL_* settings a file's lines give, as a dotenv file reads, lines
|
|
25
|
+
* ending in LF, CRLF or a lone CR, as a Pharo image writes them. Blank
|
|
26
|
+
* lines and `#` comments are skipped, as is a leading `export`. A value in
|
|
27
|
+
* single or double quotes is what they hold, `#` included, and may be followed
|
|
28
|
+
* by a comment; any other value ends where a `#` begins it or follows
|
|
29
|
+
* whitespace. Any other key is not ours to set.
|
|
25
30
|
*/
|
|
26
31
|
export function parseSettings(text) {
|
|
27
32
|
const settings = {};
|
|
28
|
-
for (const raw of text.split(/\r
|
|
33
|
+
for (const raw of text.split(/\r\n|\r|\n/)) {
|
|
29
34
|
const line = raw.trim().replace(/^export\s+/, "");
|
|
30
35
|
if (line === "" || line.startsWith("#"))
|
|
31
36
|
continue;
|
|
@@ -35,23 +40,29 @@ export function parseSettings(text) {
|
|
|
35
40
|
const key = line.slice(0, equals).trim();
|
|
36
41
|
if (!settingName.test(key))
|
|
37
42
|
continue;
|
|
38
|
-
|
|
39
|
-
const quoted = value.match(/^(["'])(.*)\1$/s);
|
|
40
|
-
if (quoted)
|
|
41
|
-
value = quoted[2];
|
|
42
|
-
settings[key] = value;
|
|
43
|
+
settings[key] = settingValue(line.slice(equals + 1));
|
|
43
44
|
}
|
|
44
45
|
return settings;
|
|
45
46
|
}
|
|
47
|
+
function settingValue(text) {
|
|
48
|
+
const value = text.trim();
|
|
49
|
+
const quote = value[0];
|
|
50
|
+
if (quote === '"' || quote === "'") {
|
|
51
|
+
const end = value.indexOf(quote, 1);
|
|
52
|
+
if (end > 0 && /^(\s+#.*)?\s*$/s.test(value.slice(end + 1)))
|
|
53
|
+
return value.slice(1, end);
|
|
54
|
+
}
|
|
55
|
+
const comment = /(^|\s)#/.exec(value);
|
|
56
|
+
return (comment === null ? value : value.slice(0, comment.index)).trim();
|
|
57
|
+
}
|
|
46
58
|
/**
|
|
47
|
-
* Puts the file's settings into the environment
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
59
|
+
* Puts the file's settings into the environment in place of every OTEL_* it
|
|
60
|
+
* inherited, when the file gives any: the file, not what an agent host
|
|
61
|
+
* passed on, decides where PLexus and its images send. With no file, or a file
|
|
62
|
+
* that gives none, the environment decides. The images PLexus starts run in
|
|
63
|
+
* this environment, so they read the same settings. Answers what it set.
|
|
51
64
|
*/
|
|
52
65
|
export function applySettingsFile(env = process.env, file = settingsFile(env)) {
|
|
53
|
-
if (Object.keys(env).some((key) => key.startsWith("OTEL_")))
|
|
54
|
-
return {};
|
|
55
66
|
let text;
|
|
56
67
|
try {
|
|
57
68
|
text = fs.readFileSync(file, "utf8");
|
|
@@ -60,7 +71,23 @@ export function applySettingsFile(env = process.env, file = settingsFile(env)) {
|
|
|
60
71
|
return {};
|
|
61
72
|
}
|
|
62
73
|
const settings = parseSettings(text);
|
|
74
|
+
if (Object.keys(settings).length === 0)
|
|
75
|
+
return {};
|
|
76
|
+
for (const key of Object.keys(env)) {
|
|
77
|
+
if (key.startsWith("OTEL_"))
|
|
78
|
+
delete env[key];
|
|
79
|
+
}
|
|
63
80
|
Object.assign(env, settings);
|
|
64
81
|
return settings;
|
|
65
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Turns the OpenTelemetry SDK's own diagnostics off for the images PLexus
|
|
85
|
+
* starts, unless the environment sets a level: they run in this environment,
|
|
86
|
+
* and opentelemetry-pharo writes its diagnostics to the VM's standard output,
|
|
87
|
+
* as `OTEL_LOG_LEVEL` allows. Applied after the settings file, so that a
|
|
88
|
+
* level the file sets is the one kept.
|
|
89
|
+
*/
|
|
90
|
+
export function quietImageDiagnostics(env = process.env) {
|
|
91
|
+
env.OTEL_LOG_LEVEL ??= "none";
|
|
92
|
+
}
|
|
66
93
|
//# sourceMappingURL=settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/telemetry/settings.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/telemet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yB,OAAO,CAAC,GAAG,EACpC,OAAe,YAAY,CAAC,GAAG,CAAC;IAEhC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC7B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACxE,GAAG,CAAC,cAAc,KAAK,MAAM,CAAC;AAChC,CAAC"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
* What PLexus records about its own work, through the OpenTelemetry API
|
|
3
|
-
* alone: every call here is a no-op until the application running PLexus
|
|
4
|
-
* registers an SDK. A span carries names, kinds and outcomes, never a value:
|
|
5
|
-
* no argument, result, image name, path or message, and no status
|
|
6
|
-
* description, since that would be a message.
|
|
7
|
-
*/
|
|
8
|
-
import { type Attributes, type Span, type SpanKind } from "@opentelemetry/api";
|
|
1
|
+
import { type Attributes, type Context, type Span, type SpanKind } from "@opentelemetry/api";
|
|
9
2
|
/** A name chosen by code, kept as it is when it looks like an identifier, and `_OTHER` when it does not. */
|
|
10
3
|
export declare function identifierOrOther(name: string): string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The names of a call's arguments that look like identifiers, never their
|
|
6
|
+
* values: those the tool declares as `plexus.argument.names`, and the others
|
|
7
|
+
* as `plexus.argument.unknown_names`, so that a name the caller made up is
|
|
8
|
+
* only ever in the second; the others not at all without `unknown`, when
|
|
9
|
+
* what the tool declares is not known in full.
|
|
10
|
+
*/
|
|
11
|
+
export declare function argumentAttributes(args: Record<string, unknown>, declared: ReadonlySet<string>, options?: {
|
|
12
|
+
unknown?: boolean;
|
|
13
|
+
}): Attributes;
|
|
14
|
+
/** The context with `id` as its session: on the spans made in it, and in the baggage what it forwards carries. */
|
|
15
|
+
export declare function withSession(active: Context, id: string): Context;
|
|
16
|
+
/** The session the context runs in, or the process's own, made at random the first time it is asked for. */
|
|
17
|
+
export declare function sessionOf(active: Context): string;
|
|
13
18
|
/**
|
|
14
19
|
* Which agent host called, and which version of it, as its initialize
|
|
15
20
|
* request named itself: each kept only when it reads as a product name or a
|
|
@@ -27,10 +32,11 @@ export declare function failed(span: Span, type: string): void;
|
|
|
27
32
|
*/
|
|
28
33
|
export declare function errorType(error: unknown): string;
|
|
29
34
|
/**
|
|
30
|
-
* `work` inside a span that is active while it runs, ended with its outcome
|
|
31
|
-
* A rejection fails the span with the type
|
|
35
|
+
* `work` inside a span that is active while it runs, ended with its outcome,
|
|
36
|
+
* with the session it runs in. A rejection fails the span with the type
|
|
37
|
+
* `typeOf` gives, unless it gives none, and is passed on.
|
|
32
38
|
*/
|
|
33
|
-
export declare function inSpan<T>(name: string, kind: SpanKind, attributes: Attributes, work: (span: Span) => Promise<T>, typeOf?: (error: unknown) => string): Promise<T>;
|
|
39
|
+
export declare function inSpan<T>(name: string, kind: SpanKind, attributes: Attributes, work: (span: Span) => Promise<T>, typeOf?: (error: unknown) => string | undefined): Promise<T>;
|
|
34
40
|
/**
|
|
35
41
|
* The params with the active trace context in their `_meta`, under the
|
|
36
42
|
* unprefixed `traceparent`, `tracestate` and `baggage` keys, beside whatever
|
|
@@ -38,6 +44,8 @@ export declare function inSpan<T>(name: string, kind: SpanKind, attributes: Attr
|
|
|
38
44
|
* which is always the case while no SDK is registered.
|
|
39
45
|
*/
|
|
40
46
|
export declare function withTraceContext(params: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
47
|
+
/** The context with `key` set to `value` in its baggage, beside the entries it has. */
|
|
48
|
+
export declare function withBaggageEntry(active: Context, key: string, value: string): Context;
|
|
41
49
|
/** The trace context a request's `_meta` names, as the parent of what answers it. */
|
|
42
|
-
export declare function contextFromMeta(meta: unknown):
|
|
50
|
+
export declare function contextFromMeta(meta: unknown): Context;
|
|
43
51
|
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/telemetry/trace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/telemetry/trace.ts"],"names":[],"mappings":"AAWA,OAAO,EAML,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAM5B,4GAA4G;AAC5G,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,EAC7B,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,UAAU,CAQZ;AAMD,kHAAkH;AAClH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,4GAA4G;AAC5G,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAGjD;A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