apps 0.0.1-beta.8 → 0.0.1-beta.81
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/README.md +25 -22
- package/framework-reference.json +1 -1
- package/js/{chunk-72JNVHPK.js → chunk-4NFSABEA.js} +4 -3
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/chunk-5WGONRKQ.js +426 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/chunk-CDXQDN7W.js +92 -0
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/{chunk-FL2QR3XW.js → chunk-HJG4RBYM.js} +333 -69
- package/js/chunk-I6Q7ZPKJ.js +49 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-5T57N25Q.js → chunk-KGCTYL2S.js} +511 -63
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/{chunk-WLE7WX2U.js → chunk-NG56RPCA.js} +2348 -472
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-Z5M2LQOZ.js → chunk-OY47QPQY.js} +67 -55
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/chunk-PL5KOEZD.js +334 -0
- package/js/chunk-Q4IZAUIF.js +285 -0
- package/js/{chunk-RJDDBDSN.js → chunk-QWQM3CLH.js} +795 -177
- package/js/{chunk-RFVIONFX.js → chunk-TE25A7D6.js} +123 -44
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/chunk-W6XCQAXP.js +171 -0
- package/js/chunk-WCGAO3X5.js +348 -0
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/{chunk-CMYUWAX7.js → chunk-YQUG4CES.js} +126 -31
- package/js/{chunk-UESPOTUI.js → chunk-Z2SWTZCF.js} +861 -231
- package/js/client.js +142 -94
- package/js/contracts.js +127 -26
- package/js/effect.js +19 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +50 -40
- package/js/host.js +83 -58
- package/js/index.js +131 -46
- package/js/mcp/effect.js +23 -21
- package/js/mcp/stdio.js +44 -34
- package/js/mcp.js +76 -53
- package/js/openapi.js +4071 -1357
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8604 -223
- package/package.json +3 -4
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +7 -3
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +19 -11
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +93 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +649 -17
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +80 -10
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +8 -4
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +157 -47
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +3843 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +90 -6
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +37 -3
- package/types/apps/src/contracts/workflows.d.ts +6 -0
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +28 -1
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +59 -0
- package/types/apps/src/implementation/failure-detail.d.ts +25 -3
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +26 -6
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +18 -0
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +17 -2
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +18 -3
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +11 -13
- package/types/apps/src/implementation/router.d.ts +16 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schema.d.ts +90 -10
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +28 -9
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +1 -1
- package/types/apps/src/implementation/workflows.d.ts +1 -1
- package/types/apps/src/index.d.ts +55 -13
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-OCYUEU47.js +0 -224
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-YXQHV65J.js +0 -242
- package/js/chunk-ZQINWV4W.js +0 -630
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/storage.d.ts +0 -15
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FetchHttpClient_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PD6I2SDG.js";
|
|
4
|
+
import {
|
|
5
|
+
recordedMessage
|
|
6
|
+
} from "./chunk-5FHWNLCI.js";
|
|
4
7
|
import {
|
|
5
8
|
HttpBody_exports,
|
|
6
9
|
HttpClient,
|
|
@@ -16,17 +19,21 @@ import {
|
|
|
16
19
|
post,
|
|
17
20
|
retryTransient,
|
|
18
21
|
setBody,
|
|
22
|
+
tap,
|
|
23
|
+
tapError,
|
|
19
24
|
transformResponse,
|
|
20
25
|
uint8Array
|
|
21
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EOPQ727L.js";
|
|
22
27
|
import {
|
|
23
28
|
Array as Array2,
|
|
24
29
|
Boolean2 as Boolean,
|
|
30
|
+
Cause_exports,
|
|
25
31
|
Clock,
|
|
26
32
|
Clock_exports,
|
|
27
33
|
Context_exports,
|
|
28
34
|
CurrentLogAnnotations,
|
|
29
35
|
CurrentLogSpans,
|
|
36
|
+
Duration_exports,
|
|
30
37
|
Effect_exports,
|
|
31
38
|
Exit_exports,
|
|
32
39
|
FiberSet_exports,
|
|
@@ -37,8 +44,10 @@ import {
|
|
|
37
44
|
Logger_exports,
|
|
38
45
|
Metric_exports,
|
|
39
46
|
Option_exports,
|
|
47
|
+
Predicate_exports,
|
|
40
48
|
Record2 as Record,
|
|
41
49
|
Redacted_exports,
|
|
50
|
+
Schedule_exports,
|
|
42
51
|
Schema_exports,
|
|
43
52
|
Scope,
|
|
44
53
|
Semaphore_exports,
|
|
@@ -53,7 +62,7 @@ import {
|
|
|
53
62
|
UndefinedOr,
|
|
54
63
|
addDelay,
|
|
55
64
|
addFinalizer,
|
|
56
|
-
all,
|
|
65
|
+
all2 as all,
|
|
57
66
|
allocate,
|
|
58
67
|
andThen,
|
|
59
68
|
annotateLogs,
|
|
@@ -89,9 +98,9 @@ import {
|
|
|
89
98
|
isSome,
|
|
90
99
|
layer,
|
|
91
100
|
logDebug,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
make,
|
|
102
|
+
make4 as make2,
|
|
103
|
+
make5 as make3,
|
|
95
104
|
map,
|
|
96
105
|
map3 as map2,
|
|
97
106
|
map5 as map3,
|
|
@@ -107,7 +116,7 @@ import {
|
|
|
107
116
|
prettyErrors,
|
|
108
117
|
provideMerge,
|
|
109
118
|
provideService,
|
|
110
|
-
|
|
119
|
+
random,
|
|
111
120
|
run2 as run,
|
|
112
121
|
runtime,
|
|
113
122
|
schema,
|
|
@@ -125,11 +134,172 @@ import {
|
|
|
125
134
|
withDefault2 as withDefault,
|
|
126
135
|
withTracerEnabled,
|
|
127
136
|
zero
|
|
128
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-IFJU5SYQ.js";
|
|
129
138
|
import {
|
|
130
139
|
__export
|
|
131
140
|
} from "./chunk-CZ7CSFO4.js";
|
|
132
141
|
|
|
142
|
+
// ../telemetry/src/ownership.ts
|
|
143
|
+
var ownerAttribute = "executor.owner";
|
|
144
|
+
var SpanOwner = Context_exports.Reference("@executor-js/telemetry/SpanOwner", {
|
|
145
|
+
defaultValue: () => void 0
|
|
146
|
+
});
|
|
147
|
+
var declaredOwner = (annotations) => Context_exports.get(annotations, SpanOwner);
|
|
148
|
+
var ownedBy = (owner, options = {}) => ({
|
|
149
|
+
...options,
|
|
150
|
+
annotations: Context_exports.add(options.annotations ?? Context_exports.empty(), SpanOwner, owner)
|
|
151
|
+
});
|
|
152
|
+
var owned = (owner, name, options) => (effect2) => effect2.pipe(Effect_exports.withSpan(name, ownedBy(owner, options)));
|
|
153
|
+
var measuredSpan = (name, options, measure) => (effect2) => Effect_exports.useSpan(name, options, (span) => {
|
|
154
|
+
const inner = Effect_exports.withParentSpan(effect2, span);
|
|
155
|
+
if (span.status._tag === "Ended") return inner;
|
|
156
|
+
const { around, end } = measure(span.status.startTime);
|
|
157
|
+
return (around === void 0 ? inner : around(inner)).pipe(
|
|
158
|
+
Effect_exports.onExit(
|
|
159
|
+
(exit) => Effect_exports.flatMap(
|
|
160
|
+
Clock_exports.currentTimeNanos,
|
|
161
|
+
(now) => Effect_exports.sync(() => {
|
|
162
|
+
end(now, span);
|
|
163
|
+
span.end(now, exit);
|
|
164
|
+
})
|
|
165
|
+
)
|
|
166
|
+
)
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
var concurrent = ["executor", "person", "upstream", "lease", "app"];
|
|
170
|
+
var noTime = () => ({
|
|
171
|
+
executor: 0,
|
|
172
|
+
app: 0,
|
|
173
|
+
upstream: 0,
|
|
174
|
+
person: 0,
|
|
175
|
+
lease: 0,
|
|
176
|
+
background: 0
|
|
177
|
+
});
|
|
178
|
+
var makeOwnershipAccounting = (origin, owner) => {
|
|
179
|
+
const totals = noTime();
|
|
180
|
+
const innermost = noTime();
|
|
181
|
+
const boundaries2 = /* @__PURE__ */ new WeakMap();
|
|
182
|
+
let reached = origin;
|
|
183
|
+
let done = false;
|
|
184
|
+
let background = 0;
|
|
185
|
+
const advance = (time) => {
|
|
186
|
+
if (time <= reached) return;
|
|
187
|
+
const current = concurrent.find((candidate) => innermost[candidate] > 0) ?? owner;
|
|
188
|
+
const elapsed = Number(time - reached) / 1e6;
|
|
189
|
+
totals[current] += elapsed;
|
|
190
|
+
if (background > 0) totals.background += elapsed;
|
|
191
|
+
reached = time;
|
|
192
|
+
};
|
|
193
|
+
const enclosing = (boundary) => {
|
|
194
|
+
let found = boundary.parent;
|
|
195
|
+
while (found !== void 0 && !found.open) found = found.parent;
|
|
196
|
+
boundary.parent = found;
|
|
197
|
+
return found;
|
|
198
|
+
};
|
|
199
|
+
const opened = (boundary) => {
|
|
200
|
+
if (boundary.owner === "background") {
|
|
201
|
+
background += 1;
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const parent = enclosing(boundary);
|
|
205
|
+
if (parent !== void 0 && parent.children++ === 0) innermost[parent.owner] -= 1;
|
|
206
|
+
innermost[boundary.owner] += 1;
|
|
207
|
+
};
|
|
208
|
+
const closed = (boundary) => {
|
|
209
|
+
boundary.open = false;
|
|
210
|
+
if (boundary.owner === "background") {
|
|
211
|
+
background -= 1;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (boundary.children === 0) innermost[boundary.owner] -= 1;
|
|
215
|
+
const parent = enclosing(boundary);
|
|
216
|
+
if (parent === void 0) return;
|
|
217
|
+
parent.children += boundary.children - 1;
|
|
218
|
+
if (parent.children === 0) innermost[parent.owner] += 1;
|
|
219
|
+
};
|
|
220
|
+
const observed = (tracer) => ({
|
|
221
|
+
...tracer,
|
|
222
|
+
span: (options) => {
|
|
223
|
+
const span = tracer.span(options);
|
|
224
|
+
if (done) return span;
|
|
225
|
+
const parent = Option_exports.getOrUndefined(options.parent);
|
|
226
|
+
const enclosingBoundary = parent === void 0 ? void 0 : boundaries2.get(parent);
|
|
227
|
+
const inBackground = enclosingBoundary?.owner === "background";
|
|
228
|
+
const declared = inBackground ? "background" : declaredOwner(options.annotations);
|
|
229
|
+
const boundary = {
|
|
230
|
+
owner: declared ?? enclosingBoundary?.owner ?? owner,
|
|
231
|
+
// Background work runs beside its caller, which stays innermost meanwhile.
|
|
232
|
+
parent: declared === "background" ? void 0 : enclosingBoundary,
|
|
233
|
+
open: true,
|
|
234
|
+
children: 0
|
|
235
|
+
};
|
|
236
|
+
advance(options.startTime);
|
|
237
|
+
opened(boundary);
|
|
238
|
+
const tracked = {
|
|
239
|
+
_tag: "Span",
|
|
240
|
+
get name() {
|
|
241
|
+
return span.name;
|
|
242
|
+
},
|
|
243
|
+
get spanId() {
|
|
244
|
+
return span.spanId;
|
|
245
|
+
},
|
|
246
|
+
get traceId() {
|
|
247
|
+
return span.traceId;
|
|
248
|
+
},
|
|
249
|
+
get parent() {
|
|
250
|
+
return span.parent;
|
|
251
|
+
},
|
|
252
|
+
get annotations() {
|
|
253
|
+
return span.annotations;
|
|
254
|
+
},
|
|
255
|
+
get status() {
|
|
256
|
+
return span.status;
|
|
257
|
+
},
|
|
258
|
+
get attributes() {
|
|
259
|
+
return span.attributes;
|
|
260
|
+
},
|
|
261
|
+
get links() {
|
|
262
|
+
return span.links;
|
|
263
|
+
},
|
|
264
|
+
get sampled() {
|
|
265
|
+
return span.sampled;
|
|
266
|
+
},
|
|
267
|
+
get kind() {
|
|
268
|
+
return span.kind;
|
|
269
|
+
},
|
|
270
|
+
end: (endTime, exit) => {
|
|
271
|
+
if (boundary.open && !done) {
|
|
272
|
+
advance(endTime);
|
|
273
|
+
closed(boundary);
|
|
274
|
+
}
|
|
275
|
+
span.end(endTime, exit);
|
|
276
|
+
},
|
|
277
|
+
attribute: (key, value) => span.attribute(key, value),
|
|
278
|
+
event: (name, startTime, attributes2) => span.event(name, startTime, attributes2),
|
|
279
|
+
addLinks: (links) => span.addLinks(links)
|
|
280
|
+
};
|
|
281
|
+
boundaries2.set(tracked, boundary);
|
|
282
|
+
return tracked;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
return {
|
|
286
|
+
/** Run `effect` with the spans it opens observed, including spans it hands to later work. */
|
|
287
|
+
observe: (effect2) => Effect_exports.gen(function* () {
|
|
288
|
+
const tracer = yield* Tracer_exports.Tracer;
|
|
289
|
+
return yield* effect2.pipe(Effect_exports.provideService(Tracer_exports.Tracer, observed(tracer)));
|
|
290
|
+
}),
|
|
291
|
+
/**
|
|
292
|
+
* Close the window at `end` and return its milliseconds by owner, each instant counted once.
|
|
293
|
+
* Spans still open count up to `end`; spans that open or end afterwards are ignored.
|
|
294
|
+
*/
|
|
295
|
+
read: (end) => {
|
|
296
|
+
if (!done) advance(end);
|
|
297
|
+
done = true;
|
|
298
|
+
return totals;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
|
|
133
303
|
// ../telemetry/src/context.ts
|
|
134
304
|
var captureTelemetry = Effect_exports.gen(function* () {
|
|
135
305
|
let context2 = Context_exports.make(Tracer_exports.Tracer, yield* Tracer_exports.Tracer).pipe(
|
|
@@ -161,9 +331,10 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
|
|
|
161
331
|
const request = yield* Effect_exports.try(() => new Request(input, init));
|
|
162
332
|
const client = yield* HttpClient_exports.HttpClient;
|
|
163
333
|
const response = yield* client.execute(HttpClientRequest_exports.fromWeb(request)).pipe(
|
|
164
|
-
Effect_exports.withSpan(
|
|
165
|
-
|
|
166
|
-
|
|
334
|
+
Effect_exports.withSpan(
|
|
335
|
+
"provider.http.request",
|
|
336
|
+
ownedBy("upstream", { attributes: { "http.request.method": request.method } })
|
|
337
|
+
),
|
|
167
338
|
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, {
|
|
168
339
|
cache: request.cache,
|
|
169
340
|
credentials: request.credentials,
|
|
@@ -192,9 +363,12 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
|
|
|
192
363
|
streamed,
|
|
193
364
|
HttpBody_exports.stream(
|
|
194
365
|
body.stream.pipe(
|
|
195
|
-
Stream_exports.withSpan(
|
|
196
|
-
|
|
197
|
-
|
|
366
|
+
Stream_exports.withSpan(
|
|
367
|
+
"provider.http.response.read",
|
|
368
|
+
ownedBy("upstream", {
|
|
369
|
+
attributes: { "http.response.status_code": response.status }
|
|
370
|
+
})
|
|
371
|
+
)
|
|
198
372
|
),
|
|
199
373
|
body.contentType,
|
|
200
374
|
body.contentLength
|
|
@@ -487,15 +661,15 @@ function getTextEncoding() {
|
|
|
487
661
|
const te = new globalThis.TextEncoder();
|
|
488
662
|
const td = new globalThis.TextDecoder();
|
|
489
663
|
globalThis[symbol] = {
|
|
490
|
-
encodeUtf8(
|
|
491
|
-
return te.encode(
|
|
664
|
+
encodeUtf8(text2) {
|
|
665
|
+
return te.encode(text2);
|
|
492
666
|
},
|
|
493
667
|
decodeUtf8(bytes) {
|
|
494
668
|
return td.decode(bytes);
|
|
495
669
|
},
|
|
496
|
-
checkUtf8(
|
|
670
|
+
checkUtf8(text2) {
|
|
497
671
|
try {
|
|
498
|
-
encodeURIComponent(
|
|
672
|
+
encodeURIComponent(text2);
|
|
499
673
|
return true;
|
|
500
674
|
} catch (_) {
|
|
501
675
|
return false;
|
|
@@ -700,8 +874,8 @@ var workerWall = Metric_exports.histogram("executor.worker.wall_ms", {
|
|
|
700
874
|
attributes: { unit: "ms" },
|
|
701
875
|
description: "Native Worker invocation wall time, including stream and cleanup lifetime, in milliseconds."
|
|
702
876
|
});
|
|
703
|
-
var recordExportFailure = (path, reason
|
|
704
|
-
const signal = path.endsWith("/traces") ? "traces" : path.endsWith("/logs") ? "logs" : path.endsWith("/metrics") ? "metrics" : "other";
|
|
877
|
+
var recordExportFailure = (path, reason, records = 0) => {
|
|
878
|
+
const signal = path.endsWith("/traces") ? "traces" : path.endsWith("/logs") ? "logs" : path.endsWith("/metrics") ? "metrics" : path === "app" ? "app" : "other";
|
|
705
879
|
return Metric_exports.update(Metric_exports.withAttributes(exportFailures, { signal, reason }), 1).pipe(
|
|
706
880
|
Effect_exports.andThen(
|
|
707
881
|
Metric_exports.update(Metric_exports.withAttributes(rejectedRecords, { signal, reason }), records)
|
|
@@ -851,6 +1025,53 @@ var telemetryHttpClient = Layer_exports.effect(
|
|
|
851
1025
|
)
|
|
852
1026
|
)
|
|
853
1027
|
).pipe(Layer_exports.provide(selectedClient));
|
|
1028
|
+
var retryDelay = (error) => Effect_exports.gen(function* () {
|
|
1029
|
+
if (!HttpClientError_exports.isHttpClientError(error) || error.reason._tag !== "StatusCodeError" || error.reason.response.status !== 429 && error.reason.response.status !== 503)
|
|
1030
|
+
return Duration_exports.seconds(1);
|
|
1031
|
+
const header = error.reason.response.headers["retry-after"]?.trim();
|
|
1032
|
+
if (header === void 0 || header === "")
|
|
1033
|
+
return Duration_exports.seconds(error.reason.response.status === 429 ? 5 : 1);
|
|
1034
|
+
const seconds2 = Number(header);
|
|
1035
|
+
if (Number.isFinite(seconds2)) return Duration_exports.seconds(seconds2 >= 0 ? seconds2 : 5);
|
|
1036
|
+
const date = Date.parse(header);
|
|
1037
|
+
if (Number.isNaN(date)) return Duration_exports.seconds(5);
|
|
1038
|
+
return Duration_exports.millis(Math.max(date - (yield* Clock_exports.currentTimeMillis), 1));
|
|
1039
|
+
});
|
|
1040
|
+
var retryTelemetryExport = (client) => client.pipe(
|
|
1041
|
+
HttpClient_exports.retryTransient({
|
|
1042
|
+
times: 3,
|
|
1043
|
+
schedule: Schedule_exports.forever.pipe(
|
|
1044
|
+
Schedule_exports.passthrough,
|
|
1045
|
+
Schedule_exports.addDelay(({ output }) => retryDelay(output))
|
|
1046
|
+
)
|
|
1047
|
+
})
|
|
1048
|
+
);
|
|
1049
|
+
|
|
1050
|
+
// ../telemetry/src/recorded-failure.ts
|
|
1051
|
+
var tagOf = (error) => Predicate_exports.hasProperty(error, "_tag") && Predicate_exports.isString(error._tag) ? error._tag : void 0;
|
|
1052
|
+
var recorded = (name, message) => {
|
|
1053
|
+
const error = new Error(message);
|
|
1054
|
+
error.name = name;
|
|
1055
|
+
error.stack = message === "" ? name : `${name}: ${message}`;
|
|
1056
|
+
return error;
|
|
1057
|
+
};
|
|
1058
|
+
var recordedError = (error) => {
|
|
1059
|
+
const tag = tagOf(error);
|
|
1060
|
+
if (tag !== void 0) return recorded(tag, recordedMessage(error) ?? "");
|
|
1061
|
+
if (!(error instanceof Error)) return recorded("UnrecognizedFailure", "");
|
|
1062
|
+
if (error.cause === void 0) return error;
|
|
1063
|
+
const copy = new Error(error.message, { cause: recordedError(error.cause) });
|
|
1064
|
+
copy.name = error.name;
|
|
1065
|
+
if (error.stack !== void 0) copy.stack = error.stack;
|
|
1066
|
+
return copy;
|
|
1067
|
+
};
|
|
1068
|
+
var recordedCause = (cause) => Cause_exports.fromReasons(
|
|
1069
|
+
cause.reasons.flatMap((reason) => {
|
|
1070
|
+
if (Cause_exports.isInterruptReason(reason)) return [reason];
|
|
1071
|
+
const replaced = Cause_exports.isFailReason(reason) ? Cause_exports.fail(recordedError(reason.error)) : Cause_exports.die(recordedError(reason.defect));
|
|
1072
|
+
return Cause_exports.annotate(replaced, Cause_exports.reasonAnnotations(reason)).reasons;
|
|
1073
|
+
})
|
|
1074
|
+
);
|
|
854
1075
|
|
|
855
1076
|
// ../telemetry/src/span-attributes.ts
|
|
856
1077
|
var LogicalOperationFailed = class extends Schema_exports.TaggedError()(
|
|
@@ -865,7 +1086,10 @@ var httpSpanAttributeAllowlist = /* @__PURE__ */ new Set([
|
|
|
865
1086
|
"server.address",
|
|
866
1087
|
"url.scheme",
|
|
867
1088
|
// Path only. `url.full` and `url.query` carry the query string, so neither is listed.
|
|
1089
|
+
// Once a route is recorded, the path is that route's template (`allowlistedSpan`).
|
|
868
1090
|
"url.path",
|
|
1091
|
+
// The router's matched path template, such as `/api/organizations/:organization`; no values.
|
|
1092
|
+
"http.route",
|
|
869
1093
|
"http.request.header.content-type",
|
|
870
1094
|
"http.request.header.content-length",
|
|
871
1095
|
"http.request.header.user-agent",
|
|
@@ -878,51 +1102,70 @@ var spanAttributeAllowed = (key) => {
|
|
|
878
1102
|
const name = key.toLowerCase();
|
|
879
1103
|
return !httpNamespaces.some((namespace) => name.startsWith(namespace)) || httpSpanAttributeAllowlist.has(name);
|
|
880
1104
|
};
|
|
881
|
-
var allowedEntries = (
|
|
882
|
-
var allowlistedSpan = (span) =>
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1105
|
+
var allowedEntries = (attributes2) => Object.fromEntries(Object.entries(attributes2).filter(([key]) => spanAttributeAllowed(key)));
|
|
1106
|
+
var allowlistedSpan = (span) => {
|
|
1107
|
+
let path = false;
|
|
1108
|
+
let route;
|
|
1109
|
+
return {
|
|
1110
|
+
_tag: "Span",
|
|
1111
|
+
get name() {
|
|
1112
|
+
return span.name;
|
|
1113
|
+
},
|
|
1114
|
+
get spanId() {
|
|
1115
|
+
return span.spanId;
|
|
1116
|
+
},
|
|
1117
|
+
get traceId() {
|
|
1118
|
+
return span.traceId;
|
|
1119
|
+
},
|
|
1120
|
+
get parent() {
|
|
1121
|
+
return span.parent;
|
|
1122
|
+
},
|
|
1123
|
+
get annotations() {
|
|
1124
|
+
return span.annotations;
|
|
1125
|
+
},
|
|
1126
|
+
get status() {
|
|
1127
|
+
return span.status;
|
|
1128
|
+
},
|
|
1129
|
+
get attributes() {
|
|
1130
|
+
return span.attributes;
|
|
1131
|
+
},
|
|
1132
|
+
get links() {
|
|
1133
|
+
return span.links;
|
|
1134
|
+
},
|
|
1135
|
+
get sampled() {
|
|
1136
|
+
return span.sampled;
|
|
1137
|
+
},
|
|
1138
|
+
get kind() {
|
|
1139
|
+
return span.kind;
|
|
1140
|
+
},
|
|
1141
|
+
// A successful transport can carry a failed domain operation. The producer
|
|
1142
|
+
// explicitly marks that outcome; arbitrary result payloads are never inspected.
|
|
1143
|
+
// A failure records the fixed message an error declares in place of an app's text.
|
|
1144
|
+
end: (endTime, exit) => span.end(
|
|
1145
|
+
endTime,
|
|
1146
|
+
Exit_exports.isSuccess(exit) ? span.attributes.get("executor.outcome") === "failed" ? Exit_exports.fail(new LogicalOperationFailed()) : exit : Exit_exports.failCause(recordedCause(exit.cause))
|
|
1147
|
+
),
|
|
1148
|
+
attribute: (key, value) => {
|
|
1149
|
+
if (!spanAttributeAllowed(key)) return;
|
|
1150
|
+
if (key === "url.path" && typeof value === "string") {
|
|
1151
|
+
path = true;
|
|
1152
|
+
span.attribute(key, route ?? value);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
if (key === "http.route" && typeof value === "string") {
|
|
1156
|
+
route = value;
|
|
1157
|
+
if (path) span.attribute("url.path", value);
|
|
1158
|
+
}
|
|
1159
|
+
span.attribute(key, value);
|
|
1160
|
+
},
|
|
1161
|
+
event: (name, startTime, attributes2) => span.event(
|
|
1162
|
+
name,
|
|
1163
|
+
startTime,
|
|
1164
|
+
attributes2 === void 0 ? void 0 : allowedEntries(attributes2)
|
|
1165
|
+
),
|
|
1166
|
+
addLinks: (links) => span.addLinks(links)
|
|
1167
|
+
};
|
|
1168
|
+
};
|
|
926
1169
|
var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_exports.Tracer)(
|
|
927
1170
|
Tracer_exports.Tracer.pipe(
|
|
928
1171
|
Effect_exports.map((tracer) => ({
|
|
@@ -934,6 +1177,8 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
934
1177
|
if (recordAll && Option_exports.isSome(options.parent) && options.parent.value._tag === "ExternalSpan")
|
|
935
1178
|
span.attribute("executor.trace.parent_sampled", options.parent.value.sampled);
|
|
936
1179
|
if (clock !== void 0) span.attribute("executor.clock.type", clock);
|
|
1180
|
+
const owner = declaredOwner(options.annotations);
|
|
1181
|
+
if (owner !== void 0) span.attribute(ownerAttribute, owner);
|
|
937
1182
|
return span;
|
|
938
1183
|
}
|
|
939
1184
|
}))
|
|
@@ -941,7 +1186,7 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
941
1186
|
);
|
|
942
1187
|
var allowlistedSpans = spanAttributes();
|
|
943
1188
|
|
|
944
|
-
// ../../node_modules/.bun/effect@
|
|
1189
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
|
|
945
1190
|
var OtlpLogger_exports = {};
|
|
946
1191
|
__export(OtlpLogger_exports, {
|
|
947
1192
|
layer: () => layer2,
|
|
@@ -949,7 +1194,7 @@ __export(OtlpLogger_exports, {
|
|
|
949
1194
|
make: () => make6
|
|
950
1195
|
});
|
|
951
1196
|
|
|
952
|
-
// ../../node_modules/.bun/effect@
|
|
1197
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpEnv.js
|
|
953
1198
|
var exporterList = (path) => Array2(String2, path).pipe(map3((_) => _.map((_2) => _2.toLowerCase().trim()).filter((_2) => _2 !== "")));
|
|
954
1199
|
var headersRecord = (path) => Record(String2, StringFromUriComponent, path);
|
|
955
1200
|
var headers = (signal) => headersRecord(`OTEL_EXPORTER_OTLP_${signal}_HEADERS`).pipe(orElse(() => headersRecord("OTEL_EXPORTER_OTLP_HEADERS")), withDefault(void 0));
|
|
@@ -960,7 +1205,7 @@ var endpoint = (signal) => URL2(`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`).pipe(or
|
|
|
960
1205
|
}))), withDefault(void 0));
|
|
961
1206
|
var exporters = (signal) => exporterList(`OTEL_${signal}_EXPORTER`).pipe(withDefault([]));
|
|
962
1207
|
|
|
963
|
-
// ../../node_modules/.bun/effect@
|
|
1208
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpExporter.js
|
|
964
1209
|
var OtlpExporter_exports = {};
|
|
965
1210
|
__export(OtlpExporter_exports, {
|
|
966
1211
|
Flusher: () => Flusher,
|
|
@@ -1015,7 +1260,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1015
1260
|
const scope = get(services, Scope);
|
|
1016
1261
|
const exportInterval = max(fromInputUnsafe(options.exportInterval), zero);
|
|
1017
1262
|
let disabledUntil = void 0;
|
|
1018
|
-
const client =
|
|
1263
|
+
const client = get(services, HttpClient).pipe(tap((response) => ignore(response.arrayBuffer)), tapError((error) => error.response ? ignore(error.response.arrayBuffer) : void_), filterStatusOk, transformResponse(provideService(TracerPropagationEnabled, false)), retryTransient({
|
|
1019
1264
|
schedule: policy,
|
|
1020
1265
|
times: 3
|
|
1021
1266
|
}));
|
|
@@ -1072,7 +1317,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1072
1317
|
};
|
|
1073
1318
|
});
|
|
1074
1319
|
|
|
1075
|
-
// ../../node_modules/.bun/effect@
|
|
1320
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpResource.js
|
|
1076
1321
|
var make5 = (options) => {
|
|
1077
1322
|
const resourceAttributes = options.attributes ? entriesToAttributes(Object.entries(options.attributes)) : [];
|
|
1078
1323
|
resourceAttributes.push({
|
|
@@ -1098,16 +1343,16 @@ var fromConfig = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1098
1343
|
const env = yield* Record(StringFromUriComponent, StringFromUriComponent, "OTEL_RESOURCE_ATTRIBUTES").pipe(withDefault(void 0));
|
|
1099
1344
|
const serviceName = options?.serviceName ?? options?.attributes?.["service.name"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_NAME")) ?? env?.["service.name"] ?? (yield* String3("OTEL_SERVICE_NAME"));
|
|
1100
1345
|
const serviceVersion = options?.serviceVersion ?? options?.attributes?.["service.version"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_VERSION")) ?? env?.["service.version"];
|
|
1101
|
-
const
|
|
1346
|
+
const attributes2 = {
|
|
1102
1347
|
...env,
|
|
1103
1348
|
...options?.attributes
|
|
1104
1349
|
};
|
|
1105
|
-
delete
|
|
1106
|
-
delete
|
|
1350
|
+
delete attributes2["service.name"];
|
|
1351
|
+
delete attributes2["service.version"];
|
|
1107
1352
|
return make5({
|
|
1108
1353
|
serviceName,
|
|
1109
1354
|
serviceVersion,
|
|
1110
|
-
attributes
|
|
1355
|
+
attributes: attributes2
|
|
1111
1356
|
});
|
|
1112
1357
|
}, orDie);
|
|
1113
1358
|
var serviceNameUnsafe = (resource) => {
|
|
@@ -1118,14 +1363,14 @@ var serviceNameUnsafe = (resource) => {
|
|
|
1118
1363
|
return serviceNameAttribute.value.stringValue;
|
|
1119
1364
|
};
|
|
1120
1365
|
var entriesToAttributes = (entries) => {
|
|
1121
|
-
const
|
|
1366
|
+
const attributes2 = [];
|
|
1122
1367
|
for (const [key, value] of entries) {
|
|
1123
|
-
|
|
1368
|
+
attributes2.push({
|
|
1124
1369
|
key,
|
|
1125
1370
|
value: unknownToAttributeValue(value)
|
|
1126
1371
|
});
|
|
1127
1372
|
}
|
|
1128
|
-
return
|
|
1373
|
+
return attributes2;
|
|
1129
1374
|
};
|
|
1130
1375
|
var unknownToAttributeValue = (value) => {
|
|
1131
1376
|
if (Array.isArray(value)) {
|
|
@@ -1161,7 +1406,7 @@ var unknownToAttributeValue = (value) => {
|
|
|
1161
1406
|
}
|
|
1162
1407
|
};
|
|
1163
1408
|
|
|
1164
|
-
// ../../node_modules/.bun/effect@
|
|
1409
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1165
1410
|
var OtlpSerialization_exports = {};
|
|
1166
1411
|
__export(OtlpSerialization_exports, {
|
|
1167
1412
|
OtlpSerialization: () => OtlpSerialization,
|
|
@@ -1169,7 +1414,7 @@ __export(OtlpSerialization_exports, {
|
|
|
1169
1414
|
layerProtobuf: () => layerProtobuf
|
|
1170
1415
|
});
|
|
1171
1416
|
|
|
1172
|
-
// ../../node_modules/.bun/effect@
|
|
1417
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/protobuf.js
|
|
1173
1418
|
var WireType2 = {
|
|
1174
1419
|
Varint: 0,
|
|
1175
1420
|
Fixed64: 1,
|
|
@@ -1238,7 +1483,7 @@ var messageField = (fieldNumber, message) => lengthDelimitedField(fieldNumber, m
|
|
|
1238
1483
|
var repeatedField = (fieldNumber, values, encode) => concat(...values.map((v) => messageField(fieldNumber, encode(v))));
|
|
1239
1484
|
var optionalStringField = (fieldNumber, value) => value !== void 0 && value !== "" ? stringField(fieldNumber, value) : new Uint8Array(0);
|
|
1240
1485
|
|
|
1241
|
-
// ../../node_modules/.bun/effect@
|
|
1486
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpProtobuf.js
|
|
1242
1487
|
var encodeAnyValue = (value) => {
|
|
1243
1488
|
if (value.stringValue !== void 0 && value.stringValue !== null) {
|
|
1244
1489
|
return stringField(1, value.stringValue);
|
|
@@ -1268,7 +1513,7 @@ var encodeKeyValueList = (value) => repeatedField(1, value.values, encodeKeyValu
|
|
|
1268
1513
|
var encodeKeyValue = (kv) => concat(stringField(1, kv.key), messageField(2, encodeAnyValue(kv.value)));
|
|
1269
1514
|
var encodeInstrumentationScope = (scope) => concat(stringField(1, scope.name), optionalStringField(2, scope.version), scope.attributes ? repeatedField(3, scope.attributes, encodeKeyValue) : new Uint8Array(0), scope.droppedAttributesCount ? varintField(4, scope.droppedAttributesCount) : new Uint8Array(0));
|
|
1270
1515
|
var encodeResource = (resource) => concat(repeatedField(1, resource.attributes, encodeKeyValue), resource.droppedAttributesCount > 0 ? varintField(2, resource.droppedAttributesCount) : new Uint8Array(0));
|
|
1271
|
-
var encodeStatus = (
|
|
1516
|
+
var encodeStatus = (status2) => concat(optionalStringField(2, status2.message), varintField(3, status2.code));
|
|
1272
1517
|
var encodeEvent = (event) => concat(fixed64Field(1, BigInt(event.timeUnixNano)), stringField(2, event.name), repeatedField(3, event.attributes, encodeKeyValue), event.droppedAttributesCount > 0 ? varintField(4, event.droppedAttributesCount) : new Uint8Array(0));
|
|
1273
1518
|
var encodeLink = (link) => concat(bytesFieldFromHex(1, link.traceId), bytesFieldFromHex(2, link.spanId), optionalStringField(3, link.traceState), repeatedField(4, link.attributes, encodeKeyValue), link.droppedAttributesCount > 0 ? varintField(5, link.droppedAttributesCount) : new Uint8Array(0), link.flags !== void 0 ? fixed32Field(6, link.flags) : new Uint8Array(0));
|
|
1274
1519
|
var encodeSpan = (span) => concat(bytesFieldFromHex(1, span.traceId), bytesFieldFromHex(2, span.spanId), optionalStringField(3, span.traceState), span.parentSpanId !== void 0 ? bytesFieldFromHex(4, span.parentSpanId) : new Uint8Array(0), stringField(5, span.name), varintField(6, span.kind), fixed64Field(7, BigInt(span.startTimeUnixNano)), fixed64Field(8, BigInt(span.endTimeUnixNano)), repeatedField(9, span.attributes, encodeKeyValue), span.droppedAttributesCount > 0 ? varintField(10, span.droppedAttributesCount) : new Uint8Array(0), repeatedField(11, span.events, encodeEvent), span.droppedEventsCount > 0 ? varintField(12, span.droppedEventsCount) : new Uint8Array(0), repeatedField(13, span.links, encodeLink), span.droppedLinksCount > 0 ? varintField(14, span.droppedLinksCount) : new Uint8Array(0), messageField(15, encodeStatus(span.status)), span.flags !== void 0 ? fixed32Field(16, span.flags) : new Uint8Array(0));
|
|
@@ -1277,7 +1522,7 @@ var encodeResourceSpans = (resourceSpans) => concat(messageField(1, encodeResour
|
|
|
1277
1522
|
var encodeTracesData = (tracesData) => repeatedField(1, tracesData.resourceSpans, encodeResourceSpans);
|
|
1278
1523
|
var encodeNumberDataPoint = (point) => concat(fixed64Field(2, BigInt(point.startTimeUnixNano)), fixed64Field(3, BigInt(point.timeUnixNano)), point.asDouble !== void 0 ? doubleField(4, point.asDouble) : new Uint8Array(0), point.asInt !== void 0 ? fixed64Field(6, BigInt(point.asInt)) : new Uint8Array(0), repeatedField(7, point.attributes, encodeKeyValue), point.flags !== void 0 ? varintField(8, point.flags) : new Uint8Array(0));
|
|
1279
1524
|
var encodeHistogramDataPoint = (point) => {
|
|
1280
|
-
const bucketCountsEncoded = concat(...point.bucketCounts.map((
|
|
1525
|
+
const bucketCountsEncoded = concat(...point.bucketCounts.map((count2) => fixed64Field(6, BigInt(count2))));
|
|
1281
1526
|
const explicitBoundsEncoded = concat(...point.explicitBounds.map((bound) => doubleField(7, bound)));
|
|
1282
1527
|
return concat(fixed64Field(2, BigInt(point.startTimeUnixNano)), fixed64Field(3, BigInt(point.timeUnixNano)), fixed64Field(4, BigInt(point.count)), point.sum !== void 0 ? doubleField(5, point.sum) : new Uint8Array(0), bucketCountsEncoded, explicitBoundsEncoded, repeatedField(9, point.attributes, encodeKeyValue), point.flags !== void 0 ? varintField(10, point.flags) : new Uint8Array(0), point.min !== void 0 ? doubleField(11, point.min) : new Uint8Array(0), point.max !== void 0 ? doubleField(12, point.max) : new Uint8Array(0));
|
|
1283
1528
|
};
|
|
@@ -1293,7 +1538,7 @@ var encodeScopeLogs = (scopeLogs) => concat(messageField(1, encodeInstrumentatio
|
|
|
1293
1538
|
var encodeResourceLogs = (resourceLogs) => concat(messageField(1, encodeResource(resourceLogs.resource)), repeatedField(2, resourceLogs.scopeLogs, encodeScopeLogs), optionalStringField(3, resourceLogs.schemaUrl));
|
|
1294
1539
|
var encodeLogsData = (logsData) => repeatedField(1, logsData.resourceLogs, encodeResourceLogs);
|
|
1295
1540
|
|
|
1296
|
-
// ../../node_modules/.bun/effect@
|
|
1541
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1297
1542
|
var OtlpSerialization = class extends (/* @__PURE__ */ Service()("effect/observability/OtlpSerialization")) {
|
|
1298
1543
|
};
|
|
1299
1544
|
var layerJson = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
@@ -1307,7 +1552,7 @@ var layerProtobuf = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
|
1307
1552
|
logs: (logs) => uint8Array(encodeLogsData(logs), "application/x-protobuf")
|
|
1308
1553
|
});
|
|
1309
1554
|
|
|
1310
|
-
// ../../node_modules/.bun/effect@
|
|
1555
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
|
|
1311
1556
|
var make6 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
1312
1557
|
const serialization = yield* OtlpSerialization;
|
|
1313
1558
|
const otelResource = yield* fromConfig(options.resource);
|
|
@@ -1385,8 +1630,8 @@ var makeLogRecord = (options, opts) => {
|
|
|
1385
1630
|
const now = opts.clock.currentTimeNanosUnsafe();
|
|
1386
1631
|
const nanosString = now.toString();
|
|
1387
1632
|
const nowMillis = options.date.getTime();
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1633
|
+
const attributes2 = entriesToAttributes(Object.entries(options.fiber.getRef(CurrentLogAnnotations)));
|
|
1634
|
+
attributes2.push({
|
|
1390
1635
|
key: "fiberId",
|
|
1391
1636
|
value: {
|
|
1392
1637
|
intValue: options.fiber.id
|
|
@@ -1394,7 +1639,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1394
1639
|
});
|
|
1395
1640
|
if (!opts.excludeLogSpans) {
|
|
1396
1641
|
for (const [label, startTime] of options.fiber.getRef(CurrentLogSpans)) {
|
|
1397
|
-
|
|
1642
|
+
attributes2.push({
|
|
1398
1643
|
key: `logSpan.${label}`,
|
|
1399
1644
|
value: {
|
|
1400
1645
|
stringValue: `${nowMillis - startTime}ms`
|
|
@@ -1403,7 +1648,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1403
1648
|
}
|
|
1404
1649
|
}
|
|
1405
1650
|
if (options.cause.reasons.length > 0) {
|
|
1406
|
-
|
|
1651
|
+
attributes2.push({
|
|
1407
1652
|
key: "log.error",
|
|
1408
1653
|
value: {
|
|
1409
1654
|
stringValue: pretty(options.cause)
|
|
@@ -1416,7 +1661,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1416
1661
|
severityText: options.logLevel,
|
|
1417
1662
|
timeUnixNano: nanosString,
|
|
1418
1663
|
observedTimeUnixNano: nanosString,
|
|
1419
|
-
attributes,
|
|
1664
|
+
attributes: attributes2,
|
|
1420
1665
|
body: unknownToAttributeValue(message.length === 1 ? message[0] : message),
|
|
1421
1666
|
droppedAttributesCount: 0
|
|
1422
1667
|
};
|
|
@@ -1473,7 +1718,7 @@ var ESeverityNumber = {
|
|
|
1473
1718
|
SEVERITY_NUMBER_FATAL4: 24
|
|
1474
1719
|
};
|
|
1475
1720
|
|
|
1476
|
-
// ../../node_modules/.bun/effect@
|
|
1721
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpMetrics.js
|
|
1477
1722
|
var OtlpMetrics_exports = {};
|
|
1478
1723
|
__export(OtlpMetrics_exports, {
|
|
1479
1724
|
layer: () => layer3,
|
|
@@ -1519,7 +1764,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1519
1764
|
for (let i = 0, len = snapshot2.length; i < len; i++) {
|
|
1520
1765
|
const state = snapshot2[i];
|
|
1521
1766
|
const unit = state.attributes?.unit ?? state.attributes?.time_unit ?? "1";
|
|
1522
|
-
const
|
|
1767
|
+
const attributes2 = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
|
|
1523
1768
|
const metricKey = makeMetricKey(state.id, state.attributes);
|
|
1524
1769
|
switch (state.type) {
|
|
1525
1770
|
case "Counter": {
|
|
@@ -1545,7 +1790,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1545
1790
|
nextCounterState.set(metricKey, currentCount);
|
|
1546
1791
|
}
|
|
1547
1792
|
const dataPoint = {
|
|
1548
|
-
attributes,
|
|
1793
|
+
attributes: attributes2,
|
|
1549
1794
|
startTimeUnixNano: intervalStartTime,
|
|
1550
1795
|
timeUnixNano: nowTime
|
|
1551
1796
|
};
|
|
@@ -1572,7 +1817,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1572
1817
|
}
|
|
1573
1818
|
case "Gauge": {
|
|
1574
1819
|
const dataPoint = {
|
|
1575
|
-
attributes,
|
|
1820
|
+
attributes: attributes2,
|
|
1576
1821
|
startTimeUnixNano: startTime,
|
|
1577
1822
|
timeUnixNano: nowTime
|
|
1578
1823
|
};
|
|
@@ -1632,7 +1877,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1632
1877
|
});
|
|
1633
1878
|
}
|
|
1634
1879
|
const dataPoint = {
|
|
1635
|
-
attributes,
|
|
1880
|
+
attributes: attributes2,
|
|
1636
1881
|
startTimeUnixNano: intervalStartTime,
|
|
1637
1882
|
timeUnixNano: nowTime,
|
|
1638
1883
|
count: reportCount,
|
|
@@ -1671,7 +1916,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1671
1916
|
}
|
|
1672
1917
|
}
|
|
1673
1918
|
dataPoints.push({
|
|
1674
|
-
attributes: [...
|
|
1919
|
+
attributes: [...attributes2, {
|
|
1675
1920
|
key: "key",
|
|
1676
1921
|
value: {
|
|
1677
1922
|
stringValue: freqKey
|
|
@@ -1703,7 +1948,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1703
1948
|
}
|
|
1704
1949
|
case "Summary": {
|
|
1705
1950
|
const dataPoints = [{
|
|
1706
|
-
attributes: [...
|
|
1951
|
+
attributes: [...attributes2, {
|
|
1707
1952
|
key: "quantile",
|
|
1708
1953
|
value: {
|
|
1709
1954
|
stringValue: "min"
|
|
@@ -1715,7 +1960,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1715
1960
|
}];
|
|
1716
1961
|
for (const [quantile, value] of state.state.quantiles) {
|
|
1717
1962
|
dataPoints.push({
|
|
1718
|
-
attributes: [...
|
|
1963
|
+
attributes: [...attributes2, {
|
|
1719
1964
|
key: "quantile",
|
|
1720
1965
|
value: {
|
|
1721
1966
|
stringValue: quantile.toString()
|
|
@@ -1727,7 +1972,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1727
1972
|
});
|
|
1728
1973
|
}
|
|
1729
1974
|
dataPoints.push({
|
|
1730
|
-
attributes: [...
|
|
1975
|
+
attributes: [...attributes2, {
|
|
1731
1976
|
key: "quantile",
|
|
1732
1977
|
value: {
|
|
1733
1978
|
stringValue: "max"
|
|
@@ -1751,13 +1996,13 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1751
1996
|
});
|
|
1752
1997
|
}
|
|
1753
1998
|
const countDataPoint = {
|
|
1754
|
-
attributes,
|
|
1999
|
+
attributes: attributes2,
|
|
1755
2000
|
startTimeUnixNano: intervalStartTime,
|
|
1756
2001
|
timeUnixNano: nowTime,
|
|
1757
2002
|
asInt: reportCount
|
|
1758
2003
|
};
|
|
1759
2004
|
const sumDataPoint = {
|
|
1760
|
-
attributes,
|
|
2005
|
+
attributes: attributes2,
|
|
1761
2006
|
startTimeUnixNano: intervalStartTime,
|
|
1762
2007
|
timeUnixNano: nowTime,
|
|
1763
2008
|
asDouble: reportSum
|
|
@@ -1870,11 +2115,11 @@ var layerFromConfig2 = (options) => gen(function* () {
|
|
|
1870
2115
|
temporality: getOrUndefined(temporalityPreference)
|
|
1871
2116
|
});
|
|
1872
2117
|
}).pipe(orDie, unwrap);
|
|
1873
|
-
var makeMetricKey = (id,
|
|
1874
|
-
if (
|
|
2118
|
+
var makeMetricKey = (id, attributes2) => {
|
|
2119
|
+
if (attributes2 === void 0 || Object.keys(attributes2).length === 0) {
|
|
1875
2120
|
return id;
|
|
1876
2121
|
}
|
|
1877
|
-
const sortedEntries = Object.entries(
|
|
2122
|
+
const sortedEntries = Object.entries(attributes2).sort((a, b) => a[0].localeCompare(b[0]));
|
|
1878
2123
|
return `${id}:${JSON.stringify(sortedEntries)}`;
|
|
1879
2124
|
};
|
|
1880
2125
|
var EAggregationTemporality = {
|
|
@@ -1936,7 +2181,7 @@ var EAggregationTemporality = {
|
|
|
1936
2181
|
AGGREGATION_TEMPORALITY_CUMULATIVE: 2
|
|
1937
2182
|
};
|
|
1938
2183
|
|
|
1939
|
-
// ../../node_modules/.bun/effect@
|
|
2184
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpTracer.js
|
|
1940
2185
|
var OtlpTracer_exports = {};
|
|
1941
2186
|
__export(OtlpTracer_exports, {
|
|
1942
2187
|
layer: () => layer4,
|
|
@@ -2051,10 +2296,10 @@ var SpanImpl = class {
|
|
|
2051
2296
|
};
|
|
2052
2297
|
}
|
|
2053
2298
|
get traceId() {
|
|
2054
|
-
return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId :
|
|
2299
|
+
return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId : random(32);
|
|
2055
2300
|
}
|
|
2056
2301
|
get spanId() {
|
|
2057
|
-
return this._spanId ??=
|
|
2302
|
+
return this._spanId ??= random(16);
|
|
2058
2303
|
}
|
|
2059
2304
|
get attributes() {
|
|
2060
2305
|
return this._attributes ??= /* @__PURE__ */ new Map();
|
|
@@ -2074,39 +2319,39 @@ var SpanImpl = class {
|
|
|
2074
2319
|
attribute(key, value) {
|
|
2075
2320
|
this.attributes.set(key, value);
|
|
2076
2321
|
}
|
|
2077
|
-
event(name, startTime,
|
|
2078
|
-
this.events.push([name, startTime,
|
|
2322
|
+
event(name, startTime, attributes2) {
|
|
2323
|
+
this.events.push([name, startTime, attributes2]);
|
|
2079
2324
|
}
|
|
2080
2325
|
addLinks(links) {
|
|
2081
2326
|
this.links.push(...links);
|
|
2082
2327
|
}
|
|
2083
2328
|
};
|
|
2084
2329
|
var makeOtlpSpan = (self) => {
|
|
2085
|
-
const
|
|
2086
|
-
const
|
|
2330
|
+
const status2 = self.status;
|
|
2331
|
+
const attributes2 = self._attributes === void 0 ? [] : entriesToAttributes(self._attributes);
|
|
2087
2332
|
const events = [];
|
|
2088
2333
|
if (self._events !== void 0) {
|
|
2089
2334
|
for (let i = 0; i < self._events.length; i++) {
|
|
2090
|
-
const [name, startTime,
|
|
2335
|
+
const [name, startTime, attributes3] = self._events[i];
|
|
2091
2336
|
events.push({
|
|
2092
2337
|
name,
|
|
2093
2338
|
timeUnixNano: String(startTime),
|
|
2094
|
-
attributes:
|
|
2339
|
+
attributes: attributes3 ? entriesToAttributes(Object.entries(attributes3)) : [],
|
|
2095
2340
|
droppedAttributesCount: 0
|
|
2096
2341
|
});
|
|
2097
2342
|
}
|
|
2098
2343
|
}
|
|
2099
2344
|
let otelStatus;
|
|
2100
|
-
if (
|
|
2345
|
+
if (status2.exit._tag === "Success") {
|
|
2101
2346
|
otelStatus = {
|
|
2102
2347
|
code: StatusCode.Ok
|
|
2103
2348
|
};
|
|
2104
|
-
} else if (hasInterruptsOnly(
|
|
2349
|
+
} else if (hasInterruptsOnly(status2.exit.cause)) {
|
|
2105
2350
|
otelStatus = {
|
|
2106
2351
|
code: StatusCode.Ok,
|
|
2107
2352
|
message: "Interrupted"
|
|
2108
2353
|
};
|
|
2109
|
-
|
|
2354
|
+
attributes2.push({
|
|
2110
2355
|
key: "span.label",
|
|
2111
2356
|
value: {
|
|
2112
2357
|
stringValue: "\u26A0\uFE0E Interrupted"
|
|
@@ -2118,7 +2363,7 @@ var makeOtlpSpan = (self) => {
|
|
|
2118
2363
|
}
|
|
2119
2364
|
});
|
|
2120
2365
|
} else {
|
|
2121
|
-
const errors = prettyErrors(
|
|
2366
|
+
const errors = prettyErrors(status2.exit.cause, {
|
|
2122
2367
|
includeCauseInStack: true
|
|
2123
2368
|
});
|
|
2124
2369
|
otelStatus = {
|
|
@@ -2129,7 +2374,7 @@ var makeOtlpSpan = (self) => {
|
|
|
2129
2374
|
for (const error of errors) {
|
|
2130
2375
|
events.push({
|
|
2131
2376
|
name: "exception",
|
|
2132
|
-
timeUnixNano: String(
|
|
2377
|
+
timeUnixNano: String(status2.endTime),
|
|
2133
2378
|
droppedAttributesCount: 0,
|
|
2134
2379
|
attributes: [{
|
|
2135
2380
|
"key": "exception.type",
|
|
@@ -2167,9 +2412,9 @@ var makeOtlpSpan = (self) => {
|
|
|
2167
2412
|
parentSpanId: isSome(self.parent) ? self.parent.value.spanId : void 0,
|
|
2168
2413
|
name: self.name,
|
|
2169
2414
|
kind: SpanKind[self.kind],
|
|
2170
|
-
startTimeUnixNano: String(
|
|
2171
|
-
endTimeUnixNano: String(
|
|
2172
|
-
attributes,
|
|
2415
|
+
startTimeUnixNano: String(status2.startTime),
|
|
2416
|
+
endTimeUnixNano: String(status2.endTime),
|
|
2417
|
+
attributes: attributes2,
|
|
2173
2418
|
droppedAttributesCount: 0,
|
|
2174
2419
|
events,
|
|
2175
2420
|
droppedEventsCount: 0,
|
|
@@ -2193,18 +2438,18 @@ var SpanKind = {
|
|
|
2193
2438
|
};
|
|
2194
2439
|
|
|
2195
2440
|
// ../telemetry/src/layer.ts
|
|
2196
|
-
var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.withConsoleError(Logger_exports.formatJson)) => {
|
|
2441
|
+
var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.withConsoleError(Logger_exports.formatJson), shutdownTimeouts = {}) => {
|
|
2197
2442
|
const resource = {
|
|
2198
2443
|
serviceName: config.service,
|
|
2199
2444
|
serviceVersion: config.version,
|
|
2200
2445
|
attributes: { "deployment.environment.name": config.environment }
|
|
2201
2446
|
};
|
|
2202
|
-
const signal = (target) => ({
|
|
2447
|
+
const signal = (target, name) => ({
|
|
2203
2448
|
url: target.url,
|
|
2204
2449
|
resource,
|
|
2205
2450
|
...target.headers === void 0 ? {} : { headers: Redacted_exports.value(target.headers) },
|
|
2206
2451
|
exportInterval: lifetime === "event" ? "1 hour" : "1 second",
|
|
2207
|
-
shutdownTimeout: "3 seconds"
|
|
2452
|
+
shutdownTimeout: shutdownTimeouts[name] ?? "3 seconds"
|
|
2208
2453
|
});
|
|
2209
2454
|
const console = Logger_exports.layer([logger]);
|
|
2210
2455
|
return Layer_exports.mergeAll(
|
|
@@ -2216,18 +2461,18 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
|
|
|
2216
2461
|
// not authority to suppress server diagnostics.
|
|
2217
2462
|
spanAttributes(config.clock, true).pipe(
|
|
2218
2463
|
Layer_exports.provideMerge(
|
|
2219
|
-
OtlpTracer_exports.layer(signal(config.traces)).pipe(
|
|
2464
|
+
OtlpTracer_exports.layer(signal(config.traces, "traces")).pipe(
|
|
2220
2465
|
Layer_exports.provide(OtlpSerialization_exports.layerJson)
|
|
2221
2466
|
)
|
|
2222
2467
|
)
|
|
2223
2468
|
)
|
|
2224
2469
|
),
|
|
2225
2470
|
config.logs === void 0 ? console : OtlpLogger_exports.layer({
|
|
2226
|
-
...signal(config.logs),
|
|
2471
|
+
...signal(config.logs, "logs"),
|
|
2227
2472
|
mergeWithExisting: true
|
|
2228
2473
|
}).pipe(Layer_exports.provide(OtlpSerialization_exports.layerJson), Layer_exports.provideMerge(console)),
|
|
2229
2474
|
config.metrics === void 0 ? Layer_exports.empty : OtlpMetrics_exports.layer({
|
|
2230
|
-
...signal(config.metrics),
|
|
2475
|
+
...signal(config.metrics, "metrics"),
|
|
2231
2476
|
exportInterval: "30 seconds",
|
|
2232
2477
|
temporality: "delta"
|
|
2233
2478
|
}).pipe(
|
|
@@ -2245,30 +2490,391 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
|
|
|
2245
2490
|
);
|
|
2246
2491
|
};
|
|
2247
2492
|
|
|
2493
|
+
// ../telemetry/src/app-records.ts
|
|
2494
|
+
var appText = "Text from the app is not recorded";
|
|
2495
|
+
var unrecognized = "unrecognized";
|
|
2496
|
+
var operations = [
|
|
2497
|
+
"requirements",
|
|
2498
|
+
"inspect",
|
|
2499
|
+
"skills",
|
|
2500
|
+
"query",
|
|
2501
|
+
"mutate",
|
|
2502
|
+
"call",
|
|
2503
|
+
"account-check",
|
|
2504
|
+
"webhooks",
|
|
2505
|
+
"webhook-validate",
|
|
2506
|
+
"webhook-complete",
|
|
2507
|
+
"webhook-register",
|
|
2508
|
+
"webhook-unregister",
|
|
2509
|
+
"webhook-handle",
|
|
2510
|
+
"workflows",
|
|
2511
|
+
"workflow-validate",
|
|
2512
|
+
"workflow-run",
|
|
2513
|
+
"migrate"
|
|
2514
|
+
];
|
|
2515
|
+
var httpMethods = [
|
|
2516
|
+
"GET",
|
|
2517
|
+
"HEAD",
|
|
2518
|
+
"POST",
|
|
2519
|
+
"PUT",
|
|
2520
|
+
"PATCH",
|
|
2521
|
+
"DELETE",
|
|
2522
|
+
"OPTIONS",
|
|
2523
|
+
"TRACE",
|
|
2524
|
+
"CONNECT"
|
|
2525
|
+
];
|
|
2526
|
+
var appSpanNames = /* @__PURE__ */ new Set([
|
|
2527
|
+
"app.dispatch",
|
|
2528
|
+
...operations.map((operation) => `app.${operation}`),
|
|
2529
|
+
"app.evaluate",
|
|
2530
|
+
"app.accounts.bind",
|
|
2531
|
+
"app.account.check",
|
|
2532
|
+
"app.catalog.read",
|
|
2533
|
+
"app.skills.load",
|
|
2534
|
+
"app.skills.routers",
|
|
2535
|
+
"app.tool.resolve",
|
|
2536
|
+
"app.tool.approval",
|
|
2537
|
+
"app.tool.elicitation",
|
|
2538
|
+
"app.elicitation.wait",
|
|
2539
|
+
"app.workflow.control",
|
|
2540
|
+
"app.operation.execute",
|
|
2541
|
+
"app.sql.migrate",
|
|
2542
|
+
"app.code",
|
|
2543
|
+
"app.cache.call",
|
|
2544
|
+
"app.cache.get",
|
|
2545
|
+
"app.cache.load",
|
|
2546
|
+
"app.cache.command",
|
|
2547
|
+
"app.cache.publish",
|
|
2548
|
+
"app.cache.flush",
|
|
2549
|
+
"app.cache.lease.renew",
|
|
2550
|
+
"app.cache.lease.wait",
|
|
2551
|
+
"app.cache.refresh",
|
|
2552
|
+
"provider.http.request",
|
|
2553
|
+
"provider.http.response.read",
|
|
2554
|
+
"provider.openapi.call",
|
|
2555
|
+
"provider.graphql.request",
|
|
2556
|
+
"provider.graphql.call",
|
|
2557
|
+
"provider.mcp.session",
|
|
2558
|
+
"provider.mcp.connect",
|
|
2559
|
+
"provider.mcp.close",
|
|
2560
|
+
"provider.mcp.request",
|
|
2561
|
+
"provider.mcp.call",
|
|
2562
|
+
"provider.mcp.discover",
|
|
2563
|
+
"provider.mcp.check",
|
|
2564
|
+
"provider.mcp.health",
|
|
2565
|
+
"provider.mcp.anonymous",
|
|
2566
|
+
"provider.mcp.elicitation",
|
|
2567
|
+
"sql.execute",
|
|
2568
|
+
...httpMethods.map((method) => `http.client ${method}`)
|
|
2569
|
+
]);
|
|
2570
|
+
var errorKinds = /* @__PURE__ */ new Set([
|
|
2571
|
+
"HostRequestInvalid",
|
|
2572
|
+
"HostAccountsInvalid",
|
|
2573
|
+
"HostDeclarationInvalid",
|
|
2574
|
+
"HostEvaluationFailed",
|
|
2575
|
+
"HostOperationNotFound",
|
|
2576
|
+
"HostOperationFailed",
|
|
2577
|
+
"HostKindMismatch",
|
|
2578
|
+
"HostToolNotFound",
|
|
2579
|
+
"HostInputInvalid",
|
|
2580
|
+
"HostOutputInvalid",
|
|
2581
|
+
"HostToolBlocked",
|
|
2582
|
+
"HostToolApprovalRequired",
|
|
2583
|
+
"HostToolPolicyFailed",
|
|
2584
|
+
"ElicitationFailed",
|
|
2585
|
+
"DatabaseLimitExceeded",
|
|
2586
|
+
"DatabaseFieldReserved",
|
|
2587
|
+
"SkillLoadFailed",
|
|
2588
|
+
"WorkflowFailure",
|
|
2589
|
+
"ProviderError",
|
|
2590
|
+
"OpenapiResponseError",
|
|
2591
|
+
"OpenapiError",
|
|
2592
|
+
"OpenapiCompileError",
|
|
2593
|
+
"GraphqlError",
|
|
2594
|
+
"McpError",
|
|
2595
|
+
"McpToolError",
|
|
2596
|
+
"McpCredentialsUnverified",
|
|
2597
|
+
"CacheError",
|
|
2598
|
+
"AppDatabaseError",
|
|
2599
|
+
"AppStorageError",
|
|
2600
|
+
"AppStorageUnavailable",
|
|
2601
|
+
"NetworkRefused",
|
|
2602
|
+
"FetchOptionUnsupported",
|
|
2603
|
+
"LogicalOperationFailed",
|
|
2604
|
+
"HttpClientError",
|
|
2605
|
+
"SchemaError",
|
|
2606
|
+
"TimeoutError",
|
|
2607
|
+
"UnknownError",
|
|
2608
|
+
"InterruptError",
|
|
2609
|
+
"Error",
|
|
2610
|
+
"TypeError",
|
|
2611
|
+
"RangeError",
|
|
2612
|
+
"ReferenceError",
|
|
2613
|
+
"SyntaxError",
|
|
2614
|
+
"EvalError",
|
|
2615
|
+
"URIError",
|
|
2616
|
+
"AggregateError",
|
|
2617
|
+
"AbortError",
|
|
2618
|
+
"string",
|
|
2619
|
+
"number",
|
|
2620
|
+
"bigint",
|
|
2621
|
+
"boolean",
|
|
2622
|
+
"symbol",
|
|
2623
|
+
"undefined",
|
|
2624
|
+
"object",
|
|
2625
|
+
"function"
|
|
2626
|
+
]);
|
|
2627
|
+
var failureCodes = /* @__PURE__ */ new Set([
|
|
2628
|
+
// CacheError
|
|
2629
|
+
"unavailable",
|
|
2630
|
+
"storage",
|
|
2631
|
+
"invalid",
|
|
2632
|
+
"capacity",
|
|
2633
|
+
"timeout",
|
|
2634
|
+
// AppDatabaseError
|
|
2635
|
+
"schema",
|
|
2636
|
+
"schema_changed",
|
|
2637
|
+
"table",
|
|
2638
|
+
"index",
|
|
2639
|
+
"range",
|
|
2640
|
+
"value",
|
|
2641
|
+
"readonly",
|
|
2642
|
+
"cursor",
|
|
2643
|
+
"limit",
|
|
2644
|
+
"closed",
|
|
2645
|
+
"replay",
|
|
2646
|
+
// OpenapiError
|
|
2647
|
+
"invalid_definition",
|
|
2648
|
+
"invalid_input",
|
|
2649
|
+
"request",
|
|
2650
|
+
// McpError, McpCredentialsUnverified and ProviderError
|
|
2651
|
+
"unauthorized",
|
|
2652
|
+
"invalid_response",
|
|
2653
|
+
"forbidden",
|
|
2654
|
+
"rate_limited",
|
|
2655
|
+
"rejected",
|
|
2656
|
+
"anonymous_access",
|
|
2657
|
+
// NetworkRefused and FetchOptionUnsupported
|
|
2658
|
+
"private_address",
|
|
2659
|
+
"credential_host",
|
|
2660
|
+
"credential_app",
|
|
2661
|
+
"credential_expired",
|
|
2662
|
+
"redirect",
|
|
2663
|
+
"cache",
|
|
2664
|
+
"integrity"
|
|
2665
|
+
]);
|
|
2666
|
+
var text = (value) => typeof value["stringValue"] === "string" ? value["stringValue"] : void 0;
|
|
2667
|
+
var integer = (value) => {
|
|
2668
|
+
const raw = value["intValue"];
|
|
2669
|
+
const number = typeof raw === "string" && /^-?\d{1,15}$/.test(raw) ? Number(raw) : raw;
|
|
2670
|
+
return typeof number === "number" && Number.isSafeInteger(number) ? number : void 0;
|
|
2671
|
+
};
|
|
2672
|
+
var oneOf = (...values) => (value) => {
|
|
2673
|
+
const found = text(value);
|
|
2674
|
+
return found !== void 0 && values.includes(found) ? { stringValue: found } : void 0;
|
|
2675
|
+
};
|
|
2676
|
+
var classified = (known) => (value) => {
|
|
2677
|
+
const found = text(value);
|
|
2678
|
+
return found === void 0 ? void 0 : { stringValue: known.has(found) ? found : unrecognized };
|
|
2679
|
+
};
|
|
2680
|
+
var flag = (value) => typeof value["boolValue"] === "boolean" ? { boolValue: value["boolValue"] } : void 0;
|
|
2681
|
+
var count = (value) => {
|
|
2682
|
+
const found = integer(value);
|
|
2683
|
+
return found !== void 0 && found >= 0 ? { intValue: found } : void 0;
|
|
2684
|
+
};
|
|
2685
|
+
var status = (value) => {
|
|
2686
|
+
const found = integer(value);
|
|
2687
|
+
return found !== void 0 && found >= 100 && found <= 599 ? { intValue: found } : void 0;
|
|
2688
|
+
};
|
|
2689
|
+
var duration = (value) => {
|
|
2690
|
+
const found = typeof value["doubleValue"] === "number" ? value["doubleValue"] : integer(value);
|
|
2691
|
+
return found !== void 0 && Number.isFinite(found) && found >= 0 ? { doubleValue: found } : void 0;
|
|
2692
|
+
};
|
|
2693
|
+
var spanAttributes2 = {
|
|
2694
|
+
"executor.operation": oneOf(...operations, "mutation", "discover"),
|
|
2695
|
+
"executor.outcome": oneOf("failed"),
|
|
2696
|
+
"executor.clock.type": oneOf("system", "cloudflare-io"),
|
|
2697
|
+
"executor.trace.parent_sampled": flag,
|
|
2698
|
+
"executor.failure.source": oneOf("app", "storage", "service"),
|
|
2699
|
+
"executor.failure.code": classified(failureCodes),
|
|
2700
|
+
"error.type": classified(errorKinds),
|
|
2701
|
+
"cache.operation": oneOf(
|
|
2702
|
+
"read",
|
|
2703
|
+
"acquire",
|
|
2704
|
+
"claim",
|
|
2705
|
+
"publish",
|
|
2706
|
+
"release",
|
|
2707
|
+
"renew",
|
|
2708
|
+
"write",
|
|
2709
|
+
"invalidate"
|
|
2710
|
+
),
|
|
2711
|
+
"cache.result": oneOf("fresh", "stale", "miss", "local"),
|
|
2712
|
+
"cache.load.leased": flag,
|
|
2713
|
+
"cache.flush.index": count,
|
|
2714
|
+
"cache.flush.count": count,
|
|
2715
|
+
"cache.flush.entries": count,
|
|
2716
|
+
"cache.flush.bytes": count,
|
|
2717
|
+
"cache.leases": count,
|
|
2718
|
+
"mcp.transport": oneOf("http", "sse", "stdio"),
|
|
2719
|
+
"mcp.operation": oneOf("discover", "call", "check", "health"),
|
|
2720
|
+
"mcp.tool.is_error": flag,
|
|
2721
|
+
"rpc.system.name": oneOf("jsonrpc"),
|
|
2722
|
+
"rpc.method": oneOf("initialize", "tools/list", "tools/call", "ping"),
|
|
2723
|
+
"graphql.operation.type": oneOf("query", "mutation", "subscription"),
|
|
2724
|
+
"db.system.name": oneOf("sqlite"),
|
|
2725
|
+
"db.operation.name": oneOf("execute"),
|
|
2726
|
+
"http.request.method": oneOf(...httpMethods),
|
|
2727
|
+
"http.response.status_code": status,
|
|
2728
|
+
"url.scheme": oneOf("http", "https"),
|
|
2729
|
+
"span.label": oneOf("\u26A0\uFE0E Interrupted"),
|
|
2730
|
+
"status.interrupted": flag,
|
|
2731
|
+
"executor.milestone.reached": flag,
|
|
2732
|
+
"executor.owner": oneOf("executor", "app", "upstream", "person", "lease", "background"),
|
|
2733
|
+
"executor.app.code": oneOf(
|
|
2734
|
+
"factory",
|
|
2735
|
+
"router",
|
|
2736
|
+
"approval",
|
|
2737
|
+
"handler",
|
|
2738
|
+
"loader",
|
|
2739
|
+
"cache",
|
|
2740
|
+
"webhook",
|
|
2741
|
+
"check",
|
|
2742
|
+
"skills",
|
|
2743
|
+
"elicitation",
|
|
2744
|
+
"workflow",
|
|
2745
|
+
"step"
|
|
2746
|
+
),
|
|
2747
|
+
"executor.workflow.operation": oneOf("start", "get", "list", "terminate"),
|
|
2748
|
+
"cache.method": oneOf("get", "revalidate", "read", "readMany", "write", "invalidate"),
|
|
2749
|
+
"executor.upstream.wait_ms": duration,
|
|
2750
|
+
"executor.elicitation.wait_ms": duration,
|
|
2751
|
+
"executor.authored_ms": duration,
|
|
2752
|
+
"executor.lease.wait_ms": duration,
|
|
2753
|
+
"executor.background_ms": duration,
|
|
2754
|
+
"executor.overhead_ms": duration
|
|
2755
|
+
};
|
|
2756
|
+
var appSpanAttributeKeys = new Set(Object.keys(spanAttributes2));
|
|
2757
|
+
var logMessages = /* @__PURE__ */ new Set([
|
|
2758
|
+
"The app's request failed unexpectedly",
|
|
2759
|
+
"App cache refresh failed",
|
|
2760
|
+
"MCP catalog invalidation failed",
|
|
2761
|
+
"Telemetry export failed"
|
|
2762
|
+
]);
|
|
2763
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2764
|
+
var spanId = (value) => typeof value === "string" && /^[a-f0-9]{16}$/.test(value) ? value : void 0;
|
|
2765
|
+
var nanos = (value) => typeof value === "string" && /^\d{1,20}$/.test(value) ? value : void 0;
|
|
2766
|
+
var between = (value, minimum, maximum) => typeof value === "number" && Number.isInteger(value) && value >= minimum && value <= maximum ? value : void 0;
|
|
2767
|
+
var attributes = (from) => (Array.isArray(from) ? from : []).flatMap((attribute) => {
|
|
2768
|
+
if (!isObject(attribute) || typeof attribute["key"] !== "string") return [];
|
|
2769
|
+
const key = attribute["key"];
|
|
2770
|
+
const keep = Object.hasOwn(spanAttributes2, key) ? spanAttributes2[key] : void 0;
|
|
2771
|
+
const value = attribute["value"];
|
|
2772
|
+
const kept = keep === void 0 || !isObject(value) ? void 0 : keep(value);
|
|
2773
|
+
return kept === void 0 ? [] : [{ key, value: kept }];
|
|
2774
|
+
});
|
|
2775
|
+
var exception = (event) => {
|
|
2776
|
+
const named = (Array.isArray(event["attributes"]) ? event["attributes"] : []).find(
|
|
2777
|
+
(attribute) => isObject(attribute) && attribute["key"] === "exception.type"
|
|
2778
|
+
);
|
|
2779
|
+
const type = isObject(named) && isObject(named["value"]) ? text(named["value"]) : void 0;
|
|
2780
|
+
const recorded2 = type !== void 0 && errorKinds.has(type) ? type : unrecognized;
|
|
2781
|
+
const time = nanos(event["timeUnixNano"]);
|
|
2782
|
+
return {
|
|
2783
|
+
name: "exception",
|
|
2784
|
+
...time === void 0 ? {} : { timeUnixNano: time },
|
|
2785
|
+
attributes: [
|
|
2786
|
+
{ key: "exception.type", value: { stringValue: recorded2 } },
|
|
2787
|
+
{ key: "exception.message", value: { stringValue: appText } },
|
|
2788
|
+
{ key: "exception.stacktrace", value: { stringValue: `${recorded2}: ${appText}` } }
|
|
2789
|
+
]
|
|
2790
|
+
};
|
|
2791
|
+
};
|
|
2792
|
+
var appSpan = (span) => {
|
|
2793
|
+
const start = nanos(span["startTimeUnixNano"]);
|
|
2794
|
+
const end = nanos(span["endTimeUnixNano"]);
|
|
2795
|
+
if (start === void 0 || end === void 0) return void 0;
|
|
2796
|
+
const parent = spanId(span["parentSpanId"]);
|
|
2797
|
+
const kind = between(span["kind"], 0, 5);
|
|
2798
|
+
const code = isObject(span["status"]) ? between(span["status"]["code"], 0, 2) : void 0;
|
|
2799
|
+
const name = typeof span["name"] === "string" && appSpanNames.has(span["name"]) ? span["name"] : "app.unrecognized";
|
|
2800
|
+
return {
|
|
2801
|
+
traceId: span.traceId,
|
|
2802
|
+
spanId: span.spanId,
|
|
2803
|
+
...parent === void 0 ? {} : { parentSpanId: parent },
|
|
2804
|
+
name,
|
|
2805
|
+
...kind === void 0 ? {} : { kind },
|
|
2806
|
+
startTimeUnixNano: start,
|
|
2807
|
+
endTimeUnixNano: end,
|
|
2808
|
+
attributes: attributes(span["attributes"]),
|
|
2809
|
+
events: (Array.isArray(span["events"]) ? span["events"] : []).flatMap(
|
|
2810
|
+
(event) => isObject(event) && event["name"] === "exception" ? [exception(event)] : []
|
|
2811
|
+
),
|
|
2812
|
+
...code === void 0 ? {} : { status: { code } }
|
|
2813
|
+
};
|
|
2814
|
+
};
|
|
2815
|
+
var appLog = (log) => {
|
|
2816
|
+
const time = nanos(log["timeUnixNano"]);
|
|
2817
|
+
const observed = nanos(log["observedTimeUnixNano"]);
|
|
2818
|
+
const severity = between(log["severityNumber"], 1, 24);
|
|
2819
|
+
const level = log["severityText"];
|
|
2820
|
+
const body = isObject(log["body"]) ? text(log["body"]) : void 0;
|
|
2821
|
+
return {
|
|
2822
|
+
...log.traceId === void 0 ? {} : { traceId: log.traceId },
|
|
2823
|
+
...log.spanId === void 0 ? {} : { spanId: log.spanId },
|
|
2824
|
+
...time === void 0 ? {} : { timeUnixNano: time },
|
|
2825
|
+
...observed === void 0 ? {} : { observedTimeUnixNano: observed },
|
|
2826
|
+
...severity === void 0 ? {} : { severityNumber: severity },
|
|
2827
|
+
...typeof level === "string" && ["Trace", "Debug", "Info", "Warn", "Error", "Fatal"].includes(level) ? { severityText: level } : {},
|
|
2828
|
+
body: { stringValue: body !== void 0 && logMessages.has(body) ? body : appText }
|
|
2829
|
+
};
|
|
2830
|
+
};
|
|
2831
|
+
|
|
2248
2832
|
// ../telemetry/src/relay.ts
|
|
2249
2833
|
var makeTelemetryForwarder = Effect_exports.gen(function* () {
|
|
2250
2834
|
const fibers = yield* FiberSet_exports.make();
|
|
2251
|
-
const pending = yield* Semaphore_exports.make(16);
|
|
2252
2835
|
const sender = yield* Semaphore_exports.make(1);
|
|
2253
|
-
const
|
|
2836
|
+
const pending = [];
|
|
2837
|
+
let queued = 0;
|
|
2838
|
+
const failed = (reason) => recordExportFailure("app", reason);
|
|
2839
|
+
const take = () => {
|
|
2840
|
+
let size = 0;
|
|
2841
|
+
let count2 = 0;
|
|
2842
|
+
while (count2 < pending.length && (count2 === 0 || size + pending[count2].size <= exportBudget))
|
|
2843
|
+
size += pending[count2++].size;
|
|
2844
|
+
queued -= size;
|
|
2845
|
+
return pending.splice(0, count2);
|
|
2846
|
+
};
|
|
2847
|
+
const sendAll = Effect_exports.suspend(() => {
|
|
2848
|
+
const forwards = take();
|
|
2849
|
+
return forwards.length === 0 ? Effect_exports.void : exportForwards(forwards, "executor-app").pipe(
|
|
2850
|
+
Effect_exports.catchTag("TimeoutError", () => failed("timeout")),
|
|
2851
|
+
Effect_exports.catch(() => failed("relay")),
|
|
2852
|
+
Effect_exports.andThen(sendAll)
|
|
2853
|
+
);
|
|
2854
|
+
});
|
|
2855
|
+
const drain = Effect_exports.suspend(
|
|
2856
|
+
() => sender.withPermitsIfAvailable(1)(sendAll).pipe(
|
|
2857
|
+
Effect_exports.flatMap((sent) => Option_exports.isSome(sent) && pending.length > 0 ? drain : Effect_exports.void)
|
|
2858
|
+
)
|
|
2859
|
+
);
|
|
2254
2860
|
yield* Effect_exports.addFinalizer(
|
|
2255
2861
|
() => FiberSet_exports.awaitEmpty(fibers).pipe(
|
|
2256
2862
|
Effect_exports.timeoutOption("3 seconds"),
|
|
2257
|
-
Effect_exports.flatMap((drained) => Option_exports.isNone(drained) ? failed("shutdown") : Effect_exports.void)
|
|
2258
|
-
)
|
|
2259
|
-
);
|
|
2260
|
-
return (batch, traceId, build) => FiberSet_exports.run(
|
|
2261
|
-
fibers,
|
|
2262
|
-
sender.withPermits(1)(
|
|
2263
|
-
forwardTelemetry(batch, traceId, build).pipe(Effect_exports.catch(() => failed("relay")))
|
|
2264
|
-
).pipe(
|
|
2265
|
-
pending.withPermitsIfAvailable(1),
|
|
2266
2863
|
Effect_exports.flatMap(
|
|
2267
|
-
(
|
|
2864
|
+
(drained) => Option_exports.isNone(drained) || pending.length > 0 ? failed("shutdown") : Effect_exports.void
|
|
2268
2865
|
)
|
|
2269
2866
|
)
|
|
2270
|
-
)
|
|
2867
|
+
);
|
|
2868
|
+
return (batch, traceId, source) => Effect_exports.suspend(() => {
|
|
2869
|
+
const size = [...batch.traces, ...batch.logs].reduce((total, body) => total + body.length, 0);
|
|
2870
|
+
if (queued + size > queueBudget) return failed("capacity");
|
|
2871
|
+
pending.push({ batch, traceId, source, size });
|
|
2872
|
+
queued += size;
|
|
2873
|
+
return FiberSet_exports.run(fibers, drain).pipe(Effect_exports.asVoid);
|
|
2874
|
+
});
|
|
2271
2875
|
});
|
|
2876
|
+
var queueBudget = 8 * 1048576;
|
|
2877
|
+
var exportBudget = 4 * 1048576;
|
|
2272
2878
|
var payloadBytes = 262144;
|
|
2273
2879
|
var encoder = new TextEncoder();
|
|
2274
2880
|
var Payload = Schema_exports.String.check(
|
|
@@ -2360,8 +2966,8 @@ var recordPacker = (prefix, suffix) => {
|
|
|
2360
2966
|
}
|
|
2361
2967
|
};
|
|
2362
2968
|
};
|
|
2363
|
-
var HexTrace = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{32}$/));
|
|
2364
|
-
var HexSpan = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{16}$/));
|
|
2969
|
+
var HexTrace = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{32}$/u));
|
|
2970
|
+
var HexSpan = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{16}$/u));
|
|
2365
2971
|
var Span = Schema_exports.StructWithRest(Schema_exports.Struct({ traceId: HexTrace, spanId: HexSpan }), [
|
|
2366
2972
|
Schema_exports.Record(Schema_exports.String, Schema_exports.Json)
|
|
2367
2973
|
]);
|
|
@@ -2391,58 +2997,67 @@ var LogPayload = Schema_exports.fromJsonString(
|
|
|
2391
2997
|
)
|
|
2392
2998
|
})
|
|
2393
2999
|
);
|
|
2394
|
-
var
|
|
3000
|
+
var exportForwards = (forwards, service) => Effect_exports.gen(function* () {
|
|
2395
3001
|
const config = yield* CurrentTelemetryConfig;
|
|
2396
3002
|
if (config === void 0) return;
|
|
2397
|
-
const resource = {
|
|
3003
|
+
const resource = ({ build, app }) => ({
|
|
2398
3004
|
attributes: [
|
|
2399
3005
|
{ key: "service.name", value: { stringValue: service } },
|
|
2400
3006
|
{ key: "service.version", value: { stringValue: config.version } },
|
|
2401
3007
|
{ key: "deployment.environment.name", value: { stringValue: config.environment } },
|
|
2402
|
-
...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }]
|
|
3008
|
+
...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }],
|
|
3009
|
+
...app === void 0 ? [] : [{ key: "executor.app.id", value: { stringValue: app } }]
|
|
2403
3010
|
]
|
|
2404
|
-
};
|
|
2405
|
-
const client = yield* HttpClient_exports.HttpClient;
|
|
2406
|
-
|
|
3011
|
+
});
|
|
3012
|
+
const client = retryTelemetryExport(yield* HttpClient_exports.HttpClient);
|
|
3013
|
+
const dropped = forwards.reduce((total, { batch }) => total + batch.dropped, 0);
|
|
3014
|
+
if (dropped > 0) yield* recordExportFailure("app", "capacity", dropped);
|
|
2407
3015
|
for (const signal of ["traces", "logs"]) {
|
|
2408
3016
|
const target = config[signal];
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
3017
|
+
const sending = forwards.filter(({ batch }) => batch[signal].length > 0);
|
|
3018
|
+
if (target === void 0 || sending.length === 0) continue;
|
|
3019
|
+
const data = signal === "traces" ? {
|
|
3020
|
+
resourceSpans: yield* Effect_exports.forEach(
|
|
3021
|
+
sending,
|
|
3022
|
+
({ batch, traceId, source }) => Effect_exports.forEach(
|
|
3023
|
+
batch.traces,
|
|
3024
|
+
(body) => Schema_exports.decodeUnknownEffect(TracePayload)(body)
|
|
3025
|
+
).pipe(
|
|
3026
|
+
Effect_exports.map((payloads) => ({
|
|
3027
|
+
resource: resource(source),
|
|
2418
3028
|
scopeSpans: [
|
|
2419
3029
|
{
|
|
2420
3030
|
scope: { name: service },
|
|
2421
|
-
spans: payloads.flatMap((payload) => payload.resourceSpans).flatMap((r) => r.scopeSpans.flatMap((s) => s.spans)).filter((span) => traceId === void 0 || span.traceId === traceId)
|
|
3031
|
+
spans: payloads.flatMap((payload) => payload.resourceSpans).flatMap((r) => r.scopeSpans.flatMap((s) => s.spans)).filter((span) => traceId === void 0 || span.traceId === traceId).flatMap((span) => {
|
|
3032
|
+
if (service !== "executor-app") return [span];
|
|
3033
|
+
const kept = appSpan(span);
|
|
3034
|
+
return kept === void 0 ? [] : [kept];
|
|
3035
|
+
})
|
|
2422
3036
|
}
|
|
2423
3037
|
]
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
3038
|
+
}))
|
|
3039
|
+
)
|
|
3040
|
+
)
|
|
3041
|
+
} : {
|
|
3042
|
+
resourceLogs: yield* Effect_exports.forEach(
|
|
3043
|
+
sending,
|
|
3044
|
+
({ batch, traceId, source }) => Effect_exports.forEach(
|
|
3045
|
+
batch.logs,
|
|
3046
|
+
(body) => Schema_exports.decodeUnknownEffect(LogPayload)(body)
|
|
3047
|
+
).pipe(
|
|
3048
|
+
Effect_exports.map((payloads) => ({
|
|
3049
|
+
resource: resource(source),
|
|
2435
3050
|
scopeLogs: [
|
|
2436
3051
|
{
|
|
2437
3052
|
scope: { name: service },
|
|
2438
|
-
logRecords: payloads.flatMap((payload) => payload.resourceLogs).flatMap((r) => r.scopeLogs.flatMap((s) => s.logRecords)).filter((log) => traceId === void 0 || log.traceId === traceId)
|
|
3053
|
+
logRecords: payloads.flatMap((payload) => payload.resourceLogs).flatMap((r) => r.scopeLogs.flatMap((s) => s.logRecords)).filter((log) => traceId === void 0 || log.traceId === traceId).map((log) => service === "executor-app" ? appLog(log) : log)
|
|
2439
3054
|
}
|
|
2440
3055
|
]
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
yield* client.
|
|
3056
|
+
}))
|
|
3057
|
+
)
|
|
3058
|
+
)
|
|
3059
|
+
};
|
|
3060
|
+
yield* client.execute(
|
|
2446
3061
|
HttpClientRequest_exports.post(target.url).pipe(
|
|
2447
3062
|
HttpClientRequest_exports.setHeaders(
|
|
2448
3063
|
target.headers === void 0 ? {} : Redacted_exports.value(target.headers)
|
|
@@ -2459,8 +3074,8 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
|
|
|
2459
3074
|
|
|
2460
3075
|
// ../telemetry/src/trace-context.ts
|
|
2461
3076
|
var TraceContext = Schema_exports.Struct({
|
|
2462
|
-
traceId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/)),
|
|
2463
|
-
spanId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/)),
|
|
3077
|
+
traceId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/u)),
|
|
3078
|
+
spanId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/u)),
|
|
2464
3079
|
sampled: Schema_exports.Boolean
|
|
2465
3080
|
});
|
|
2466
3081
|
var currentTraceContext = Effect_exports.currentSpan.pipe(
|
|
@@ -2502,13 +3117,16 @@ var pendingSpan = (name, options) => Effect_exports.gen(function* () {
|
|
|
2502
3117
|
|
|
2503
3118
|
export {
|
|
2504
3119
|
CurrentTelemetryConfig,
|
|
3120
|
+
ownedBy,
|
|
3121
|
+
owned,
|
|
3122
|
+
measuredSpan,
|
|
3123
|
+
makeOwnershipAccounting,
|
|
2505
3124
|
OtlpExporter_exports,
|
|
2506
3125
|
telemetryLayer,
|
|
2507
3126
|
captureTelemetry,
|
|
2508
3127
|
withRemoteSpan,
|
|
2509
3128
|
invocationFetch,
|
|
2510
3129
|
collectTelemetry,
|
|
2511
|
-
TraceContext,
|
|
2512
3130
|
externalTrace,
|
|
2513
3131
|
traceLinks,
|
|
2514
3132
|
pendingSpan
|