apps 0.0.1-beta.6 → 0.0.1-beta.60
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 +24 -21
- package/framework-reference.json +1 -1
- package/js/{chunk-ECQFRCH4.js → chunk-2ARGIHVD.js} +4 -3
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/{chunk-NKLWZJLE.js → chunk-AQU56EPI.js} +9 -5
- package/js/chunk-CDXQDN7W.js +92 -0
- package/js/{chunk-ITM77QPO.js → chunk-CWW7QWP4.js} +126 -31
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/chunk-ERJ5JGCB.js +266 -0
- package/js/{chunk-RJDDBDSN.js → chunk-FFSO3J76.js} +633 -89
- package/js/{chunk-27F7W2LG.js → chunk-H2CJWXA3.js} +2 -2
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-RFVIONFX.js → chunk-IJ6Y2KFQ.js} +79 -41
- package/js/{chunk-T7GKZBLP.js → chunk-JIU25DIL.js} +67 -55
- 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-MRV45IXB.js +340 -0
- package/js/chunk-MWKHKOTL.js +240 -0
- package/js/{chunk-SB4HEPNJ.js → chunk-MZNCLCGJ.js} +883 -189
- package/js/chunk-NS3DEHVA.js +49 -0
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/chunk-T53665H5.js +171 -0
- package/js/{chunk-B3EOZTK3.js → chunk-TLWLJ7PD.js} +2227 -453
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/{chunk-MNMNLXBL.js → chunk-ZYTA5MK4.js} +316 -69
- package/js/client.js +142 -94
- package/js/contracts.js +103 -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 +90 -61
- package/js/mcp/effect.js +23 -21
- package/js/mcp/stdio.js +44 -34
- package/js/mcp.js +76 -53
- package/js/openapi.js +4050 -1354
- 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 +8517 -214
- package/package.json +2 -3
- package/runtime.json +1 -1
- package/types/app-cache/src/index.d.ts +10 -1
- 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 +6 -6
- 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 +48 -13
- 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 +84 -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/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 +1200 -0
- 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 +2476 -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 +115 -10
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +58 -0
- package/types/apps/src/contracts/ui.d.ts +19 -1
- 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 +4 -0
- 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 +16 -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/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 +19 -5
- 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 +11 -5
- 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 +30 -12
- 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/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +7 -4
- 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 +1 -0
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/ownership.d.ts +56 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +11 -3
- 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-6BSSI67S.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-OE3QQTSB.js +0 -222
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- 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,150 @@ 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", "app"];
|
|
170
|
+
var makeOwnershipAccounting = (origin, owner) => {
|
|
171
|
+
const totals = { executor: 0, app: 0, upstream: 0, person: 0 };
|
|
172
|
+
const innermost = { executor: 0, app: 0, upstream: 0, person: 0 };
|
|
173
|
+
const boundaries2 = /* @__PURE__ */ new WeakMap();
|
|
174
|
+
let reached = origin;
|
|
175
|
+
let done = false;
|
|
176
|
+
const advance = (time) => {
|
|
177
|
+
if (time <= reached) return;
|
|
178
|
+
const current = concurrent.find((candidate) => innermost[candidate] > 0) ?? owner;
|
|
179
|
+
totals[current] += Number(time - reached) / 1e6;
|
|
180
|
+
reached = time;
|
|
181
|
+
};
|
|
182
|
+
const enclosing = (boundary) => {
|
|
183
|
+
let found = boundary.parent;
|
|
184
|
+
while (found !== void 0 && !found.open) found = found.parent;
|
|
185
|
+
boundary.parent = found;
|
|
186
|
+
return found;
|
|
187
|
+
};
|
|
188
|
+
const opened = (boundary) => {
|
|
189
|
+
const parent = enclosing(boundary);
|
|
190
|
+
if (parent !== void 0 && parent.children++ === 0) innermost[parent.owner] -= 1;
|
|
191
|
+
innermost[boundary.owner] += 1;
|
|
192
|
+
};
|
|
193
|
+
const closed = (boundary) => {
|
|
194
|
+
boundary.open = false;
|
|
195
|
+
if (boundary.children === 0) innermost[boundary.owner] -= 1;
|
|
196
|
+
const parent = enclosing(boundary);
|
|
197
|
+
if (parent === void 0) return;
|
|
198
|
+
parent.children += boundary.children - 1;
|
|
199
|
+
if (parent.children === 0) innermost[parent.owner] += 1;
|
|
200
|
+
};
|
|
201
|
+
const observed = (tracer) => ({
|
|
202
|
+
...tracer,
|
|
203
|
+
span: (options) => {
|
|
204
|
+
const span = tracer.span(options);
|
|
205
|
+
if (done) return span;
|
|
206
|
+
const parent = Option_exports.getOrUndefined(options.parent);
|
|
207
|
+
const enclosingBoundary = parent === void 0 ? void 0 : boundaries2.get(parent);
|
|
208
|
+
const boundary = {
|
|
209
|
+
owner: declaredOwner(options.annotations) ?? enclosingBoundary?.owner ?? owner,
|
|
210
|
+
parent: enclosingBoundary,
|
|
211
|
+
open: true,
|
|
212
|
+
children: 0
|
|
213
|
+
};
|
|
214
|
+
advance(options.startTime);
|
|
215
|
+
opened(boundary);
|
|
216
|
+
const tracked = {
|
|
217
|
+
_tag: "Span",
|
|
218
|
+
get name() {
|
|
219
|
+
return span.name;
|
|
220
|
+
},
|
|
221
|
+
get spanId() {
|
|
222
|
+
return span.spanId;
|
|
223
|
+
},
|
|
224
|
+
get traceId() {
|
|
225
|
+
return span.traceId;
|
|
226
|
+
},
|
|
227
|
+
get parent() {
|
|
228
|
+
return span.parent;
|
|
229
|
+
},
|
|
230
|
+
get annotations() {
|
|
231
|
+
return span.annotations;
|
|
232
|
+
},
|
|
233
|
+
get status() {
|
|
234
|
+
return span.status;
|
|
235
|
+
},
|
|
236
|
+
get attributes() {
|
|
237
|
+
return span.attributes;
|
|
238
|
+
},
|
|
239
|
+
get links() {
|
|
240
|
+
return span.links;
|
|
241
|
+
},
|
|
242
|
+
get sampled() {
|
|
243
|
+
return span.sampled;
|
|
244
|
+
},
|
|
245
|
+
get kind() {
|
|
246
|
+
return span.kind;
|
|
247
|
+
},
|
|
248
|
+
end: (endTime, exit) => {
|
|
249
|
+
if (boundary.open && !done) {
|
|
250
|
+
advance(endTime);
|
|
251
|
+
closed(boundary);
|
|
252
|
+
}
|
|
253
|
+
span.end(endTime, exit);
|
|
254
|
+
},
|
|
255
|
+
attribute: (key, value) => span.attribute(key, value),
|
|
256
|
+
event: (name, startTime, attributes2) => span.event(name, startTime, attributes2),
|
|
257
|
+
addLinks: (links) => span.addLinks(links)
|
|
258
|
+
};
|
|
259
|
+
boundaries2.set(tracked, boundary);
|
|
260
|
+
return tracked;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
/** Run `effect` with the spans it opens observed, including spans it hands to later work. */
|
|
265
|
+
observe: (effect2) => Effect_exports.gen(function* () {
|
|
266
|
+
const tracer = yield* Tracer_exports.Tracer;
|
|
267
|
+
return yield* effect2.pipe(Effect_exports.provideService(Tracer_exports.Tracer, observed(tracer)));
|
|
268
|
+
}),
|
|
269
|
+
/**
|
|
270
|
+
* Close the window at `end` and return its milliseconds by owner, each instant counted once.
|
|
271
|
+
* Spans still open count up to `end`; spans that open or end afterwards are ignored.
|
|
272
|
+
*/
|
|
273
|
+
read: (end) => {
|
|
274
|
+
if (!done) advance(end);
|
|
275
|
+
done = true;
|
|
276
|
+
return totals;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
|
|
133
281
|
// ../telemetry/src/context.ts
|
|
134
282
|
var captureTelemetry = Effect_exports.gen(function* () {
|
|
135
283
|
let context2 = Context_exports.make(Tracer_exports.Tracer, yield* Tracer_exports.Tracer).pipe(
|
|
@@ -161,9 +309,10 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
|
|
|
161
309
|
const request = yield* Effect_exports.try(() => new Request(input, init));
|
|
162
310
|
const client = yield* HttpClient_exports.HttpClient;
|
|
163
311
|
const response = yield* client.execute(HttpClientRequest_exports.fromWeb(request)).pipe(
|
|
164
|
-
Effect_exports.withSpan(
|
|
165
|
-
|
|
166
|
-
|
|
312
|
+
Effect_exports.withSpan(
|
|
313
|
+
"provider.http.request",
|
|
314
|
+
ownedBy("upstream", { attributes: { "http.request.method": request.method } })
|
|
315
|
+
),
|
|
167
316
|
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, {
|
|
168
317
|
cache: request.cache,
|
|
169
318
|
credentials: request.credentials,
|
|
@@ -192,9 +341,12 @@ var invocationFetch = (signal) => Effect_exports.gen(function* () {
|
|
|
192
341
|
streamed,
|
|
193
342
|
HttpBody_exports.stream(
|
|
194
343
|
body.stream.pipe(
|
|
195
|
-
Stream_exports.withSpan(
|
|
196
|
-
|
|
197
|
-
|
|
344
|
+
Stream_exports.withSpan(
|
|
345
|
+
"provider.http.response.read",
|
|
346
|
+
ownedBy("upstream", {
|
|
347
|
+
attributes: { "http.response.status_code": response.status }
|
|
348
|
+
})
|
|
349
|
+
)
|
|
198
350
|
),
|
|
199
351
|
body.contentType,
|
|
200
352
|
body.contentLength
|
|
@@ -487,15 +639,15 @@ function getTextEncoding() {
|
|
|
487
639
|
const te = new globalThis.TextEncoder();
|
|
488
640
|
const td = new globalThis.TextDecoder();
|
|
489
641
|
globalThis[symbol] = {
|
|
490
|
-
encodeUtf8(
|
|
491
|
-
return te.encode(
|
|
642
|
+
encodeUtf8(text2) {
|
|
643
|
+
return te.encode(text2);
|
|
492
644
|
},
|
|
493
645
|
decodeUtf8(bytes) {
|
|
494
646
|
return td.decode(bytes);
|
|
495
647
|
},
|
|
496
|
-
checkUtf8(
|
|
648
|
+
checkUtf8(text2) {
|
|
497
649
|
try {
|
|
498
|
-
encodeURIComponent(
|
|
650
|
+
encodeURIComponent(text2);
|
|
499
651
|
return true;
|
|
500
652
|
} catch (_) {
|
|
501
653
|
return false;
|
|
@@ -851,6 +1003,53 @@ var telemetryHttpClient = Layer_exports.effect(
|
|
|
851
1003
|
)
|
|
852
1004
|
)
|
|
853
1005
|
).pipe(Layer_exports.provide(selectedClient));
|
|
1006
|
+
var retryDelay = (error) => Effect_exports.gen(function* () {
|
|
1007
|
+
if (!HttpClientError_exports.isHttpClientError(error) || error.reason._tag !== "StatusCodeError" || error.reason.response.status !== 429 && error.reason.response.status !== 503)
|
|
1008
|
+
return Duration_exports.seconds(1);
|
|
1009
|
+
const header = error.reason.response.headers["retry-after"]?.trim();
|
|
1010
|
+
if (header === void 0 || header === "")
|
|
1011
|
+
return Duration_exports.seconds(error.reason.response.status === 429 ? 5 : 1);
|
|
1012
|
+
const seconds2 = Number(header);
|
|
1013
|
+
if (Number.isFinite(seconds2)) return Duration_exports.seconds(seconds2 >= 0 ? seconds2 : 5);
|
|
1014
|
+
const date = Date.parse(header);
|
|
1015
|
+
if (Number.isNaN(date)) return Duration_exports.seconds(5);
|
|
1016
|
+
return Duration_exports.millis(Math.max(date - (yield* Clock_exports.currentTimeMillis), 1));
|
|
1017
|
+
});
|
|
1018
|
+
var retryTelemetryExport = (client) => client.pipe(
|
|
1019
|
+
HttpClient_exports.retryTransient({
|
|
1020
|
+
times: 3,
|
|
1021
|
+
schedule: Schedule_exports.forever.pipe(
|
|
1022
|
+
Schedule_exports.passthrough,
|
|
1023
|
+
Schedule_exports.addDelay(({ output }) => retryDelay(output))
|
|
1024
|
+
)
|
|
1025
|
+
})
|
|
1026
|
+
);
|
|
1027
|
+
|
|
1028
|
+
// ../telemetry/src/recorded-failure.ts
|
|
1029
|
+
var tagOf = (error) => Predicate_exports.hasProperty(error, "_tag") && Predicate_exports.isString(error._tag) ? error._tag : void 0;
|
|
1030
|
+
var recorded = (name, message) => {
|
|
1031
|
+
const error = new Error(message);
|
|
1032
|
+
error.name = name;
|
|
1033
|
+
error.stack = message === "" ? name : `${name}: ${message}`;
|
|
1034
|
+
return error;
|
|
1035
|
+
};
|
|
1036
|
+
var recordedError = (error) => {
|
|
1037
|
+
const tag = tagOf(error);
|
|
1038
|
+
if (tag !== void 0) return recorded(tag, recordedMessage(error) ?? "");
|
|
1039
|
+
if (!(error instanceof Error)) return recorded("UnrecognizedFailure", "");
|
|
1040
|
+
if (error.cause === void 0) return error;
|
|
1041
|
+
const copy = new Error(error.message, { cause: recordedError(error.cause) });
|
|
1042
|
+
copy.name = error.name;
|
|
1043
|
+
if (error.stack !== void 0) copy.stack = error.stack;
|
|
1044
|
+
return copy;
|
|
1045
|
+
};
|
|
1046
|
+
var recordedCause = (cause) => Cause_exports.fromReasons(
|
|
1047
|
+
cause.reasons.flatMap((reason) => {
|
|
1048
|
+
if (Cause_exports.isInterruptReason(reason)) return [reason];
|
|
1049
|
+
const replaced = Cause_exports.isFailReason(reason) ? Cause_exports.fail(recordedError(reason.error)) : Cause_exports.die(recordedError(reason.defect));
|
|
1050
|
+
return Cause_exports.annotate(replaced, Cause_exports.reasonAnnotations(reason)).reasons;
|
|
1051
|
+
})
|
|
1052
|
+
);
|
|
854
1053
|
|
|
855
1054
|
// ../telemetry/src/span-attributes.ts
|
|
856
1055
|
var LogicalOperationFailed = class extends Schema_exports.TaggedError()(
|
|
@@ -878,7 +1077,7 @@ var spanAttributeAllowed = (key) => {
|
|
|
878
1077
|
const name = key.toLowerCase();
|
|
879
1078
|
return !httpNamespaces.some((namespace) => name.startsWith(namespace)) || httpSpanAttributeAllowlist.has(name);
|
|
880
1079
|
};
|
|
881
|
-
var allowedEntries = (
|
|
1080
|
+
var allowedEntries = (attributes2) => Object.fromEntries(Object.entries(attributes2).filter(([key]) => spanAttributeAllowed(key)));
|
|
882
1081
|
var allowlistedSpan = (span) => ({
|
|
883
1082
|
_tag: "Span",
|
|
884
1083
|
get name() {
|
|
@@ -913,14 +1112,15 @@ var allowlistedSpan = (span) => ({
|
|
|
913
1112
|
},
|
|
914
1113
|
// A successful transport can carry a failed domain operation. The producer
|
|
915
1114
|
// explicitly marks that outcome; arbitrary result payloads are never inspected.
|
|
1115
|
+
// A failure records the fixed message an error declares in place of an app's text.
|
|
916
1116
|
end: (endTime, exit) => span.end(
|
|
917
1117
|
endTime,
|
|
918
|
-
Exit_exports.isSuccess(exit)
|
|
1118
|
+
Exit_exports.isSuccess(exit) ? span.attributes.get("executor.outcome") === "failed" ? Exit_exports.fail(new LogicalOperationFailed()) : exit : Exit_exports.failCause(recordedCause(exit.cause))
|
|
919
1119
|
),
|
|
920
1120
|
attribute: (key, value) => {
|
|
921
1121
|
if (spanAttributeAllowed(key)) span.attribute(key, value);
|
|
922
1122
|
},
|
|
923
|
-
event: (name, startTime,
|
|
1123
|
+
event: (name, startTime, attributes2) => span.event(name, startTime, attributes2 === void 0 ? void 0 : allowedEntries(attributes2)),
|
|
924
1124
|
addLinks: (links) => span.addLinks(links)
|
|
925
1125
|
});
|
|
926
1126
|
var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_exports.Tracer)(
|
|
@@ -934,6 +1134,8 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
934
1134
|
if (recordAll && Option_exports.isSome(options.parent) && options.parent.value._tag === "ExternalSpan")
|
|
935
1135
|
span.attribute("executor.trace.parent_sampled", options.parent.value.sampled);
|
|
936
1136
|
if (clock !== void 0) span.attribute("executor.clock.type", clock);
|
|
1137
|
+
const owner = declaredOwner(options.annotations);
|
|
1138
|
+
if (owner !== void 0) span.attribute(ownerAttribute, owner);
|
|
937
1139
|
return span;
|
|
938
1140
|
}
|
|
939
1141
|
}))
|
|
@@ -941,7 +1143,7 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
941
1143
|
);
|
|
942
1144
|
var allowlistedSpans = spanAttributes();
|
|
943
1145
|
|
|
944
|
-
// ../../node_modules/.bun/effect@
|
|
1146
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
|
|
945
1147
|
var OtlpLogger_exports = {};
|
|
946
1148
|
__export(OtlpLogger_exports, {
|
|
947
1149
|
layer: () => layer2,
|
|
@@ -949,7 +1151,7 @@ __export(OtlpLogger_exports, {
|
|
|
949
1151
|
make: () => make6
|
|
950
1152
|
});
|
|
951
1153
|
|
|
952
|
-
// ../../node_modules/.bun/effect@
|
|
1154
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpEnv.js
|
|
953
1155
|
var exporterList = (path) => Array2(String2, path).pipe(map3((_) => _.map((_2) => _2.toLowerCase().trim()).filter((_2) => _2 !== "")));
|
|
954
1156
|
var headersRecord = (path) => Record(String2, StringFromUriComponent, path);
|
|
955
1157
|
var headers = (signal) => headersRecord(`OTEL_EXPORTER_OTLP_${signal}_HEADERS`).pipe(orElse(() => headersRecord("OTEL_EXPORTER_OTLP_HEADERS")), withDefault(void 0));
|
|
@@ -960,7 +1162,7 @@ var endpoint = (signal) => URL2(`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`).pipe(or
|
|
|
960
1162
|
}))), withDefault(void 0));
|
|
961
1163
|
var exporters = (signal) => exporterList(`OTEL_${signal}_EXPORTER`).pipe(withDefault([]));
|
|
962
1164
|
|
|
963
|
-
// ../../node_modules/.bun/effect@
|
|
1165
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpExporter.js
|
|
964
1166
|
var OtlpExporter_exports = {};
|
|
965
1167
|
__export(OtlpExporter_exports, {
|
|
966
1168
|
Flusher: () => Flusher,
|
|
@@ -1015,7 +1217,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1015
1217
|
const scope = get(services, Scope);
|
|
1016
1218
|
const exportInterval = max(fromInputUnsafe(options.exportInterval), zero);
|
|
1017
1219
|
let disabledUntil = void 0;
|
|
1018
|
-
const client =
|
|
1220
|
+
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
1221
|
schedule: policy,
|
|
1020
1222
|
times: 3
|
|
1021
1223
|
}));
|
|
@@ -1072,7 +1274,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1072
1274
|
};
|
|
1073
1275
|
});
|
|
1074
1276
|
|
|
1075
|
-
// ../../node_modules/.bun/effect@
|
|
1277
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpResource.js
|
|
1076
1278
|
var make5 = (options) => {
|
|
1077
1279
|
const resourceAttributes = options.attributes ? entriesToAttributes(Object.entries(options.attributes)) : [];
|
|
1078
1280
|
resourceAttributes.push({
|
|
@@ -1098,16 +1300,16 @@ var fromConfig = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1098
1300
|
const env = yield* Record(StringFromUriComponent, StringFromUriComponent, "OTEL_RESOURCE_ATTRIBUTES").pipe(withDefault(void 0));
|
|
1099
1301
|
const serviceName = options?.serviceName ?? options?.attributes?.["service.name"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_NAME")) ?? env?.["service.name"] ?? (yield* String3("OTEL_SERVICE_NAME"));
|
|
1100
1302
|
const serviceVersion = options?.serviceVersion ?? options?.attributes?.["service.version"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_VERSION")) ?? env?.["service.version"];
|
|
1101
|
-
const
|
|
1303
|
+
const attributes2 = {
|
|
1102
1304
|
...env,
|
|
1103
1305
|
...options?.attributes
|
|
1104
1306
|
};
|
|
1105
|
-
delete
|
|
1106
|
-
delete
|
|
1307
|
+
delete attributes2["service.name"];
|
|
1308
|
+
delete attributes2["service.version"];
|
|
1107
1309
|
return make5({
|
|
1108
1310
|
serviceName,
|
|
1109
1311
|
serviceVersion,
|
|
1110
|
-
attributes
|
|
1312
|
+
attributes: attributes2
|
|
1111
1313
|
});
|
|
1112
1314
|
}, orDie);
|
|
1113
1315
|
var serviceNameUnsafe = (resource) => {
|
|
@@ -1118,14 +1320,14 @@ var serviceNameUnsafe = (resource) => {
|
|
|
1118
1320
|
return serviceNameAttribute.value.stringValue;
|
|
1119
1321
|
};
|
|
1120
1322
|
var entriesToAttributes = (entries) => {
|
|
1121
|
-
const
|
|
1323
|
+
const attributes2 = [];
|
|
1122
1324
|
for (const [key, value] of entries) {
|
|
1123
|
-
|
|
1325
|
+
attributes2.push({
|
|
1124
1326
|
key,
|
|
1125
1327
|
value: unknownToAttributeValue(value)
|
|
1126
1328
|
});
|
|
1127
1329
|
}
|
|
1128
|
-
return
|
|
1330
|
+
return attributes2;
|
|
1129
1331
|
};
|
|
1130
1332
|
var unknownToAttributeValue = (value) => {
|
|
1131
1333
|
if (Array.isArray(value)) {
|
|
@@ -1161,7 +1363,7 @@ var unknownToAttributeValue = (value) => {
|
|
|
1161
1363
|
}
|
|
1162
1364
|
};
|
|
1163
1365
|
|
|
1164
|
-
// ../../node_modules/.bun/effect@
|
|
1366
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1165
1367
|
var OtlpSerialization_exports = {};
|
|
1166
1368
|
__export(OtlpSerialization_exports, {
|
|
1167
1369
|
OtlpSerialization: () => OtlpSerialization,
|
|
@@ -1169,7 +1371,7 @@ __export(OtlpSerialization_exports, {
|
|
|
1169
1371
|
layerProtobuf: () => layerProtobuf
|
|
1170
1372
|
});
|
|
1171
1373
|
|
|
1172
|
-
// ../../node_modules/.bun/effect@
|
|
1374
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/protobuf.js
|
|
1173
1375
|
var WireType2 = {
|
|
1174
1376
|
Varint: 0,
|
|
1175
1377
|
Fixed64: 1,
|
|
@@ -1238,7 +1440,7 @@ var messageField = (fieldNumber, message) => lengthDelimitedField(fieldNumber, m
|
|
|
1238
1440
|
var repeatedField = (fieldNumber, values, encode) => concat(...values.map((v) => messageField(fieldNumber, encode(v))));
|
|
1239
1441
|
var optionalStringField = (fieldNumber, value) => value !== void 0 && value !== "" ? stringField(fieldNumber, value) : new Uint8Array(0);
|
|
1240
1442
|
|
|
1241
|
-
// ../../node_modules/.bun/effect@
|
|
1443
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpProtobuf.js
|
|
1242
1444
|
var encodeAnyValue = (value) => {
|
|
1243
1445
|
if (value.stringValue !== void 0 && value.stringValue !== null) {
|
|
1244
1446
|
return stringField(1, value.stringValue);
|
|
@@ -1268,7 +1470,7 @@ var encodeKeyValueList = (value) => repeatedField(1, value.values, encodeKeyValu
|
|
|
1268
1470
|
var encodeKeyValue = (kv) => concat(stringField(1, kv.key), messageField(2, encodeAnyValue(kv.value)));
|
|
1269
1471
|
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
1472
|
var encodeResource = (resource) => concat(repeatedField(1, resource.attributes, encodeKeyValue), resource.droppedAttributesCount > 0 ? varintField(2, resource.droppedAttributesCount) : new Uint8Array(0));
|
|
1271
|
-
var encodeStatus = (
|
|
1473
|
+
var encodeStatus = (status2) => concat(optionalStringField(2, status2.message), varintField(3, status2.code));
|
|
1272
1474
|
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
1475
|
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
1476
|
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 +1479,7 @@ var encodeResourceSpans = (resourceSpans) => concat(messageField(1, encodeResour
|
|
|
1277
1479
|
var encodeTracesData = (tracesData) => repeatedField(1, tracesData.resourceSpans, encodeResourceSpans);
|
|
1278
1480
|
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
1481
|
var encodeHistogramDataPoint = (point) => {
|
|
1280
|
-
const bucketCountsEncoded = concat(...point.bucketCounts.map((
|
|
1482
|
+
const bucketCountsEncoded = concat(...point.bucketCounts.map((count2) => fixed64Field(6, BigInt(count2))));
|
|
1281
1483
|
const explicitBoundsEncoded = concat(...point.explicitBounds.map((bound) => doubleField(7, bound)));
|
|
1282
1484
|
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
1485
|
};
|
|
@@ -1293,7 +1495,7 @@ var encodeScopeLogs = (scopeLogs) => concat(messageField(1, encodeInstrumentatio
|
|
|
1293
1495
|
var encodeResourceLogs = (resourceLogs) => concat(messageField(1, encodeResource(resourceLogs.resource)), repeatedField(2, resourceLogs.scopeLogs, encodeScopeLogs), optionalStringField(3, resourceLogs.schemaUrl));
|
|
1294
1496
|
var encodeLogsData = (logsData) => repeatedField(1, logsData.resourceLogs, encodeResourceLogs);
|
|
1295
1497
|
|
|
1296
|
-
// ../../node_modules/.bun/effect@
|
|
1498
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1297
1499
|
var OtlpSerialization = class extends (/* @__PURE__ */ Service()("effect/observability/OtlpSerialization")) {
|
|
1298
1500
|
};
|
|
1299
1501
|
var layerJson = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
@@ -1307,7 +1509,7 @@ var layerProtobuf = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
|
1307
1509
|
logs: (logs) => uint8Array(encodeLogsData(logs), "application/x-protobuf")
|
|
1308
1510
|
});
|
|
1309
1511
|
|
|
1310
|
-
// ../../node_modules/.bun/effect@
|
|
1512
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
|
|
1311
1513
|
var make6 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
1312
1514
|
const serialization = yield* OtlpSerialization;
|
|
1313
1515
|
const otelResource = yield* fromConfig(options.resource);
|
|
@@ -1385,8 +1587,8 @@ var makeLogRecord = (options, opts) => {
|
|
|
1385
1587
|
const now = opts.clock.currentTimeNanosUnsafe();
|
|
1386
1588
|
const nanosString = now.toString();
|
|
1387
1589
|
const nowMillis = options.date.getTime();
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1590
|
+
const attributes2 = entriesToAttributes(Object.entries(options.fiber.getRef(CurrentLogAnnotations)));
|
|
1591
|
+
attributes2.push({
|
|
1390
1592
|
key: "fiberId",
|
|
1391
1593
|
value: {
|
|
1392
1594
|
intValue: options.fiber.id
|
|
@@ -1394,7 +1596,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1394
1596
|
});
|
|
1395
1597
|
if (!opts.excludeLogSpans) {
|
|
1396
1598
|
for (const [label, startTime] of options.fiber.getRef(CurrentLogSpans)) {
|
|
1397
|
-
|
|
1599
|
+
attributes2.push({
|
|
1398
1600
|
key: `logSpan.${label}`,
|
|
1399
1601
|
value: {
|
|
1400
1602
|
stringValue: `${nowMillis - startTime}ms`
|
|
@@ -1403,7 +1605,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1403
1605
|
}
|
|
1404
1606
|
}
|
|
1405
1607
|
if (options.cause.reasons.length > 0) {
|
|
1406
|
-
|
|
1608
|
+
attributes2.push({
|
|
1407
1609
|
key: "log.error",
|
|
1408
1610
|
value: {
|
|
1409
1611
|
stringValue: pretty(options.cause)
|
|
@@ -1416,7 +1618,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1416
1618
|
severityText: options.logLevel,
|
|
1417
1619
|
timeUnixNano: nanosString,
|
|
1418
1620
|
observedTimeUnixNano: nanosString,
|
|
1419
|
-
attributes,
|
|
1621
|
+
attributes: attributes2,
|
|
1420
1622
|
body: unknownToAttributeValue(message.length === 1 ? message[0] : message),
|
|
1421
1623
|
droppedAttributesCount: 0
|
|
1422
1624
|
};
|
|
@@ -1473,7 +1675,7 @@ var ESeverityNumber = {
|
|
|
1473
1675
|
SEVERITY_NUMBER_FATAL4: 24
|
|
1474
1676
|
};
|
|
1475
1677
|
|
|
1476
|
-
// ../../node_modules/.bun/effect@
|
|
1678
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpMetrics.js
|
|
1477
1679
|
var OtlpMetrics_exports = {};
|
|
1478
1680
|
__export(OtlpMetrics_exports, {
|
|
1479
1681
|
layer: () => layer3,
|
|
@@ -1519,7 +1721,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1519
1721
|
for (let i = 0, len = snapshot2.length; i < len; i++) {
|
|
1520
1722
|
const state = snapshot2[i];
|
|
1521
1723
|
const unit = state.attributes?.unit ?? state.attributes?.time_unit ?? "1";
|
|
1522
|
-
const
|
|
1724
|
+
const attributes2 = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
|
|
1523
1725
|
const metricKey = makeMetricKey(state.id, state.attributes);
|
|
1524
1726
|
switch (state.type) {
|
|
1525
1727
|
case "Counter": {
|
|
@@ -1545,7 +1747,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1545
1747
|
nextCounterState.set(metricKey, currentCount);
|
|
1546
1748
|
}
|
|
1547
1749
|
const dataPoint = {
|
|
1548
|
-
attributes,
|
|
1750
|
+
attributes: attributes2,
|
|
1549
1751
|
startTimeUnixNano: intervalStartTime,
|
|
1550
1752
|
timeUnixNano: nowTime
|
|
1551
1753
|
};
|
|
@@ -1572,7 +1774,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1572
1774
|
}
|
|
1573
1775
|
case "Gauge": {
|
|
1574
1776
|
const dataPoint = {
|
|
1575
|
-
attributes,
|
|
1777
|
+
attributes: attributes2,
|
|
1576
1778
|
startTimeUnixNano: startTime,
|
|
1577
1779
|
timeUnixNano: nowTime
|
|
1578
1780
|
};
|
|
@@ -1632,7 +1834,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1632
1834
|
});
|
|
1633
1835
|
}
|
|
1634
1836
|
const dataPoint = {
|
|
1635
|
-
attributes,
|
|
1837
|
+
attributes: attributes2,
|
|
1636
1838
|
startTimeUnixNano: intervalStartTime,
|
|
1637
1839
|
timeUnixNano: nowTime,
|
|
1638
1840
|
count: reportCount,
|
|
@@ -1671,7 +1873,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1671
1873
|
}
|
|
1672
1874
|
}
|
|
1673
1875
|
dataPoints.push({
|
|
1674
|
-
attributes: [...
|
|
1876
|
+
attributes: [...attributes2, {
|
|
1675
1877
|
key: "key",
|
|
1676
1878
|
value: {
|
|
1677
1879
|
stringValue: freqKey
|
|
@@ -1703,7 +1905,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1703
1905
|
}
|
|
1704
1906
|
case "Summary": {
|
|
1705
1907
|
const dataPoints = [{
|
|
1706
|
-
attributes: [...
|
|
1908
|
+
attributes: [...attributes2, {
|
|
1707
1909
|
key: "quantile",
|
|
1708
1910
|
value: {
|
|
1709
1911
|
stringValue: "min"
|
|
@@ -1715,7 +1917,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1715
1917
|
}];
|
|
1716
1918
|
for (const [quantile, value] of state.state.quantiles) {
|
|
1717
1919
|
dataPoints.push({
|
|
1718
|
-
attributes: [...
|
|
1920
|
+
attributes: [...attributes2, {
|
|
1719
1921
|
key: "quantile",
|
|
1720
1922
|
value: {
|
|
1721
1923
|
stringValue: quantile.toString()
|
|
@@ -1727,7 +1929,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1727
1929
|
});
|
|
1728
1930
|
}
|
|
1729
1931
|
dataPoints.push({
|
|
1730
|
-
attributes: [...
|
|
1932
|
+
attributes: [...attributes2, {
|
|
1731
1933
|
key: "quantile",
|
|
1732
1934
|
value: {
|
|
1733
1935
|
stringValue: "max"
|
|
@@ -1751,13 +1953,13 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1751
1953
|
});
|
|
1752
1954
|
}
|
|
1753
1955
|
const countDataPoint = {
|
|
1754
|
-
attributes,
|
|
1956
|
+
attributes: attributes2,
|
|
1755
1957
|
startTimeUnixNano: intervalStartTime,
|
|
1756
1958
|
timeUnixNano: nowTime,
|
|
1757
1959
|
asInt: reportCount
|
|
1758
1960
|
};
|
|
1759
1961
|
const sumDataPoint = {
|
|
1760
|
-
attributes,
|
|
1962
|
+
attributes: attributes2,
|
|
1761
1963
|
startTimeUnixNano: intervalStartTime,
|
|
1762
1964
|
timeUnixNano: nowTime,
|
|
1763
1965
|
asDouble: reportSum
|
|
@@ -1870,11 +2072,11 @@ var layerFromConfig2 = (options) => gen(function* () {
|
|
|
1870
2072
|
temporality: getOrUndefined(temporalityPreference)
|
|
1871
2073
|
});
|
|
1872
2074
|
}).pipe(orDie, unwrap);
|
|
1873
|
-
var makeMetricKey = (id,
|
|
1874
|
-
if (
|
|
2075
|
+
var makeMetricKey = (id, attributes2) => {
|
|
2076
|
+
if (attributes2 === void 0 || Object.keys(attributes2).length === 0) {
|
|
1875
2077
|
return id;
|
|
1876
2078
|
}
|
|
1877
|
-
const sortedEntries = Object.entries(
|
|
2079
|
+
const sortedEntries = Object.entries(attributes2).sort((a, b) => a[0].localeCompare(b[0]));
|
|
1878
2080
|
return `${id}:${JSON.stringify(sortedEntries)}`;
|
|
1879
2081
|
};
|
|
1880
2082
|
var EAggregationTemporality = {
|
|
@@ -1936,7 +2138,7 @@ var EAggregationTemporality = {
|
|
|
1936
2138
|
AGGREGATION_TEMPORALITY_CUMULATIVE: 2
|
|
1937
2139
|
};
|
|
1938
2140
|
|
|
1939
|
-
// ../../node_modules/.bun/effect@
|
|
2141
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpTracer.js
|
|
1940
2142
|
var OtlpTracer_exports = {};
|
|
1941
2143
|
__export(OtlpTracer_exports, {
|
|
1942
2144
|
layer: () => layer4,
|
|
@@ -2051,10 +2253,10 @@ var SpanImpl = class {
|
|
|
2051
2253
|
};
|
|
2052
2254
|
}
|
|
2053
2255
|
get traceId() {
|
|
2054
|
-
return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId :
|
|
2256
|
+
return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId : random(32);
|
|
2055
2257
|
}
|
|
2056
2258
|
get spanId() {
|
|
2057
|
-
return this._spanId ??=
|
|
2259
|
+
return this._spanId ??= random(16);
|
|
2058
2260
|
}
|
|
2059
2261
|
get attributes() {
|
|
2060
2262
|
return this._attributes ??= /* @__PURE__ */ new Map();
|
|
@@ -2074,39 +2276,39 @@ var SpanImpl = class {
|
|
|
2074
2276
|
attribute(key, value) {
|
|
2075
2277
|
this.attributes.set(key, value);
|
|
2076
2278
|
}
|
|
2077
|
-
event(name, startTime,
|
|
2078
|
-
this.events.push([name, startTime,
|
|
2279
|
+
event(name, startTime, attributes2) {
|
|
2280
|
+
this.events.push([name, startTime, attributes2]);
|
|
2079
2281
|
}
|
|
2080
2282
|
addLinks(links) {
|
|
2081
2283
|
this.links.push(...links);
|
|
2082
2284
|
}
|
|
2083
2285
|
};
|
|
2084
2286
|
var makeOtlpSpan = (self) => {
|
|
2085
|
-
const
|
|
2086
|
-
const
|
|
2287
|
+
const status2 = self.status;
|
|
2288
|
+
const attributes2 = self._attributes === void 0 ? [] : entriesToAttributes(self._attributes);
|
|
2087
2289
|
const events = [];
|
|
2088
2290
|
if (self._events !== void 0) {
|
|
2089
2291
|
for (let i = 0; i < self._events.length; i++) {
|
|
2090
|
-
const [name, startTime,
|
|
2292
|
+
const [name, startTime, attributes3] = self._events[i];
|
|
2091
2293
|
events.push({
|
|
2092
2294
|
name,
|
|
2093
2295
|
timeUnixNano: String(startTime),
|
|
2094
|
-
attributes:
|
|
2296
|
+
attributes: attributes3 ? entriesToAttributes(Object.entries(attributes3)) : [],
|
|
2095
2297
|
droppedAttributesCount: 0
|
|
2096
2298
|
});
|
|
2097
2299
|
}
|
|
2098
2300
|
}
|
|
2099
2301
|
let otelStatus;
|
|
2100
|
-
if (
|
|
2302
|
+
if (status2.exit._tag === "Success") {
|
|
2101
2303
|
otelStatus = {
|
|
2102
2304
|
code: StatusCode.Ok
|
|
2103
2305
|
};
|
|
2104
|
-
} else if (hasInterruptsOnly(
|
|
2306
|
+
} else if (hasInterruptsOnly(status2.exit.cause)) {
|
|
2105
2307
|
otelStatus = {
|
|
2106
2308
|
code: StatusCode.Ok,
|
|
2107
2309
|
message: "Interrupted"
|
|
2108
2310
|
};
|
|
2109
|
-
|
|
2311
|
+
attributes2.push({
|
|
2110
2312
|
key: "span.label",
|
|
2111
2313
|
value: {
|
|
2112
2314
|
stringValue: "\u26A0\uFE0E Interrupted"
|
|
@@ -2118,7 +2320,7 @@ var makeOtlpSpan = (self) => {
|
|
|
2118
2320
|
}
|
|
2119
2321
|
});
|
|
2120
2322
|
} else {
|
|
2121
|
-
const errors = prettyErrors(
|
|
2323
|
+
const errors = prettyErrors(status2.exit.cause, {
|
|
2122
2324
|
includeCauseInStack: true
|
|
2123
2325
|
});
|
|
2124
2326
|
otelStatus = {
|
|
@@ -2129,7 +2331,7 @@ var makeOtlpSpan = (self) => {
|
|
|
2129
2331
|
for (const error of errors) {
|
|
2130
2332
|
events.push({
|
|
2131
2333
|
name: "exception",
|
|
2132
|
-
timeUnixNano: String(
|
|
2334
|
+
timeUnixNano: String(status2.endTime),
|
|
2133
2335
|
droppedAttributesCount: 0,
|
|
2134
2336
|
attributes: [{
|
|
2135
2337
|
"key": "exception.type",
|
|
@@ -2167,9 +2369,9 @@ var makeOtlpSpan = (self) => {
|
|
|
2167
2369
|
parentSpanId: isSome(self.parent) ? self.parent.value.spanId : void 0,
|
|
2168
2370
|
name: self.name,
|
|
2169
2371
|
kind: SpanKind[self.kind],
|
|
2170
|
-
startTimeUnixNano: String(
|
|
2171
|
-
endTimeUnixNano: String(
|
|
2172
|
-
attributes,
|
|
2372
|
+
startTimeUnixNano: String(status2.startTime),
|
|
2373
|
+
endTimeUnixNano: String(status2.endTime),
|
|
2374
|
+
attributes: attributes2,
|
|
2173
2375
|
droppedAttributesCount: 0,
|
|
2174
2376
|
events,
|
|
2175
2377
|
droppedEventsCount: 0,
|
|
@@ -2245,6 +2447,341 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
|
|
|
2245
2447
|
);
|
|
2246
2448
|
};
|
|
2247
2449
|
|
|
2450
|
+
// ../telemetry/src/app-records.ts
|
|
2451
|
+
var appText = "Text from the app is not recorded";
|
|
2452
|
+
var unrecognized = "unrecognized";
|
|
2453
|
+
var operations = [
|
|
2454
|
+
"requirements",
|
|
2455
|
+
"inspect",
|
|
2456
|
+
"skills",
|
|
2457
|
+
"query",
|
|
2458
|
+
"mutate",
|
|
2459
|
+
"call",
|
|
2460
|
+
"account-check",
|
|
2461
|
+
"webhooks",
|
|
2462
|
+
"webhook-validate",
|
|
2463
|
+
"webhook-complete",
|
|
2464
|
+
"webhook-register",
|
|
2465
|
+
"webhook-unregister",
|
|
2466
|
+
"webhook-handle",
|
|
2467
|
+
"workflows",
|
|
2468
|
+
"workflow-validate",
|
|
2469
|
+
"workflow-run",
|
|
2470
|
+
"migrate"
|
|
2471
|
+
];
|
|
2472
|
+
var httpMethods = [
|
|
2473
|
+
"GET",
|
|
2474
|
+
"HEAD",
|
|
2475
|
+
"POST",
|
|
2476
|
+
"PUT",
|
|
2477
|
+
"PATCH",
|
|
2478
|
+
"DELETE",
|
|
2479
|
+
"OPTIONS",
|
|
2480
|
+
"TRACE",
|
|
2481
|
+
"CONNECT"
|
|
2482
|
+
];
|
|
2483
|
+
var appSpanNames = /* @__PURE__ */ new Set([
|
|
2484
|
+
"app.dispatch",
|
|
2485
|
+
...operations.map((operation) => `app.${operation}`),
|
|
2486
|
+
"app.evaluate",
|
|
2487
|
+
"app.accounts.bind",
|
|
2488
|
+
"app.account.check",
|
|
2489
|
+
"app.catalog.read",
|
|
2490
|
+
"app.skills.load",
|
|
2491
|
+
"app.skills.routers",
|
|
2492
|
+
"app.tool.resolve",
|
|
2493
|
+
"app.tool.approval",
|
|
2494
|
+
"app.tool.elicitation",
|
|
2495
|
+
"app.elicitation.wait",
|
|
2496
|
+
"app.workflow.control",
|
|
2497
|
+
"app.operation.execute",
|
|
2498
|
+
"app.sql.migrate",
|
|
2499
|
+
"app.code",
|
|
2500
|
+
"app.cache.call",
|
|
2501
|
+
"app.cache.get",
|
|
2502
|
+
"app.cache.load",
|
|
2503
|
+
"app.cache.command",
|
|
2504
|
+
"app.cache.publish",
|
|
2505
|
+
"app.cache.flush",
|
|
2506
|
+
"app.cache.lease.renew",
|
|
2507
|
+
"provider.http.request",
|
|
2508
|
+
"provider.http.response.read",
|
|
2509
|
+
"provider.openapi.call",
|
|
2510
|
+
"provider.graphql.request",
|
|
2511
|
+
"provider.graphql.call",
|
|
2512
|
+
"provider.mcp.session",
|
|
2513
|
+
"provider.mcp.connect",
|
|
2514
|
+
"provider.mcp.close",
|
|
2515
|
+
"provider.mcp.request",
|
|
2516
|
+
"provider.mcp.call",
|
|
2517
|
+
"provider.mcp.discover",
|
|
2518
|
+
"provider.mcp.check",
|
|
2519
|
+
"provider.mcp.health",
|
|
2520
|
+
"provider.mcp.anonymous",
|
|
2521
|
+
"provider.mcp.elicitation",
|
|
2522
|
+
"sql.execute",
|
|
2523
|
+
...httpMethods.map((method) => `http.client ${method}`)
|
|
2524
|
+
]);
|
|
2525
|
+
var errorKinds = /* @__PURE__ */ new Set([
|
|
2526
|
+
"HostRequestInvalid",
|
|
2527
|
+
"HostAccountsInvalid",
|
|
2528
|
+
"HostDeclarationInvalid",
|
|
2529
|
+
"HostEvaluationFailed",
|
|
2530
|
+
"HostOperationNotFound",
|
|
2531
|
+
"HostOperationFailed",
|
|
2532
|
+
"HostKindMismatch",
|
|
2533
|
+
"HostToolNotFound",
|
|
2534
|
+
"HostInputInvalid",
|
|
2535
|
+
"HostOutputInvalid",
|
|
2536
|
+
"HostToolBlocked",
|
|
2537
|
+
"HostToolApprovalRequired",
|
|
2538
|
+
"HostToolPolicyFailed",
|
|
2539
|
+
"ElicitationFailed",
|
|
2540
|
+
"DatabaseLimitExceeded",
|
|
2541
|
+
"DatabaseFieldReserved",
|
|
2542
|
+
"SkillLoadFailed",
|
|
2543
|
+
"WorkflowFailure",
|
|
2544
|
+
"ProviderError",
|
|
2545
|
+
"OpenapiResponseError",
|
|
2546
|
+
"OpenapiError",
|
|
2547
|
+
"OpenapiCompileError",
|
|
2548
|
+
"GraphqlError",
|
|
2549
|
+
"McpError",
|
|
2550
|
+
"McpToolError",
|
|
2551
|
+
"McpCredentialsUnverified",
|
|
2552
|
+
"CacheError",
|
|
2553
|
+
"AppDatabaseError",
|
|
2554
|
+
"AppStorageError",
|
|
2555
|
+
"AppStorageUnavailable",
|
|
2556
|
+
"NetworkRefused",
|
|
2557
|
+
"FetchOptionUnsupported",
|
|
2558
|
+
"LogicalOperationFailed",
|
|
2559
|
+
"HttpClientError",
|
|
2560
|
+
"SchemaError",
|
|
2561
|
+
"TimeoutError",
|
|
2562
|
+
"UnknownError",
|
|
2563
|
+
"InterruptError",
|
|
2564
|
+
"Error",
|
|
2565
|
+
"TypeError",
|
|
2566
|
+
"RangeError",
|
|
2567
|
+
"ReferenceError",
|
|
2568
|
+
"SyntaxError",
|
|
2569
|
+
"EvalError",
|
|
2570
|
+
"URIError",
|
|
2571
|
+
"AggregateError",
|
|
2572
|
+
"AbortError",
|
|
2573
|
+
"string",
|
|
2574
|
+
"number",
|
|
2575
|
+
"bigint",
|
|
2576
|
+
"boolean",
|
|
2577
|
+
"symbol",
|
|
2578
|
+
"undefined",
|
|
2579
|
+
"object",
|
|
2580
|
+
"function"
|
|
2581
|
+
]);
|
|
2582
|
+
var failureCodes = /* @__PURE__ */ new Set([
|
|
2583
|
+
// CacheError
|
|
2584
|
+
"unavailable",
|
|
2585
|
+
"storage",
|
|
2586
|
+
"invalid",
|
|
2587
|
+
"capacity",
|
|
2588
|
+
"timeout",
|
|
2589
|
+
// AppDatabaseError
|
|
2590
|
+
"schema",
|
|
2591
|
+
"schema_changed",
|
|
2592
|
+
"table",
|
|
2593
|
+
"index",
|
|
2594
|
+
"range",
|
|
2595
|
+
"value",
|
|
2596
|
+
"readonly",
|
|
2597
|
+
"cursor",
|
|
2598
|
+
"limit",
|
|
2599
|
+
"closed",
|
|
2600
|
+
"replay",
|
|
2601
|
+
// OpenapiError
|
|
2602
|
+
"invalid_definition",
|
|
2603
|
+
"invalid_input",
|
|
2604
|
+
"request",
|
|
2605
|
+
// McpError, McpCredentialsUnverified and ProviderError
|
|
2606
|
+
"unauthorized",
|
|
2607
|
+
"invalid_response",
|
|
2608
|
+
"forbidden",
|
|
2609
|
+
"rate_limited",
|
|
2610
|
+
"rejected",
|
|
2611
|
+
"anonymous_access",
|
|
2612
|
+
// NetworkRefused and FetchOptionUnsupported
|
|
2613
|
+
"private_address",
|
|
2614
|
+
"credential_host",
|
|
2615
|
+
"credential_app",
|
|
2616
|
+
"credential_expired",
|
|
2617
|
+
"redirect",
|
|
2618
|
+
"cache",
|
|
2619
|
+
"integrity"
|
|
2620
|
+
]);
|
|
2621
|
+
var text = (value) => typeof value["stringValue"] === "string" ? value["stringValue"] : void 0;
|
|
2622
|
+
var integer = (value) => {
|
|
2623
|
+
const raw = value["intValue"];
|
|
2624
|
+
const number = typeof raw === "string" && /^-?\d{1,15}$/.test(raw) ? Number(raw) : raw;
|
|
2625
|
+
return typeof number === "number" && Number.isSafeInteger(number) ? number : void 0;
|
|
2626
|
+
};
|
|
2627
|
+
var oneOf = (...values) => (value) => {
|
|
2628
|
+
const found = text(value);
|
|
2629
|
+
return found !== void 0 && values.includes(found) ? { stringValue: found } : void 0;
|
|
2630
|
+
};
|
|
2631
|
+
var classified = (known) => (value) => {
|
|
2632
|
+
const found = text(value);
|
|
2633
|
+
return found === void 0 ? void 0 : { stringValue: known.has(found) ? found : unrecognized };
|
|
2634
|
+
};
|
|
2635
|
+
var flag = (value) => typeof value["boolValue"] === "boolean" ? { boolValue: value["boolValue"] } : void 0;
|
|
2636
|
+
var count = (value) => {
|
|
2637
|
+
const found = integer(value);
|
|
2638
|
+
return found !== void 0 && found >= 0 ? { intValue: found } : void 0;
|
|
2639
|
+
};
|
|
2640
|
+
var status = (value) => {
|
|
2641
|
+
const found = integer(value);
|
|
2642
|
+
return found !== void 0 && found >= 100 && found <= 599 ? { intValue: found } : void 0;
|
|
2643
|
+
};
|
|
2644
|
+
var duration = (value) => {
|
|
2645
|
+
const found = typeof value["doubleValue"] === "number" ? value["doubleValue"] : integer(value);
|
|
2646
|
+
return found !== void 0 && Number.isFinite(found) && found >= 0 ? { doubleValue: found } : void 0;
|
|
2647
|
+
};
|
|
2648
|
+
var spanAttributes2 = {
|
|
2649
|
+
"executor.operation": oneOf(...operations, "mutation", "discover"),
|
|
2650
|
+
"executor.outcome": oneOf("failed"),
|
|
2651
|
+
"executor.clock.type": oneOf("system", "cloudflare-io"),
|
|
2652
|
+
"executor.trace.parent_sampled": flag,
|
|
2653
|
+
"executor.failure.source": oneOf("app", "storage", "service"),
|
|
2654
|
+
"executor.failure.code": classified(failureCodes),
|
|
2655
|
+
"error.type": classified(errorKinds),
|
|
2656
|
+
"cache.operation": oneOf(
|
|
2657
|
+
"read",
|
|
2658
|
+
"acquire",
|
|
2659
|
+
"claim",
|
|
2660
|
+
"publish",
|
|
2661
|
+
"release",
|
|
2662
|
+
"renew",
|
|
2663
|
+
"write",
|
|
2664
|
+
"invalidate"
|
|
2665
|
+
),
|
|
2666
|
+
"cache.result": oneOf("fresh", "stale", "miss", "local"),
|
|
2667
|
+
"cache.load.leased": flag,
|
|
2668
|
+
"cache.flush.index": count,
|
|
2669
|
+
"cache.flush.count": count,
|
|
2670
|
+
"cache.flush.entries": count,
|
|
2671
|
+
"cache.flush.bytes": count,
|
|
2672
|
+
"cache.leases": count,
|
|
2673
|
+
"mcp.transport": oneOf("http", "sse", "stdio"),
|
|
2674
|
+
"mcp.operation": oneOf("discover", "call", "check", "health"),
|
|
2675
|
+
"mcp.tool.is_error": flag,
|
|
2676
|
+
"rpc.system.name": oneOf("jsonrpc"),
|
|
2677
|
+
"rpc.method": oneOf("initialize", "tools/list", "tools/call", "ping"),
|
|
2678
|
+
"graphql.operation.type": oneOf("query", "mutation", "subscription"),
|
|
2679
|
+
"db.system.name": oneOf("sqlite"),
|
|
2680
|
+
"db.operation.name": oneOf("execute"),
|
|
2681
|
+
"http.request.method": oneOf(...httpMethods),
|
|
2682
|
+
"http.response.status_code": status,
|
|
2683
|
+
"url.scheme": oneOf("http", "https"),
|
|
2684
|
+
"span.label": oneOf("\u26A0\uFE0E Interrupted"),
|
|
2685
|
+
"status.interrupted": flag,
|
|
2686
|
+
"executor.milestone.reached": flag,
|
|
2687
|
+
"executor.owner": oneOf("executor", "app", "upstream", "person"),
|
|
2688
|
+
"executor.app.code": oneOf(
|
|
2689
|
+
"factory",
|
|
2690
|
+
"router",
|
|
2691
|
+
"approval",
|
|
2692
|
+
"handler",
|
|
2693
|
+
"loader",
|
|
2694
|
+
"cache",
|
|
2695
|
+
"webhook",
|
|
2696
|
+
"check",
|
|
2697
|
+
"skills",
|
|
2698
|
+
"elicitation",
|
|
2699
|
+
"workflow",
|
|
2700
|
+
"step"
|
|
2701
|
+
),
|
|
2702
|
+
"executor.workflow.operation": oneOf("start", "get", "list", "terminate"),
|
|
2703
|
+
"cache.method": oneOf("get", "revalidate", "read", "readMany", "write", "invalidate"),
|
|
2704
|
+
"executor.upstream.wait_ms": duration,
|
|
2705
|
+
"executor.elicitation.wait_ms": duration,
|
|
2706
|
+
"executor.authored_ms": duration,
|
|
2707
|
+
"executor.overhead_ms": duration
|
|
2708
|
+
};
|
|
2709
|
+
var appSpanAttributeKeys = new Set(Object.keys(spanAttributes2));
|
|
2710
|
+
var logMessages = /* @__PURE__ */ new Set([
|
|
2711
|
+
"The app's request failed unexpectedly",
|
|
2712
|
+
"App cache refresh failed",
|
|
2713
|
+
"MCP catalog invalidation failed",
|
|
2714
|
+
"Telemetry export failed"
|
|
2715
|
+
]);
|
|
2716
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2717
|
+
var spanId = (value) => typeof value === "string" && /^[a-f0-9]{16}$/.test(value) ? value : void 0;
|
|
2718
|
+
var nanos = (value) => typeof value === "string" && /^\d{1,20}$/.test(value) ? value : void 0;
|
|
2719
|
+
var between = (value, minimum, maximum) => typeof value === "number" && Number.isInteger(value) && value >= minimum && value <= maximum ? value : void 0;
|
|
2720
|
+
var attributes = (from) => (Array.isArray(from) ? from : []).flatMap((attribute) => {
|
|
2721
|
+
if (!isObject(attribute) || typeof attribute["key"] !== "string") return [];
|
|
2722
|
+
const key = attribute["key"];
|
|
2723
|
+
const keep = Object.hasOwn(spanAttributes2, key) ? spanAttributes2[key] : void 0;
|
|
2724
|
+
const value = attribute["value"];
|
|
2725
|
+
const kept = keep === void 0 || !isObject(value) ? void 0 : keep(value);
|
|
2726
|
+
return kept === void 0 ? [] : [{ key, value: kept }];
|
|
2727
|
+
});
|
|
2728
|
+
var exception = (event) => {
|
|
2729
|
+
const named = (Array.isArray(event["attributes"]) ? event["attributes"] : []).find(
|
|
2730
|
+
(attribute) => isObject(attribute) && attribute["key"] === "exception.type"
|
|
2731
|
+
);
|
|
2732
|
+
const type = isObject(named) && isObject(named["value"]) ? text(named["value"]) : void 0;
|
|
2733
|
+
const recorded2 = type !== void 0 && errorKinds.has(type) ? type : unrecognized;
|
|
2734
|
+
const time = nanos(event["timeUnixNano"]);
|
|
2735
|
+
return {
|
|
2736
|
+
name: "exception",
|
|
2737
|
+
...time === void 0 ? {} : { timeUnixNano: time },
|
|
2738
|
+
attributes: [
|
|
2739
|
+
{ key: "exception.type", value: { stringValue: recorded2 } },
|
|
2740
|
+
{ key: "exception.message", value: { stringValue: appText } },
|
|
2741
|
+
{ key: "exception.stacktrace", value: { stringValue: `${recorded2}: ${appText}` } }
|
|
2742
|
+
]
|
|
2743
|
+
};
|
|
2744
|
+
};
|
|
2745
|
+
var appSpan = (span) => {
|
|
2746
|
+
const start = nanos(span["startTimeUnixNano"]);
|
|
2747
|
+
const end = nanos(span["endTimeUnixNano"]);
|
|
2748
|
+
if (start === void 0 || end === void 0) return void 0;
|
|
2749
|
+
const parent = spanId(span["parentSpanId"]);
|
|
2750
|
+
const kind = between(span["kind"], 0, 5);
|
|
2751
|
+
const code = isObject(span["status"]) ? between(span["status"]["code"], 0, 2) : void 0;
|
|
2752
|
+
const name = typeof span["name"] === "string" && appSpanNames.has(span["name"]) ? span["name"] : "app.unrecognized";
|
|
2753
|
+
return {
|
|
2754
|
+
traceId: span.traceId,
|
|
2755
|
+
spanId: span.spanId,
|
|
2756
|
+
...parent === void 0 ? {} : { parentSpanId: parent },
|
|
2757
|
+
name,
|
|
2758
|
+
...kind === void 0 ? {} : { kind },
|
|
2759
|
+
startTimeUnixNano: start,
|
|
2760
|
+
endTimeUnixNano: end,
|
|
2761
|
+
attributes: attributes(span["attributes"]),
|
|
2762
|
+
events: (Array.isArray(span["events"]) ? span["events"] : []).flatMap(
|
|
2763
|
+
(event) => isObject(event) && event["name"] === "exception" ? [exception(event)] : []
|
|
2764
|
+
),
|
|
2765
|
+
...code === void 0 ? {} : { status: { code } }
|
|
2766
|
+
};
|
|
2767
|
+
};
|
|
2768
|
+
var appLog = (log) => {
|
|
2769
|
+
const time = nanos(log["timeUnixNano"]);
|
|
2770
|
+
const observed = nanos(log["observedTimeUnixNano"]);
|
|
2771
|
+
const severity = between(log["severityNumber"], 1, 24);
|
|
2772
|
+
const level = log["severityText"];
|
|
2773
|
+
const body = isObject(log["body"]) ? text(log["body"]) : void 0;
|
|
2774
|
+
return {
|
|
2775
|
+
...log.traceId === void 0 ? {} : { traceId: log.traceId },
|
|
2776
|
+
...log.spanId === void 0 ? {} : { spanId: log.spanId },
|
|
2777
|
+
...time === void 0 ? {} : { timeUnixNano: time },
|
|
2778
|
+
...observed === void 0 ? {} : { observedTimeUnixNano: observed },
|
|
2779
|
+
...severity === void 0 ? {} : { severityNumber: severity },
|
|
2780
|
+
...typeof level === "string" && ["Trace", "Debug", "Info", "Warn", "Error", "Fatal"].includes(level) ? { severityText: level } : {},
|
|
2781
|
+
body: { stringValue: body !== void 0 && logMessages.has(body) ? body : appText }
|
|
2782
|
+
};
|
|
2783
|
+
};
|
|
2784
|
+
|
|
2248
2785
|
// ../telemetry/src/relay.ts
|
|
2249
2786
|
var makeTelemetryForwarder = Effect_exports.gen(function* () {
|
|
2250
2787
|
const fibers = yield* FiberSet_exports.make();
|
|
@@ -2257,10 +2794,10 @@ var makeTelemetryForwarder = Effect_exports.gen(function* () {
|
|
|
2257
2794
|
Effect_exports.flatMap((drained) => Option_exports.isNone(drained) ? failed("shutdown") : Effect_exports.void)
|
|
2258
2795
|
)
|
|
2259
2796
|
);
|
|
2260
|
-
return (batch, traceId,
|
|
2797
|
+
return (batch, traceId, source) => FiberSet_exports.run(
|
|
2261
2798
|
fibers,
|
|
2262
2799
|
sender.withPermits(1)(
|
|
2263
|
-
forwardTelemetry(batch, traceId,
|
|
2800
|
+
forwardTelemetry(batch, traceId, source).pipe(Effect_exports.catch(() => failed("relay")))
|
|
2264
2801
|
).pipe(
|
|
2265
2802
|
pending.withPermitsIfAvailable(1),
|
|
2266
2803
|
Effect_exports.flatMap(
|
|
@@ -2360,8 +2897,8 @@ var recordPacker = (prefix, suffix) => {
|
|
|
2360
2897
|
}
|
|
2361
2898
|
};
|
|
2362
2899
|
};
|
|
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}$/));
|
|
2900
|
+
var HexTrace = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{32}$/u));
|
|
2901
|
+
var HexSpan = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{16}$/u));
|
|
2365
2902
|
var Span = Schema_exports.StructWithRest(Schema_exports.Struct({ traceId: HexTrace, spanId: HexSpan }), [
|
|
2366
2903
|
Schema_exports.Record(Schema_exports.String, Schema_exports.Json)
|
|
2367
2904
|
]);
|
|
@@ -2391,7 +2928,7 @@ var LogPayload = Schema_exports.fromJsonString(
|
|
|
2391
2928
|
)
|
|
2392
2929
|
})
|
|
2393
2930
|
);
|
|
2394
|
-
var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effect_exports.gen(function* () {
|
|
2931
|
+
var forwardTelemetry = (batch, traceId, { build, app }, service = "executor-app") => Effect_exports.gen(function* () {
|
|
2395
2932
|
const config = yield* CurrentTelemetryConfig;
|
|
2396
2933
|
if (config === void 0) return;
|
|
2397
2934
|
const resource = {
|
|
@@ -2399,10 +2936,11 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
|
|
|
2399
2936
|
{ key: "service.name", value: { stringValue: service } },
|
|
2400
2937
|
{ key: "service.version", value: { stringValue: config.version } },
|
|
2401
2938
|
{ key: "deployment.environment.name", value: { stringValue: config.environment } },
|
|
2402
|
-
...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }]
|
|
2939
|
+
...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }],
|
|
2940
|
+
...app === void 0 ? [] : [{ key: "executor.app.id", value: { stringValue: app } }]
|
|
2403
2941
|
]
|
|
2404
2942
|
};
|
|
2405
|
-
const client = yield* HttpClient_exports.HttpClient;
|
|
2943
|
+
const client = retryTelemetryExport(yield* HttpClient_exports.HttpClient);
|
|
2406
2944
|
if (batch.dropped > 0) yield* recordExportFailure("app", "capacity", batch.dropped);
|
|
2407
2945
|
for (const signal of ["traces", "logs"]) {
|
|
2408
2946
|
const target = config[signal];
|
|
@@ -2418,7 +2956,11 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
|
|
|
2418
2956
|
scopeSpans: [
|
|
2419
2957
|
{
|
|
2420
2958
|
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)
|
|
2959
|
+
spans: payloads.flatMap((payload) => payload.resourceSpans).flatMap((r) => r.scopeSpans.flatMap((s) => s.spans)).filter((span) => traceId === void 0 || span.traceId === traceId).flatMap((span) => {
|
|
2960
|
+
if (service !== "executor-app") return [span];
|
|
2961
|
+
const kept = appSpan(span);
|
|
2962
|
+
return kept === void 0 ? [] : [kept];
|
|
2963
|
+
})
|
|
2422
2964
|
}
|
|
2423
2965
|
]
|
|
2424
2966
|
}
|
|
@@ -2435,14 +2977,14 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
|
|
|
2435
2977
|
scopeLogs: [
|
|
2436
2978
|
{
|
|
2437
2979
|
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)
|
|
2980
|
+
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
2981
|
}
|
|
2440
2982
|
]
|
|
2441
2983
|
}
|
|
2442
2984
|
]
|
|
2443
2985
|
}))
|
|
2444
2986
|
);
|
|
2445
|
-
yield* client.
|
|
2987
|
+
yield* client.execute(
|
|
2446
2988
|
HttpClientRequest_exports.post(target.url).pipe(
|
|
2447
2989
|
HttpClientRequest_exports.setHeaders(
|
|
2448
2990
|
target.headers === void 0 ? {} : Redacted_exports.value(target.headers)
|
|
@@ -2459,8 +3001,8 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
|
|
|
2459
3001
|
|
|
2460
3002
|
// ../telemetry/src/trace-context.ts
|
|
2461
3003
|
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}$/)),
|
|
3004
|
+
traceId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/u)),
|
|
3005
|
+
spanId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/u)),
|
|
2464
3006
|
sampled: Schema_exports.Boolean
|
|
2465
3007
|
});
|
|
2466
3008
|
var currentTraceContext = Effect_exports.currentSpan.pipe(
|
|
@@ -2502,13 +3044,15 @@ var pendingSpan = (name, options) => Effect_exports.gen(function* () {
|
|
|
2502
3044
|
|
|
2503
3045
|
export {
|
|
2504
3046
|
CurrentTelemetryConfig,
|
|
3047
|
+
owned,
|
|
3048
|
+
measuredSpan,
|
|
3049
|
+
makeOwnershipAccounting,
|
|
2505
3050
|
OtlpExporter_exports,
|
|
2506
3051
|
telemetryLayer,
|
|
2507
3052
|
captureTelemetry,
|
|
2508
3053
|
withRemoteSpan,
|
|
2509
3054
|
invocationFetch,
|
|
2510
3055
|
collectTelemetry,
|
|
2511
|
-
TraceContext,
|
|
2512
3056
|
externalTrace,
|
|
2513
3057
|
traceLinks,
|
|
2514
3058
|
pendingSpan
|