apps 0.0.1-beta.12 → 0.0.1-beta.121
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 +60 -42
- package/framework-reference.json +1 -1
- package/js/{chunk-ODEIDRGW.js → chunk-2EEUUSL7.js} +807 -179
- package/js/chunk-3KNB4HRA.js +95 -0
- package/js/chunk-3OADIFKV.js +576 -0
- package/js/chunk-573E3S2U.js +5339 -0
- package/js/{chunk-RFVIONFX.js → chunk-5IWCEMLY.js} +136 -45
- package/js/{chunk-UK573G7W.js → chunk-5TYZML5C.js} +87 -51
- package/js/chunk-AUZGGAPP.js +449 -0
- package/js/chunk-C23S3WPT.js +175 -0
- package/js/chunk-CCJUTN55.js +88 -0
- package/js/chunk-CL3K7BJD.js +49 -0
- package/js/{chunk-5T57N25Q.js → chunk-DA6RXOMJ.js} +643 -69
- package/js/chunk-DONRL25A.js +713 -0
- package/js/{chunk-57RKNWL2.js → chunk-EAPSQBFN.js} +4 -4
- package/js/{chunk-JU7VHODU.js → chunk-EPZ3P7IX.js} +65 -10
- package/js/{chunk-YQNLXHHM.js → chunk-GU25DFBC.js} +931 -289
- package/js/{chunk-VFZKSM3T.js → chunk-KJW5IPM4.js} +3 -3
- package/js/chunk-KY4KYPUZ.js +335 -0
- package/js/{chunk-KUMBKVJD.js → chunk-MJUHAHDG.js} +2 -2
- package/js/chunk-NCOPALJZ.js +90 -0
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/chunk-OLUDW4HL.js +1016 -0
- package/js/{chunk-M3B3DE4K.js → chunk-QUFLMMTG.js} +463 -218
- package/js/{chunk-IPI4MFSN.js → chunk-SO33LZ7J.js} +2 -2
- package/js/{chunk-CDL5PM2Q.js → chunk-U2GHFWX2.js} +19257 -18404
- package/js/{chunk-WVVV4TX2.js → chunk-UPICNVJO.js} +4 -3
- package/js/{chunk-IJX4CYZO.js → chunk-VXBCDIWD.js} +228 -264
- package/js/client.js +148 -84
- package/js/contracts.js +152 -21
- package/js/effect.js +18 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +231 -188
- package/js/host.js +116 -78
- package/js/index.js +150 -300
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +91 -57
- package/js/openapi.js +4357 -1415
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +220 -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 +9 -8
- package/js/ui/serving.js +8618 -235
- package/package.json +3 -8
- 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 +56 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +40 -2
- package/types/apps/src/contracts/host.d.ts +1457 -20
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- 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-document.d.ts +1 -1
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +14 -7
- 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/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/13.d.ts +6001 -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 +6870 -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 +82 -5
- package/types/apps/src/contracts/router.d.ts +2 -1
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
- 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 +70 -30
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +56 -34
- 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 +20 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- 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 +29 -2
- 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 +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- 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-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 +38 -7
- package/types/apps/src/implementation/openapi-document.d.ts +50 -20
- 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 +23 -1
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +58 -7
- 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 +19 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +19 -94
- package/types/apps/src/implementation/router.d.ts +26 -6
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +108 -11
- 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 +3 -3
- 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 +38 -12
- package/types/apps/src/implementation/upstream-error.d.ts +17 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +51 -16
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +22 -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 -2
- 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/legacy-keys.d.ts +20 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/schema-definitions.d.ts +13 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-27F7W2LG.js +0 -34
- package/js/chunk-GPFVWWDZ.js +0 -209
- package/js/chunk-KRSCJDTW.js +0 -2668
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-S6YVNPFS.js +0 -224
- package/js/chunk-TYVDBQSI.js +0 -242
- package/js/chunk-Y32GRPVD.js +0 -299
- package/js/chunk-Z2QY3YTF.js +0 -507
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- 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/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/implementation/ui-watch.d.ts +0 -2
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FetchHttpClient_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EAPSQBFN.js";
|
|
4
|
+
import {
|
|
5
|
+
recordedMessage
|
|
6
|
+
} from "./chunk-CCJUTN55.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-5TYZML5C.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-U2GHFWX2.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,64 +1086,89 @@ 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",
|
|
872
1096
|
"http.response.header.content-type",
|
|
873
1097
|
"http.response.header.content-length",
|
|
874
1098
|
// The server tracer records the user agent a second time under its own name.
|
|
875
|
-
"user_agent.original"
|
|
1099
|
+
"user_agent.original",
|
|
1100
|
+
// The server tracer's remote address: the peer the host saw, or on Cloud the address
|
|
1101
|
+
// Cloudflare saw (`cf-connecting-ip`, which Cloudflare overwrites on every incoming request).
|
|
1102
|
+
"client.address"
|
|
876
1103
|
]);
|
|
877
1104
|
var spanAttributeAllowed = (key) => {
|
|
878
1105
|
const name = key.toLowerCase();
|
|
879
1106
|
return !httpNamespaces.some((namespace) => name.startsWith(namespace)) || httpSpanAttributeAllowlist.has(name);
|
|
880
1107
|
};
|
|
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
|
-
|
|
1108
|
+
var allowedEntries = (attributes2) => Object.fromEntries(Object.entries(attributes2).filter(([key]) => spanAttributeAllowed(key)));
|
|
1109
|
+
var allowlistedSpan = (span) => {
|
|
1110
|
+
let path = false;
|
|
1111
|
+
let route;
|
|
1112
|
+
return {
|
|
1113
|
+
_tag: "Span",
|
|
1114
|
+
get name() {
|
|
1115
|
+
return span.name;
|
|
1116
|
+
},
|
|
1117
|
+
get spanId() {
|
|
1118
|
+
return span.spanId;
|
|
1119
|
+
},
|
|
1120
|
+
get traceId() {
|
|
1121
|
+
return span.traceId;
|
|
1122
|
+
},
|
|
1123
|
+
get parent() {
|
|
1124
|
+
return span.parent;
|
|
1125
|
+
},
|
|
1126
|
+
get annotations() {
|
|
1127
|
+
return span.annotations;
|
|
1128
|
+
},
|
|
1129
|
+
get status() {
|
|
1130
|
+
return span.status;
|
|
1131
|
+
},
|
|
1132
|
+
get attributes() {
|
|
1133
|
+
return span.attributes;
|
|
1134
|
+
},
|
|
1135
|
+
get links() {
|
|
1136
|
+
return span.links;
|
|
1137
|
+
},
|
|
1138
|
+
get sampled() {
|
|
1139
|
+
return span.sampled;
|
|
1140
|
+
},
|
|
1141
|
+
get kind() {
|
|
1142
|
+
return span.kind;
|
|
1143
|
+
},
|
|
1144
|
+
// A successful transport can carry a failed domain operation. The producer
|
|
1145
|
+
// explicitly marks that outcome; arbitrary result payloads are never inspected.
|
|
1146
|
+
// A failure records the fixed message an error declares in place of an app's text.
|
|
1147
|
+
end: (endTime, exit) => span.end(
|
|
1148
|
+
endTime,
|
|
1149
|
+
Exit_exports.isSuccess(exit) ? span.attributes.get("executor.outcome") === "failed" ? Exit_exports.fail(new LogicalOperationFailed()) : exit : Exit_exports.failCause(recordedCause(exit.cause))
|
|
1150
|
+
),
|
|
1151
|
+
attribute: (key, value) => {
|
|
1152
|
+
if (!spanAttributeAllowed(key)) return;
|
|
1153
|
+
if (key === "url.path" && typeof value === "string") {
|
|
1154
|
+
path = true;
|
|
1155
|
+
span.attribute(key, route ?? value);
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
if (key === "http.route" && typeof value === "string") {
|
|
1159
|
+
route = value;
|
|
1160
|
+
if (path) span.attribute("url.path", value);
|
|
1161
|
+
}
|
|
1162
|
+
span.attribute(key, value);
|
|
1163
|
+
},
|
|
1164
|
+
event: (name, startTime, attributes2) => span.event(
|
|
1165
|
+
name,
|
|
1166
|
+
startTime,
|
|
1167
|
+
attributes2 === void 0 ? void 0 : allowedEntries(attributes2)
|
|
1168
|
+
),
|
|
1169
|
+
addLinks: (links) => span.addLinks(links)
|
|
1170
|
+
};
|
|
1171
|
+
};
|
|
926
1172
|
var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_exports.Tracer)(
|
|
927
1173
|
Tracer_exports.Tracer.pipe(
|
|
928
1174
|
Effect_exports.map((tracer) => ({
|
|
@@ -934,6 +1180,8 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
934
1180
|
if (recordAll && Option_exports.isSome(options.parent) && options.parent.value._tag === "ExternalSpan")
|
|
935
1181
|
span.attribute("executor.trace.parent_sampled", options.parent.value.sampled);
|
|
936
1182
|
if (clock !== void 0) span.attribute("executor.clock.type", clock);
|
|
1183
|
+
const owner = declaredOwner(options.annotations);
|
|
1184
|
+
if (owner !== void 0) span.attribute(ownerAttribute, owner);
|
|
937
1185
|
return span;
|
|
938
1186
|
}
|
|
939
1187
|
}))
|
|
@@ -941,7 +1189,7 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
941
1189
|
);
|
|
942
1190
|
var allowlistedSpans = spanAttributes();
|
|
943
1191
|
|
|
944
|
-
// ../../node_modules/.bun/effect@
|
|
1192
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
|
|
945
1193
|
var OtlpLogger_exports = {};
|
|
946
1194
|
__export(OtlpLogger_exports, {
|
|
947
1195
|
layer: () => layer2,
|
|
@@ -949,7 +1197,7 @@ __export(OtlpLogger_exports, {
|
|
|
949
1197
|
make: () => make6
|
|
950
1198
|
});
|
|
951
1199
|
|
|
952
|
-
// ../../node_modules/.bun/effect@
|
|
1200
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpEnv.js
|
|
953
1201
|
var exporterList = (path) => Array2(String2, path).pipe(map3((_) => _.map((_2) => _2.toLowerCase().trim()).filter((_2) => _2 !== "")));
|
|
954
1202
|
var headersRecord = (path) => Record(String2, StringFromUriComponent, path);
|
|
955
1203
|
var headers = (signal) => headersRecord(`OTEL_EXPORTER_OTLP_${signal}_HEADERS`).pipe(orElse(() => headersRecord("OTEL_EXPORTER_OTLP_HEADERS")), withDefault(void 0));
|
|
@@ -960,7 +1208,7 @@ var endpoint = (signal) => URL2(`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`).pipe(or
|
|
|
960
1208
|
}))), withDefault(void 0));
|
|
961
1209
|
var exporters = (signal) => exporterList(`OTEL_${signal}_EXPORTER`).pipe(withDefault([]));
|
|
962
1210
|
|
|
963
|
-
// ../../node_modules/.bun/effect@
|
|
1211
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpExporter.js
|
|
964
1212
|
var OtlpExporter_exports = {};
|
|
965
1213
|
__export(OtlpExporter_exports, {
|
|
966
1214
|
Flusher: () => Flusher,
|
|
@@ -1015,7 +1263,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1015
1263
|
const scope = get(services, Scope);
|
|
1016
1264
|
const exportInterval = max(fromInputUnsafe(options.exportInterval), zero);
|
|
1017
1265
|
let disabledUntil = void 0;
|
|
1018
|
-
const client =
|
|
1266
|
+
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
1267
|
schedule: policy,
|
|
1020
1268
|
times: 3
|
|
1021
1269
|
}));
|
|
@@ -1072,7 +1320,7 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1072
1320
|
};
|
|
1073
1321
|
});
|
|
1074
1322
|
|
|
1075
|
-
// ../../node_modules/.bun/effect@
|
|
1323
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpResource.js
|
|
1076
1324
|
var make5 = (options) => {
|
|
1077
1325
|
const resourceAttributes = options.attributes ? entriesToAttributes(Object.entries(options.attributes)) : [];
|
|
1078
1326
|
resourceAttributes.push({
|
|
@@ -1098,16 +1346,16 @@ var fromConfig = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1098
1346
|
const env = yield* Record(StringFromUriComponent, StringFromUriComponent, "OTEL_RESOURCE_ATTRIBUTES").pipe(withDefault(void 0));
|
|
1099
1347
|
const serviceName = options?.serviceName ?? options?.attributes?.["service.name"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_NAME")) ?? env?.["service.name"] ?? (yield* String3("OTEL_SERVICE_NAME"));
|
|
1100
1348
|
const serviceVersion = options?.serviceVersion ?? options?.attributes?.["service.version"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_VERSION")) ?? env?.["service.version"];
|
|
1101
|
-
const
|
|
1349
|
+
const attributes2 = {
|
|
1102
1350
|
...env,
|
|
1103
1351
|
...options?.attributes
|
|
1104
1352
|
};
|
|
1105
|
-
delete
|
|
1106
|
-
delete
|
|
1353
|
+
delete attributes2["service.name"];
|
|
1354
|
+
delete attributes2["service.version"];
|
|
1107
1355
|
return make5({
|
|
1108
1356
|
serviceName,
|
|
1109
1357
|
serviceVersion,
|
|
1110
|
-
attributes
|
|
1358
|
+
attributes: attributes2
|
|
1111
1359
|
});
|
|
1112
1360
|
}, orDie);
|
|
1113
1361
|
var serviceNameUnsafe = (resource) => {
|
|
@@ -1118,14 +1366,14 @@ var serviceNameUnsafe = (resource) => {
|
|
|
1118
1366
|
return serviceNameAttribute.value.stringValue;
|
|
1119
1367
|
};
|
|
1120
1368
|
var entriesToAttributes = (entries) => {
|
|
1121
|
-
const
|
|
1369
|
+
const attributes2 = [];
|
|
1122
1370
|
for (const [key, value] of entries) {
|
|
1123
|
-
|
|
1371
|
+
attributes2.push({
|
|
1124
1372
|
key,
|
|
1125
1373
|
value: unknownToAttributeValue(value)
|
|
1126
1374
|
});
|
|
1127
1375
|
}
|
|
1128
|
-
return
|
|
1376
|
+
return attributes2;
|
|
1129
1377
|
};
|
|
1130
1378
|
var unknownToAttributeValue = (value) => {
|
|
1131
1379
|
if (Array.isArray(value)) {
|
|
@@ -1161,7 +1409,7 @@ var unknownToAttributeValue = (value) => {
|
|
|
1161
1409
|
}
|
|
1162
1410
|
};
|
|
1163
1411
|
|
|
1164
|
-
// ../../node_modules/.bun/effect@
|
|
1412
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1165
1413
|
var OtlpSerialization_exports = {};
|
|
1166
1414
|
__export(OtlpSerialization_exports, {
|
|
1167
1415
|
OtlpSerialization: () => OtlpSerialization,
|
|
@@ -1169,7 +1417,7 @@ __export(OtlpSerialization_exports, {
|
|
|
1169
1417
|
layerProtobuf: () => layerProtobuf
|
|
1170
1418
|
});
|
|
1171
1419
|
|
|
1172
|
-
// ../../node_modules/.bun/effect@
|
|
1420
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/protobuf.js
|
|
1173
1421
|
var WireType2 = {
|
|
1174
1422
|
Varint: 0,
|
|
1175
1423
|
Fixed64: 1,
|
|
@@ -1238,7 +1486,7 @@ var messageField = (fieldNumber, message) => lengthDelimitedField(fieldNumber, m
|
|
|
1238
1486
|
var repeatedField = (fieldNumber, values, encode) => concat(...values.map((v) => messageField(fieldNumber, encode(v))));
|
|
1239
1487
|
var optionalStringField = (fieldNumber, value) => value !== void 0 && value !== "" ? stringField(fieldNumber, value) : new Uint8Array(0);
|
|
1240
1488
|
|
|
1241
|
-
// ../../node_modules/.bun/effect@
|
|
1489
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/internal/otlpProtobuf.js
|
|
1242
1490
|
var encodeAnyValue = (value) => {
|
|
1243
1491
|
if (value.stringValue !== void 0 && value.stringValue !== null) {
|
|
1244
1492
|
return stringField(1, value.stringValue);
|
|
@@ -1268,7 +1516,7 @@ var encodeKeyValueList = (value) => repeatedField(1, value.values, encodeKeyValu
|
|
|
1268
1516
|
var encodeKeyValue = (kv) => concat(stringField(1, kv.key), messageField(2, encodeAnyValue(kv.value)));
|
|
1269
1517
|
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
1518
|
var encodeResource = (resource) => concat(repeatedField(1, resource.attributes, encodeKeyValue), resource.droppedAttributesCount > 0 ? varintField(2, resource.droppedAttributesCount) : new Uint8Array(0));
|
|
1271
|
-
var encodeStatus = (
|
|
1519
|
+
var encodeStatus = (status2) => concat(optionalStringField(2, status2.message), varintField(3, status2.code));
|
|
1272
1520
|
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
1521
|
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
1522
|
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 +1525,7 @@ var encodeResourceSpans = (resourceSpans) => concat(messageField(1, encodeResour
|
|
|
1277
1525
|
var encodeTracesData = (tracesData) => repeatedField(1, tracesData.resourceSpans, encodeResourceSpans);
|
|
1278
1526
|
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
1527
|
var encodeHistogramDataPoint = (point) => {
|
|
1280
|
-
const bucketCountsEncoded = concat(...point.bucketCounts.map((
|
|
1528
|
+
const bucketCountsEncoded = concat(...point.bucketCounts.map((count2) => fixed64Field(6, BigInt(count2))));
|
|
1281
1529
|
const explicitBoundsEncoded = concat(...point.explicitBounds.map((bound) => doubleField(7, bound)));
|
|
1282
1530
|
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
1531
|
};
|
|
@@ -1293,7 +1541,7 @@ var encodeScopeLogs = (scopeLogs) => concat(messageField(1, encodeInstrumentatio
|
|
|
1293
1541
|
var encodeResourceLogs = (resourceLogs) => concat(messageField(1, encodeResource(resourceLogs.resource)), repeatedField(2, resourceLogs.scopeLogs, encodeScopeLogs), optionalStringField(3, resourceLogs.schemaUrl));
|
|
1294
1542
|
var encodeLogsData = (logsData) => repeatedField(1, logsData.resourceLogs, encodeResourceLogs);
|
|
1295
1543
|
|
|
1296
|
-
// ../../node_modules/.bun/effect@
|
|
1544
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1297
1545
|
var OtlpSerialization = class extends (/* @__PURE__ */ Service()("effect/observability/OtlpSerialization")) {
|
|
1298
1546
|
};
|
|
1299
1547
|
var layerJson = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
@@ -1307,7 +1555,7 @@ var layerProtobuf = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
|
1307
1555
|
logs: (logs) => uint8Array(encodeLogsData(logs), "application/x-protobuf")
|
|
1308
1556
|
});
|
|
1309
1557
|
|
|
1310
|
-
// ../../node_modules/.bun/effect@
|
|
1558
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpLogger.js
|
|
1311
1559
|
var make6 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
1312
1560
|
const serialization = yield* OtlpSerialization;
|
|
1313
1561
|
const otelResource = yield* fromConfig(options.resource);
|
|
@@ -1385,8 +1633,8 @@ var makeLogRecord = (options, opts) => {
|
|
|
1385
1633
|
const now = opts.clock.currentTimeNanosUnsafe();
|
|
1386
1634
|
const nanosString = now.toString();
|
|
1387
1635
|
const nowMillis = options.date.getTime();
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1636
|
+
const attributes2 = entriesToAttributes(Object.entries(options.fiber.getRef(CurrentLogAnnotations)));
|
|
1637
|
+
attributes2.push({
|
|
1390
1638
|
key: "fiberId",
|
|
1391
1639
|
value: {
|
|
1392
1640
|
intValue: options.fiber.id
|
|
@@ -1394,7 +1642,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1394
1642
|
});
|
|
1395
1643
|
if (!opts.excludeLogSpans) {
|
|
1396
1644
|
for (const [label, startTime] of options.fiber.getRef(CurrentLogSpans)) {
|
|
1397
|
-
|
|
1645
|
+
attributes2.push({
|
|
1398
1646
|
key: `logSpan.${label}`,
|
|
1399
1647
|
value: {
|
|
1400
1648
|
stringValue: `${nowMillis - startTime}ms`
|
|
@@ -1403,7 +1651,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1403
1651
|
}
|
|
1404
1652
|
}
|
|
1405
1653
|
if (options.cause.reasons.length > 0) {
|
|
1406
|
-
|
|
1654
|
+
attributes2.push({
|
|
1407
1655
|
key: "log.error",
|
|
1408
1656
|
value: {
|
|
1409
1657
|
stringValue: pretty(options.cause)
|
|
@@ -1416,7 +1664,7 @@ var makeLogRecord = (options, opts) => {
|
|
|
1416
1664
|
severityText: options.logLevel,
|
|
1417
1665
|
timeUnixNano: nanosString,
|
|
1418
1666
|
observedTimeUnixNano: nanosString,
|
|
1419
|
-
attributes,
|
|
1667
|
+
attributes: attributes2,
|
|
1420
1668
|
body: unknownToAttributeValue(message.length === 1 ? message[0] : message),
|
|
1421
1669
|
droppedAttributesCount: 0
|
|
1422
1670
|
};
|
|
@@ -1473,7 +1721,7 @@ var ESeverityNumber = {
|
|
|
1473
1721
|
SEVERITY_NUMBER_FATAL4: 24
|
|
1474
1722
|
};
|
|
1475
1723
|
|
|
1476
|
-
// ../../node_modules/.bun/effect@
|
|
1724
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpMetrics.js
|
|
1477
1725
|
var OtlpMetrics_exports = {};
|
|
1478
1726
|
__export(OtlpMetrics_exports, {
|
|
1479
1727
|
layer: () => layer3,
|
|
@@ -1519,7 +1767,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1519
1767
|
for (let i = 0, len = snapshot2.length; i < len; i++) {
|
|
1520
1768
|
const state = snapshot2[i];
|
|
1521
1769
|
const unit = state.attributes?.unit ?? state.attributes?.time_unit ?? "1";
|
|
1522
|
-
const
|
|
1770
|
+
const attributes2 = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
|
|
1523
1771
|
const metricKey = makeMetricKey(state.id, state.attributes);
|
|
1524
1772
|
switch (state.type) {
|
|
1525
1773
|
case "Counter": {
|
|
@@ -1545,7 +1793,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1545
1793
|
nextCounterState.set(metricKey, currentCount);
|
|
1546
1794
|
}
|
|
1547
1795
|
const dataPoint = {
|
|
1548
|
-
attributes,
|
|
1796
|
+
attributes: attributes2,
|
|
1549
1797
|
startTimeUnixNano: intervalStartTime,
|
|
1550
1798
|
timeUnixNano: nowTime
|
|
1551
1799
|
};
|
|
@@ -1572,7 +1820,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1572
1820
|
}
|
|
1573
1821
|
case "Gauge": {
|
|
1574
1822
|
const dataPoint = {
|
|
1575
|
-
attributes,
|
|
1823
|
+
attributes: attributes2,
|
|
1576
1824
|
startTimeUnixNano: startTime,
|
|
1577
1825
|
timeUnixNano: nowTime
|
|
1578
1826
|
};
|
|
@@ -1632,7 +1880,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1632
1880
|
});
|
|
1633
1881
|
}
|
|
1634
1882
|
const dataPoint = {
|
|
1635
|
-
attributes,
|
|
1883
|
+
attributes: attributes2,
|
|
1636
1884
|
startTimeUnixNano: intervalStartTime,
|
|
1637
1885
|
timeUnixNano: nowTime,
|
|
1638
1886
|
count: reportCount,
|
|
@@ -1671,7 +1919,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1671
1919
|
}
|
|
1672
1920
|
}
|
|
1673
1921
|
dataPoints.push({
|
|
1674
|
-
attributes: [...
|
|
1922
|
+
attributes: [...attributes2, {
|
|
1675
1923
|
key: "key",
|
|
1676
1924
|
value: {
|
|
1677
1925
|
stringValue: freqKey
|
|
@@ -1703,7 +1951,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1703
1951
|
}
|
|
1704
1952
|
case "Summary": {
|
|
1705
1953
|
const dataPoints = [{
|
|
1706
|
-
attributes: [...
|
|
1954
|
+
attributes: [...attributes2, {
|
|
1707
1955
|
key: "quantile",
|
|
1708
1956
|
value: {
|
|
1709
1957
|
stringValue: "min"
|
|
@@ -1715,7 +1963,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1715
1963
|
}];
|
|
1716
1964
|
for (const [quantile, value] of state.state.quantiles) {
|
|
1717
1965
|
dataPoints.push({
|
|
1718
|
-
attributes: [...
|
|
1966
|
+
attributes: [...attributes2, {
|
|
1719
1967
|
key: "quantile",
|
|
1720
1968
|
value: {
|
|
1721
1969
|
stringValue: quantile.toString()
|
|
@@ -1727,7 +1975,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1727
1975
|
});
|
|
1728
1976
|
}
|
|
1729
1977
|
dataPoints.push({
|
|
1730
|
-
attributes: [...
|
|
1978
|
+
attributes: [...attributes2, {
|
|
1731
1979
|
key: "quantile",
|
|
1732
1980
|
value: {
|
|
1733
1981
|
stringValue: "max"
|
|
@@ -1751,13 +1999,13 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1751
1999
|
});
|
|
1752
2000
|
}
|
|
1753
2001
|
const countDataPoint = {
|
|
1754
|
-
attributes,
|
|
2002
|
+
attributes: attributes2,
|
|
1755
2003
|
startTimeUnixNano: intervalStartTime,
|
|
1756
2004
|
timeUnixNano: nowTime,
|
|
1757
2005
|
asInt: reportCount
|
|
1758
2006
|
};
|
|
1759
2007
|
const sumDataPoint = {
|
|
1760
|
-
attributes,
|
|
2008
|
+
attributes: attributes2,
|
|
1761
2009
|
startTimeUnixNano: intervalStartTime,
|
|
1762
2010
|
timeUnixNano: nowTime,
|
|
1763
2011
|
asDouble: reportSum
|
|
@@ -1870,11 +2118,11 @@ var layerFromConfig2 = (options) => gen(function* () {
|
|
|
1870
2118
|
temporality: getOrUndefined(temporalityPreference)
|
|
1871
2119
|
});
|
|
1872
2120
|
}).pipe(orDie, unwrap);
|
|
1873
|
-
var makeMetricKey = (id,
|
|
1874
|
-
if (
|
|
2121
|
+
var makeMetricKey = (id, attributes2) => {
|
|
2122
|
+
if (attributes2 === void 0 || Object.keys(attributes2).length === 0) {
|
|
1875
2123
|
return id;
|
|
1876
2124
|
}
|
|
1877
|
-
const sortedEntries = Object.entries(
|
|
2125
|
+
const sortedEntries = Object.entries(attributes2).sort((a, b) => a[0].localeCompare(b[0]));
|
|
1878
2126
|
return `${id}:${JSON.stringify(sortedEntries)}`;
|
|
1879
2127
|
};
|
|
1880
2128
|
var EAggregationTemporality = {
|
|
@@ -1936,7 +2184,7 @@ var EAggregationTemporality = {
|
|
|
1936
2184
|
AGGREGATION_TEMPORALITY_CUMULATIVE: 2
|
|
1937
2185
|
};
|
|
1938
2186
|
|
|
1939
|
-
// ../../node_modules/.bun/effect@
|
|
2187
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/observability/OtlpTracer.js
|
|
1940
2188
|
var OtlpTracer_exports = {};
|
|
1941
2189
|
__export(OtlpTracer_exports, {
|
|
1942
2190
|
layer: () => layer4,
|
|
@@ -2051,10 +2299,10 @@ var SpanImpl = class {
|
|
|
2051
2299
|
};
|
|
2052
2300
|
}
|
|
2053
2301
|
get traceId() {
|
|
2054
|
-
return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId :
|
|
2302
|
+
return this._traceId ??= isSome(this.parent) ? this.parent.value.traceId : random(32);
|
|
2055
2303
|
}
|
|
2056
2304
|
get spanId() {
|
|
2057
|
-
return this._spanId ??=
|
|
2305
|
+
return this._spanId ??= random(16);
|
|
2058
2306
|
}
|
|
2059
2307
|
get attributes() {
|
|
2060
2308
|
return this._attributes ??= /* @__PURE__ */ new Map();
|
|
@@ -2074,39 +2322,39 @@ var SpanImpl = class {
|
|
|
2074
2322
|
attribute(key, value) {
|
|
2075
2323
|
this.attributes.set(key, value);
|
|
2076
2324
|
}
|
|
2077
|
-
event(name, startTime,
|
|
2078
|
-
this.events.push([name, startTime,
|
|
2325
|
+
event(name, startTime, attributes2) {
|
|
2326
|
+
this.events.push([name, startTime, attributes2]);
|
|
2079
2327
|
}
|
|
2080
2328
|
addLinks(links) {
|
|
2081
2329
|
this.links.push(...links);
|
|
2082
2330
|
}
|
|
2083
2331
|
};
|
|
2084
2332
|
var makeOtlpSpan = (self) => {
|
|
2085
|
-
const
|
|
2086
|
-
const
|
|
2333
|
+
const status2 = self.status;
|
|
2334
|
+
const attributes2 = self._attributes === void 0 ? [] : entriesToAttributes(self._attributes);
|
|
2087
2335
|
const events = [];
|
|
2088
2336
|
if (self._events !== void 0) {
|
|
2089
2337
|
for (let i = 0; i < self._events.length; i++) {
|
|
2090
|
-
const [name, startTime,
|
|
2338
|
+
const [name, startTime, attributes3] = self._events[i];
|
|
2091
2339
|
events.push({
|
|
2092
2340
|
name,
|
|
2093
2341
|
timeUnixNano: String(startTime),
|
|
2094
|
-
attributes:
|
|
2342
|
+
attributes: attributes3 ? entriesToAttributes(Object.entries(attributes3)) : [],
|
|
2095
2343
|
droppedAttributesCount: 0
|
|
2096
2344
|
});
|
|
2097
2345
|
}
|
|
2098
2346
|
}
|
|
2099
2347
|
let otelStatus;
|
|
2100
|
-
if (
|
|
2348
|
+
if (status2.exit._tag === "Success") {
|
|
2101
2349
|
otelStatus = {
|
|
2102
2350
|
code: StatusCode.Ok
|
|
2103
2351
|
};
|
|
2104
|
-
} else if (hasInterruptsOnly(
|
|
2352
|
+
} else if (hasInterruptsOnly(status2.exit.cause)) {
|
|
2105
2353
|
otelStatus = {
|
|
2106
2354
|
code: StatusCode.Ok,
|
|
2107
2355
|
message: "Interrupted"
|
|
2108
2356
|
};
|
|
2109
|
-
|
|
2357
|
+
attributes2.push({
|
|
2110
2358
|
key: "span.label",
|
|
2111
2359
|
value: {
|
|
2112
2360
|
stringValue: "\u26A0\uFE0E Interrupted"
|
|
@@ -2118,7 +2366,7 @@ var makeOtlpSpan = (self) => {
|
|
|
2118
2366
|
}
|
|
2119
2367
|
});
|
|
2120
2368
|
} else {
|
|
2121
|
-
const errors = prettyErrors(
|
|
2369
|
+
const errors = prettyErrors(status2.exit.cause, {
|
|
2122
2370
|
includeCauseInStack: true
|
|
2123
2371
|
});
|
|
2124
2372
|
otelStatus = {
|
|
@@ -2129,7 +2377,7 @@ var makeOtlpSpan = (self) => {
|
|
|
2129
2377
|
for (const error of errors) {
|
|
2130
2378
|
events.push({
|
|
2131
2379
|
name: "exception",
|
|
2132
|
-
timeUnixNano: String(
|
|
2380
|
+
timeUnixNano: String(status2.endTime),
|
|
2133
2381
|
droppedAttributesCount: 0,
|
|
2134
2382
|
attributes: [{
|
|
2135
2383
|
"key": "exception.type",
|
|
@@ -2167,9 +2415,9 @@ var makeOtlpSpan = (self) => {
|
|
|
2167
2415
|
parentSpanId: isSome(self.parent) ? self.parent.value.spanId : void 0,
|
|
2168
2416
|
name: self.name,
|
|
2169
2417
|
kind: SpanKind[self.kind],
|
|
2170
|
-
startTimeUnixNano: String(
|
|
2171
|
-
endTimeUnixNano: String(
|
|
2172
|
-
attributes,
|
|
2418
|
+
startTimeUnixNano: String(status2.startTime),
|
|
2419
|
+
endTimeUnixNano: String(status2.endTime),
|
|
2420
|
+
attributes: attributes2,
|
|
2173
2421
|
droppedAttributesCount: 0,
|
|
2174
2422
|
events,
|
|
2175
2423
|
droppedEventsCount: 0,
|
|
@@ -2193,18 +2441,18 @@ var SpanKind = {
|
|
|
2193
2441
|
};
|
|
2194
2442
|
|
|
2195
2443
|
// ../telemetry/src/layer.ts
|
|
2196
|
-
var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.withConsoleError(Logger_exports.formatJson)) => {
|
|
2444
|
+
var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.withConsoleError(Logger_exports.formatJson), shutdownTimeouts = {}) => {
|
|
2197
2445
|
const resource = {
|
|
2198
2446
|
serviceName: config.service,
|
|
2199
2447
|
serviceVersion: config.version,
|
|
2200
2448
|
attributes: { "deployment.environment.name": config.environment }
|
|
2201
2449
|
};
|
|
2202
|
-
const signal = (target) => ({
|
|
2450
|
+
const signal = (target, name) => ({
|
|
2203
2451
|
url: target.url,
|
|
2204
2452
|
resource,
|
|
2205
2453
|
...target.headers === void 0 ? {} : { headers: Redacted_exports.value(target.headers) },
|
|
2206
2454
|
exportInterval: lifetime === "event" ? "1 hour" : "1 second",
|
|
2207
|
-
shutdownTimeout: "3 seconds"
|
|
2455
|
+
shutdownTimeout: shutdownTimeouts[name] ?? "3 seconds"
|
|
2208
2456
|
});
|
|
2209
2457
|
const console = Logger_exports.layer([logger]);
|
|
2210
2458
|
return Layer_exports.mergeAll(
|
|
@@ -2216,18 +2464,18 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
|
|
|
2216
2464
|
// not authority to suppress server diagnostics.
|
|
2217
2465
|
spanAttributes(config.clock, true).pipe(
|
|
2218
2466
|
Layer_exports.provideMerge(
|
|
2219
|
-
OtlpTracer_exports.layer(signal(config.traces)).pipe(
|
|
2467
|
+
OtlpTracer_exports.layer(signal(config.traces, "traces")).pipe(
|
|
2220
2468
|
Layer_exports.provide(OtlpSerialization_exports.layerJson)
|
|
2221
2469
|
)
|
|
2222
2470
|
)
|
|
2223
2471
|
)
|
|
2224
2472
|
),
|
|
2225
2473
|
config.logs === void 0 ? console : OtlpLogger_exports.layer({
|
|
2226
|
-
...signal(config.logs),
|
|
2474
|
+
...signal(config.logs, "logs"),
|
|
2227
2475
|
mergeWithExisting: true
|
|
2228
2476
|
}).pipe(Layer_exports.provide(OtlpSerialization_exports.layerJson), Layer_exports.provideMerge(console)),
|
|
2229
2477
|
config.metrics === void 0 ? Layer_exports.empty : OtlpMetrics_exports.layer({
|
|
2230
|
-
...signal(config.metrics),
|
|
2478
|
+
...signal(config.metrics, "metrics"),
|
|
2231
2479
|
exportInterval: "30 seconds",
|
|
2232
2480
|
temporality: "delta"
|
|
2233
2481
|
}).pipe(
|
|
@@ -2245,30 +2493,391 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
|
|
|
2245
2493
|
);
|
|
2246
2494
|
};
|
|
2247
2495
|
|
|
2496
|
+
// ../telemetry/src/app-records.ts
|
|
2497
|
+
var appText = "Text from the app is not recorded";
|
|
2498
|
+
var unrecognized = "unrecognized";
|
|
2499
|
+
var operations = [
|
|
2500
|
+
"requirements",
|
|
2501
|
+
"inspect",
|
|
2502
|
+
"skills",
|
|
2503
|
+
"query",
|
|
2504
|
+
"mutate",
|
|
2505
|
+
"call",
|
|
2506
|
+
"account-check",
|
|
2507
|
+
"webhooks",
|
|
2508
|
+
"webhook-validate",
|
|
2509
|
+
"webhook-complete",
|
|
2510
|
+
"webhook-register",
|
|
2511
|
+
"webhook-unregister",
|
|
2512
|
+
"webhook-handle",
|
|
2513
|
+
"workflows",
|
|
2514
|
+
"workflow-validate",
|
|
2515
|
+
"workflow-run",
|
|
2516
|
+
"migrate"
|
|
2517
|
+
];
|
|
2518
|
+
var httpMethods = [
|
|
2519
|
+
"GET",
|
|
2520
|
+
"HEAD",
|
|
2521
|
+
"POST",
|
|
2522
|
+
"PUT",
|
|
2523
|
+
"PATCH",
|
|
2524
|
+
"DELETE",
|
|
2525
|
+
"OPTIONS",
|
|
2526
|
+
"TRACE",
|
|
2527
|
+
"CONNECT"
|
|
2528
|
+
];
|
|
2529
|
+
var appSpanNames = /* @__PURE__ */ new Set([
|
|
2530
|
+
"app.dispatch",
|
|
2531
|
+
...operations.map((operation) => `app.${operation}`),
|
|
2532
|
+
"app.evaluate",
|
|
2533
|
+
"app.accounts.bind",
|
|
2534
|
+
"app.account.check",
|
|
2535
|
+
"app.catalog.read",
|
|
2536
|
+
"app.skills.load",
|
|
2537
|
+
"app.skills.routers",
|
|
2538
|
+
"app.tool.resolve",
|
|
2539
|
+
"app.tool.approval",
|
|
2540
|
+
"app.tool.elicitation",
|
|
2541
|
+
"app.elicitation.wait",
|
|
2542
|
+
"app.workflow.control",
|
|
2543
|
+
"app.operation.execute",
|
|
2544
|
+
"app.sql.migrate",
|
|
2545
|
+
"app.code",
|
|
2546
|
+
"app.cache.call",
|
|
2547
|
+
"app.cache.get",
|
|
2548
|
+
"app.cache.load",
|
|
2549
|
+
"app.cache.command",
|
|
2550
|
+
"app.cache.publish",
|
|
2551
|
+
"app.cache.flush",
|
|
2552
|
+
"app.cache.lease.renew",
|
|
2553
|
+
"app.cache.lease.wait",
|
|
2554
|
+
"app.cache.refresh",
|
|
2555
|
+
"provider.http.request",
|
|
2556
|
+
"provider.http.response.read",
|
|
2557
|
+
"provider.openapi.call",
|
|
2558
|
+
"provider.graphql.request",
|
|
2559
|
+
"provider.graphql.call",
|
|
2560
|
+
"provider.mcp.session",
|
|
2561
|
+
"provider.mcp.connect",
|
|
2562
|
+
"provider.mcp.close",
|
|
2563
|
+
"provider.mcp.request",
|
|
2564
|
+
"provider.mcp.call",
|
|
2565
|
+
"provider.mcp.discover",
|
|
2566
|
+
"provider.mcp.check",
|
|
2567
|
+
"provider.mcp.health",
|
|
2568
|
+
"provider.mcp.anonymous",
|
|
2569
|
+
"provider.mcp.elicitation",
|
|
2570
|
+
"sql.execute",
|
|
2571
|
+
...httpMethods.map((method) => `http.client ${method}`)
|
|
2572
|
+
]);
|
|
2573
|
+
var errorKinds = /* @__PURE__ */ new Set([
|
|
2574
|
+
"HostRequestInvalid",
|
|
2575
|
+
"HostAccountsInvalid",
|
|
2576
|
+
"HostDeclarationInvalid",
|
|
2577
|
+
"HostEvaluationFailed",
|
|
2578
|
+
"HostOperationNotFound",
|
|
2579
|
+
"HostOperationFailed",
|
|
2580
|
+
"HostKindMismatch",
|
|
2581
|
+
"HostToolNotFound",
|
|
2582
|
+
"HostInputInvalid",
|
|
2583
|
+
"HostOutputInvalid",
|
|
2584
|
+
"HostToolBlocked",
|
|
2585
|
+
"HostToolApprovalRequired",
|
|
2586
|
+
"HostToolPolicyFailed",
|
|
2587
|
+
"ElicitationFailed",
|
|
2588
|
+
"DatabaseLimitExceeded",
|
|
2589
|
+
"DatabaseFieldReserved",
|
|
2590
|
+
"SkillLoadFailed",
|
|
2591
|
+
"WorkflowFailure",
|
|
2592
|
+
"ProviderError",
|
|
2593
|
+
"OpenapiResponseError",
|
|
2594
|
+
"OpenapiError",
|
|
2595
|
+
"OpenapiCompileError",
|
|
2596
|
+
"GraphqlError",
|
|
2597
|
+
"McpError",
|
|
2598
|
+
"McpToolError",
|
|
2599
|
+
"McpCredentialsUnverified",
|
|
2600
|
+
"CacheError",
|
|
2601
|
+
"AppDatabaseError",
|
|
2602
|
+
"AppStorageError",
|
|
2603
|
+
"AppStorageUnavailable",
|
|
2604
|
+
"NetworkRefused",
|
|
2605
|
+
"FetchOptionUnsupported",
|
|
2606
|
+
"LogicalOperationFailed",
|
|
2607
|
+
"HttpClientError",
|
|
2608
|
+
"SchemaError",
|
|
2609
|
+
"TimeoutError",
|
|
2610
|
+
"UnknownError",
|
|
2611
|
+
"InterruptError",
|
|
2612
|
+
"Error",
|
|
2613
|
+
"TypeError",
|
|
2614
|
+
"RangeError",
|
|
2615
|
+
"ReferenceError",
|
|
2616
|
+
"SyntaxError",
|
|
2617
|
+
"EvalError",
|
|
2618
|
+
"URIError",
|
|
2619
|
+
"AggregateError",
|
|
2620
|
+
"AbortError",
|
|
2621
|
+
"string",
|
|
2622
|
+
"number",
|
|
2623
|
+
"bigint",
|
|
2624
|
+
"boolean",
|
|
2625
|
+
"symbol",
|
|
2626
|
+
"undefined",
|
|
2627
|
+
"object",
|
|
2628
|
+
"function"
|
|
2629
|
+
]);
|
|
2630
|
+
var failureCodes = /* @__PURE__ */ new Set([
|
|
2631
|
+
// CacheError
|
|
2632
|
+
"unavailable",
|
|
2633
|
+
"storage",
|
|
2634
|
+
"invalid",
|
|
2635
|
+
"capacity",
|
|
2636
|
+
"timeout",
|
|
2637
|
+
// AppDatabaseError
|
|
2638
|
+
"schema",
|
|
2639
|
+
"schema_changed",
|
|
2640
|
+
"table",
|
|
2641
|
+
"index",
|
|
2642
|
+
"range",
|
|
2643
|
+
"value",
|
|
2644
|
+
"readonly",
|
|
2645
|
+
"cursor",
|
|
2646
|
+
"limit",
|
|
2647
|
+
"closed",
|
|
2648
|
+
"replay",
|
|
2649
|
+
// OpenapiError
|
|
2650
|
+
"invalid_definition",
|
|
2651
|
+
"invalid_input",
|
|
2652
|
+
"request",
|
|
2653
|
+
// McpError, McpCredentialsUnverified and ProviderError
|
|
2654
|
+
"unauthorized",
|
|
2655
|
+
"invalid_response",
|
|
2656
|
+
"forbidden",
|
|
2657
|
+
"rate_limited",
|
|
2658
|
+
"rejected",
|
|
2659
|
+
"anonymous_access",
|
|
2660
|
+
// NetworkRefused and FetchOptionUnsupported
|
|
2661
|
+
"private_address",
|
|
2662
|
+
"credential_host",
|
|
2663
|
+
"credential_app",
|
|
2664
|
+
"credential_expired",
|
|
2665
|
+
"redirect",
|
|
2666
|
+
"cache",
|
|
2667
|
+
"integrity"
|
|
2668
|
+
]);
|
|
2669
|
+
var text = (value) => typeof value["stringValue"] === "string" ? value["stringValue"] : void 0;
|
|
2670
|
+
var integer = (value) => {
|
|
2671
|
+
const raw = value["intValue"];
|
|
2672
|
+
const number = typeof raw === "string" && /^-?\d{1,15}$/.test(raw) ? Number(raw) : raw;
|
|
2673
|
+
return typeof number === "number" && Number.isSafeInteger(number) ? number : void 0;
|
|
2674
|
+
};
|
|
2675
|
+
var oneOf = (...values) => (value) => {
|
|
2676
|
+
const found = text(value);
|
|
2677
|
+
return found !== void 0 && values.includes(found) ? { stringValue: found } : void 0;
|
|
2678
|
+
};
|
|
2679
|
+
var classified = (known) => (value) => {
|
|
2680
|
+
const found = text(value);
|
|
2681
|
+
return found === void 0 ? void 0 : { stringValue: known.has(found) ? found : unrecognized };
|
|
2682
|
+
};
|
|
2683
|
+
var flag = (value) => typeof value["boolValue"] === "boolean" ? { boolValue: value["boolValue"] } : void 0;
|
|
2684
|
+
var count = (value) => {
|
|
2685
|
+
const found = integer(value);
|
|
2686
|
+
return found !== void 0 && found >= 0 ? { intValue: found } : void 0;
|
|
2687
|
+
};
|
|
2688
|
+
var status = (value) => {
|
|
2689
|
+
const found = integer(value);
|
|
2690
|
+
return found !== void 0 && found >= 100 && found <= 599 ? { intValue: found } : void 0;
|
|
2691
|
+
};
|
|
2692
|
+
var duration = (value) => {
|
|
2693
|
+
const found = typeof value["doubleValue"] === "number" ? value["doubleValue"] : integer(value);
|
|
2694
|
+
return found !== void 0 && Number.isFinite(found) && found >= 0 ? { doubleValue: found } : void 0;
|
|
2695
|
+
};
|
|
2696
|
+
var spanAttributes2 = {
|
|
2697
|
+
"executor.operation": oneOf(...operations, "mutation", "discover"),
|
|
2698
|
+
"executor.outcome": oneOf("failed"),
|
|
2699
|
+
"executor.clock.type": oneOf("system", "cloudflare-io"),
|
|
2700
|
+
"executor.trace.parent_sampled": flag,
|
|
2701
|
+
"executor.failure.source": oneOf("app", "storage", "service"),
|
|
2702
|
+
"executor.failure.code": classified(failureCodes),
|
|
2703
|
+
"error.type": classified(errorKinds),
|
|
2704
|
+
"cache.operation": oneOf(
|
|
2705
|
+
"read",
|
|
2706
|
+
"acquire",
|
|
2707
|
+
"claim",
|
|
2708
|
+
"publish",
|
|
2709
|
+
"release",
|
|
2710
|
+
"renew",
|
|
2711
|
+
"write",
|
|
2712
|
+
"invalidate"
|
|
2713
|
+
),
|
|
2714
|
+
"cache.result": oneOf("fresh", "stale", "miss", "local"),
|
|
2715
|
+
"cache.load.leased": flag,
|
|
2716
|
+
"cache.flush.index": count,
|
|
2717
|
+
"cache.flush.count": count,
|
|
2718
|
+
"cache.flush.entries": count,
|
|
2719
|
+
"cache.flush.bytes": count,
|
|
2720
|
+
"cache.leases": count,
|
|
2721
|
+
"mcp.transport": oneOf("http", "sse", "stdio"),
|
|
2722
|
+
"mcp.operation": oneOf("discover", "call", "check", "health"),
|
|
2723
|
+
"mcp.tool.is_error": flag,
|
|
2724
|
+
"rpc.system.name": oneOf("jsonrpc"),
|
|
2725
|
+
"rpc.method": oneOf("initialize", "tools/list", "tools/call", "ping"),
|
|
2726
|
+
"graphql.operation.type": oneOf("query", "mutation", "subscription"),
|
|
2727
|
+
"db.system.name": oneOf("sqlite"),
|
|
2728
|
+
"db.operation.name": oneOf("execute"),
|
|
2729
|
+
"http.request.method": oneOf(...httpMethods),
|
|
2730
|
+
"http.response.status_code": status,
|
|
2731
|
+
"url.scheme": oneOf("http", "https"),
|
|
2732
|
+
"span.label": oneOf("\u26A0\uFE0E Interrupted"),
|
|
2733
|
+
"status.interrupted": flag,
|
|
2734
|
+
"executor.milestone.reached": flag,
|
|
2735
|
+
"executor.owner": oneOf("executor", "app", "upstream", "person", "lease", "background"),
|
|
2736
|
+
"executor.app.code": oneOf(
|
|
2737
|
+
"factory",
|
|
2738
|
+
"router",
|
|
2739
|
+
"approval",
|
|
2740
|
+
"handler",
|
|
2741
|
+
"loader",
|
|
2742
|
+
"cache",
|
|
2743
|
+
"webhook",
|
|
2744
|
+
"check",
|
|
2745
|
+
"skills",
|
|
2746
|
+
"elicitation",
|
|
2747
|
+
"workflow",
|
|
2748
|
+
"step"
|
|
2749
|
+
),
|
|
2750
|
+
"executor.workflow.operation": oneOf("start", "get", "list", "terminate"),
|
|
2751
|
+
"cache.method": oneOf("get", "revalidate", "read", "readMany", "write", "invalidate"),
|
|
2752
|
+
"executor.upstream.wait_ms": duration,
|
|
2753
|
+
"executor.elicitation.wait_ms": duration,
|
|
2754
|
+
"executor.authored_ms": duration,
|
|
2755
|
+
"executor.lease.wait_ms": duration,
|
|
2756
|
+
"executor.background_ms": duration,
|
|
2757
|
+
"executor.overhead_ms": duration
|
|
2758
|
+
};
|
|
2759
|
+
var appSpanAttributeKeys = new Set(Object.keys(spanAttributes2));
|
|
2760
|
+
var logMessages = /* @__PURE__ */ new Set([
|
|
2761
|
+
"The app's request failed unexpectedly",
|
|
2762
|
+
"App cache refresh failed",
|
|
2763
|
+
"MCP catalog invalidation failed",
|
|
2764
|
+
"Telemetry export failed"
|
|
2765
|
+
]);
|
|
2766
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2767
|
+
var spanId = (value) => typeof value === "string" && /^[a-f0-9]{16}$/.test(value) ? value : void 0;
|
|
2768
|
+
var nanos = (value) => typeof value === "string" && /^\d{1,20}$/.test(value) ? value : void 0;
|
|
2769
|
+
var between = (value, minimum, maximum) => typeof value === "number" && Number.isInteger(value) && value >= minimum && value <= maximum ? value : void 0;
|
|
2770
|
+
var attributes = (from) => (Array.isArray(from) ? from : []).flatMap((attribute) => {
|
|
2771
|
+
if (!isObject(attribute) || typeof attribute["key"] !== "string") return [];
|
|
2772
|
+
const key = attribute["key"];
|
|
2773
|
+
const keep = Object.hasOwn(spanAttributes2, key) ? spanAttributes2[key] : void 0;
|
|
2774
|
+
const value = attribute["value"];
|
|
2775
|
+
const kept = keep === void 0 || !isObject(value) ? void 0 : keep(value);
|
|
2776
|
+
return kept === void 0 ? [] : [{ key, value: kept }];
|
|
2777
|
+
});
|
|
2778
|
+
var exception = (event) => {
|
|
2779
|
+
const named = (Array.isArray(event["attributes"]) ? event["attributes"] : []).find(
|
|
2780
|
+
(attribute) => isObject(attribute) && attribute["key"] === "exception.type"
|
|
2781
|
+
);
|
|
2782
|
+
const type = isObject(named) && isObject(named["value"]) ? text(named["value"]) : void 0;
|
|
2783
|
+
const recorded2 = type !== void 0 && errorKinds.has(type) ? type : unrecognized;
|
|
2784
|
+
const time = nanos(event["timeUnixNano"]);
|
|
2785
|
+
return {
|
|
2786
|
+
name: "exception",
|
|
2787
|
+
...time === void 0 ? {} : { timeUnixNano: time },
|
|
2788
|
+
attributes: [
|
|
2789
|
+
{ key: "exception.type", value: { stringValue: recorded2 } },
|
|
2790
|
+
{ key: "exception.message", value: { stringValue: appText } },
|
|
2791
|
+
{ key: "exception.stacktrace", value: { stringValue: `${recorded2}: ${appText}` } }
|
|
2792
|
+
]
|
|
2793
|
+
};
|
|
2794
|
+
};
|
|
2795
|
+
var appSpan = (span) => {
|
|
2796
|
+
const start = nanos(span["startTimeUnixNano"]);
|
|
2797
|
+
const end = nanos(span["endTimeUnixNano"]);
|
|
2798
|
+
if (start === void 0 || end === void 0) return void 0;
|
|
2799
|
+
const parent = spanId(span["parentSpanId"]);
|
|
2800
|
+
const kind = between(span["kind"], 0, 5);
|
|
2801
|
+
const code = isObject(span["status"]) ? between(span["status"]["code"], 0, 2) : void 0;
|
|
2802
|
+
const name = typeof span["name"] === "string" && appSpanNames.has(span["name"]) ? span["name"] : "app.unrecognized";
|
|
2803
|
+
return {
|
|
2804
|
+
traceId: span.traceId,
|
|
2805
|
+
spanId: span.spanId,
|
|
2806
|
+
...parent === void 0 ? {} : { parentSpanId: parent },
|
|
2807
|
+
name,
|
|
2808
|
+
...kind === void 0 ? {} : { kind },
|
|
2809
|
+
startTimeUnixNano: start,
|
|
2810
|
+
endTimeUnixNano: end,
|
|
2811
|
+
attributes: attributes(span["attributes"]),
|
|
2812
|
+
events: (Array.isArray(span["events"]) ? span["events"] : []).flatMap(
|
|
2813
|
+
(event) => isObject(event) && event["name"] === "exception" ? [exception(event)] : []
|
|
2814
|
+
),
|
|
2815
|
+
...code === void 0 ? {} : { status: { code } }
|
|
2816
|
+
};
|
|
2817
|
+
};
|
|
2818
|
+
var appLog = (log) => {
|
|
2819
|
+
const time = nanos(log["timeUnixNano"]);
|
|
2820
|
+
const observed = nanos(log["observedTimeUnixNano"]);
|
|
2821
|
+
const severity = between(log["severityNumber"], 1, 24);
|
|
2822
|
+
const level = log["severityText"];
|
|
2823
|
+
const body = isObject(log["body"]) ? text(log["body"]) : void 0;
|
|
2824
|
+
return {
|
|
2825
|
+
...log.traceId === void 0 ? {} : { traceId: log.traceId },
|
|
2826
|
+
...log.spanId === void 0 ? {} : { spanId: log.spanId },
|
|
2827
|
+
...time === void 0 ? {} : { timeUnixNano: time },
|
|
2828
|
+
...observed === void 0 ? {} : { observedTimeUnixNano: observed },
|
|
2829
|
+
...severity === void 0 ? {} : { severityNumber: severity },
|
|
2830
|
+
...typeof level === "string" && ["Trace", "Debug", "Info", "Warn", "Error", "Fatal"].includes(level) ? { severityText: level } : {},
|
|
2831
|
+
body: { stringValue: body !== void 0 && logMessages.has(body) ? body : appText }
|
|
2832
|
+
};
|
|
2833
|
+
};
|
|
2834
|
+
|
|
2248
2835
|
// ../telemetry/src/relay.ts
|
|
2249
2836
|
var makeTelemetryForwarder = Effect_exports.gen(function* () {
|
|
2250
2837
|
const fibers = yield* FiberSet_exports.make();
|
|
2251
|
-
const pending = yield* Semaphore_exports.make(16);
|
|
2252
2838
|
const sender = yield* Semaphore_exports.make(1);
|
|
2253
|
-
const
|
|
2839
|
+
const pending = [];
|
|
2840
|
+
let queued = 0;
|
|
2841
|
+
const failed = (reason) => recordExportFailure("app", reason);
|
|
2842
|
+
const take = () => {
|
|
2843
|
+
let size = 0;
|
|
2844
|
+
let count2 = 0;
|
|
2845
|
+
while (count2 < pending.length && (count2 === 0 || size + pending[count2].size <= exportBudget))
|
|
2846
|
+
size += pending[count2++].size;
|
|
2847
|
+
queued -= size;
|
|
2848
|
+
return pending.splice(0, count2);
|
|
2849
|
+
};
|
|
2850
|
+
const sendAll = Effect_exports.suspend(() => {
|
|
2851
|
+
const forwards = take();
|
|
2852
|
+
return forwards.length === 0 ? Effect_exports.void : exportForwards(forwards, "executor-app").pipe(
|
|
2853
|
+
Effect_exports.catchTag("TimeoutError", () => failed("timeout")),
|
|
2854
|
+
Effect_exports.catch(() => failed("relay")),
|
|
2855
|
+
Effect_exports.andThen(sendAll)
|
|
2856
|
+
);
|
|
2857
|
+
});
|
|
2858
|
+
const drain = Effect_exports.suspend(
|
|
2859
|
+
() => sender.withPermitsIfAvailable(1)(sendAll).pipe(
|
|
2860
|
+
Effect_exports.flatMap((sent) => Option_exports.isSome(sent) && pending.length > 0 ? drain : Effect_exports.void)
|
|
2861
|
+
)
|
|
2862
|
+
);
|
|
2254
2863
|
yield* Effect_exports.addFinalizer(
|
|
2255
2864
|
() => FiberSet_exports.awaitEmpty(fibers).pipe(
|
|
2256
2865
|
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
2866
|
Effect_exports.flatMap(
|
|
2267
|
-
(
|
|
2867
|
+
(drained) => Option_exports.isNone(drained) || pending.length > 0 ? failed("shutdown") : Effect_exports.void
|
|
2268
2868
|
)
|
|
2269
2869
|
)
|
|
2270
|
-
)
|
|
2870
|
+
);
|
|
2871
|
+
return (batch, traceId, source) => Effect_exports.suspend(() => {
|
|
2872
|
+
const size = [...batch.traces, ...batch.logs].reduce((total, body) => total + body.length, 0);
|
|
2873
|
+
if (queued + size > queueBudget) return failed("capacity");
|
|
2874
|
+
pending.push({ batch, traceId, source, size });
|
|
2875
|
+
queued += size;
|
|
2876
|
+
return FiberSet_exports.run(fibers, drain).pipe(Effect_exports.asVoid);
|
|
2877
|
+
});
|
|
2271
2878
|
});
|
|
2879
|
+
var queueBudget = 8 * 1048576;
|
|
2880
|
+
var exportBudget = 4 * 1048576;
|
|
2272
2881
|
var payloadBytes = 262144;
|
|
2273
2882
|
var encoder = new TextEncoder();
|
|
2274
2883
|
var Payload = Schema_exports.String.check(
|
|
@@ -2360,8 +2969,8 @@ var recordPacker = (prefix, suffix) => {
|
|
|
2360
2969
|
}
|
|
2361
2970
|
};
|
|
2362
2971
|
};
|
|
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}$/));
|
|
2972
|
+
var HexTrace = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{32}$/u));
|
|
2973
|
+
var HexSpan = Schema_exports.String.check(Schema_exports.isPattern(/^[a-f0-9]{16}$/u));
|
|
2365
2974
|
var Span = Schema_exports.StructWithRest(Schema_exports.Struct({ traceId: HexTrace, spanId: HexSpan }), [
|
|
2366
2975
|
Schema_exports.Record(Schema_exports.String, Schema_exports.Json)
|
|
2367
2976
|
]);
|
|
@@ -2391,58 +3000,67 @@ var LogPayload = Schema_exports.fromJsonString(
|
|
|
2391
3000
|
)
|
|
2392
3001
|
})
|
|
2393
3002
|
);
|
|
2394
|
-
var
|
|
3003
|
+
var exportForwards = (forwards, service) => Effect_exports.gen(function* () {
|
|
2395
3004
|
const config = yield* CurrentTelemetryConfig;
|
|
2396
3005
|
if (config === void 0) return;
|
|
2397
|
-
const resource = {
|
|
3006
|
+
const resource = ({ build, app }) => ({
|
|
2398
3007
|
attributes: [
|
|
2399
3008
|
{ key: "service.name", value: { stringValue: service } },
|
|
2400
3009
|
{ key: "service.version", value: { stringValue: config.version } },
|
|
2401
3010
|
{ key: "deployment.environment.name", value: { stringValue: config.environment } },
|
|
2402
|
-
...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }]
|
|
3011
|
+
...build === void 0 ? [] : [{ key: "executor.build.id", value: { stringValue: build } }],
|
|
3012
|
+
...app === void 0 ? [] : [{ key: "executor.app.id", value: { stringValue: app } }]
|
|
2403
3013
|
]
|
|
2404
|
-
};
|
|
2405
|
-
const client = yield* HttpClient_exports.HttpClient;
|
|
2406
|
-
|
|
2407
|
-
|
|
3014
|
+
});
|
|
3015
|
+
const client = retryTelemetryExport(yield* HttpClient_exports.HttpClient);
|
|
3016
|
+
const dropped = forwards.reduce((total, { batch }) => total + batch.dropped, 0);
|
|
3017
|
+
if (dropped > 0) yield* recordExportFailure("app", "capacity", dropped);
|
|
3018
|
+
const send = (signal) => Effect_exports.gen(function* () {
|
|
2408
3019
|
const target = config[signal];
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
3020
|
+
const sending = forwards.filter(({ batch }) => batch[signal].length > 0);
|
|
3021
|
+
if (target === void 0 || sending.length === 0) return;
|
|
3022
|
+
const data = signal === "traces" ? {
|
|
3023
|
+
resourceSpans: yield* Effect_exports.forEach(
|
|
3024
|
+
sending,
|
|
3025
|
+
({ batch, traceId, source }) => Effect_exports.forEach(
|
|
3026
|
+
batch.traces,
|
|
3027
|
+
(body) => Schema_exports.decodeUnknownEffect(TracePayload)(body)
|
|
3028
|
+
).pipe(
|
|
3029
|
+
Effect_exports.map((payloads) => ({
|
|
3030
|
+
resource: resource(source),
|
|
2418
3031
|
scopeSpans: [
|
|
2419
3032
|
{
|
|
2420
3033
|
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)
|
|
3034
|
+
spans: payloads.flatMap((payload) => payload.resourceSpans).flatMap((r) => r.scopeSpans.flatMap((s) => s.spans)).filter((span) => traceId === void 0 || span.traceId === traceId).flatMap((span) => {
|
|
3035
|
+
if (service !== "executor-app") return [span];
|
|
3036
|
+
const kept = appSpan(span);
|
|
3037
|
+
return kept === void 0 ? [] : [kept];
|
|
3038
|
+
})
|
|
2422
3039
|
}
|
|
2423
3040
|
]
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
3041
|
+
}))
|
|
3042
|
+
)
|
|
3043
|
+
)
|
|
3044
|
+
} : {
|
|
3045
|
+
resourceLogs: yield* Effect_exports.forEach(
|
|
3046
|
+
sending,
|
|
3047
|
+
({ batch, traceId, source }) => Effect_exports.forEach(
|
|
3048
|
+
batch.logs,
|
|
3049
|
+
(body) => Schema_exports.decodeUnknownEffect(LogPayload)(body)
|
|
3050
|
+
).pipe(
|
|
3051
|
+
Effect_exports.map((payloads) => ({
|
|
3052
|
+
resource: resource(source),
|
|
2435
3053
|
scopeLogs: [
|
|
2436
3054
|
{
|
|
2437
3055
|
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)
|
|
3056
|
+
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
3057
|
}
|
|
2440
3058
|
]
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
yield* client.
|
|
3059
|
+
}))
|
|
3060
|
+
)
|
|
3061
|
+
)
|
|
3062
|
+
};
|
|
3063
|
+
yield* client.execute(
|
|
2446
3064
|
HttpClientRequest_exports.post(target.url).pipe(
|
|
2447
3065
|
HttpClientRequest_exports.setHeaders(
|
|
2448
3066
|
target.headers === void 0 ? {} : Redacted_exports.value(target.headers)
|
|
@@ -2450,7 +3068,13 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
|
|
|
2450
3068
|
HttpClientRequest_exports.bodyJsonUnsafe(data)
|
|
2451
3069
|
)
|
|
2452
3070
|
);
|
|
2453
|
-
}
|
|
3071
|
+
});
|
|
3072
|
+
const sent = yield* Effect_exports.forEach(
|
|
3073
|
+
["traces", "logs"],
|
|
3074
|
+
(signal) => Effect_exports.result(send(signal)),
|
|
3075
|
+
{ concurrency: "unbounded" }
|
|
3076
|
+
);
|
|
3077
|
+
yield* Effect_exports.forEach(sent, (result) => Effect_exports.fromResult(result), { discard: true });
|
|
2454
3078
|
}).pipe(
|
|
2455
3079
|
Effect_exports.provide(telemetryHttpClient),
|
|
2456
3080
|
Effect_exports.provideService(Tracer_exports.DisablePropagation, true),
|
|
@@ -2459,8 +3083,8 @@ var forwardTelemetry = (batch, traceId, build, service = "executor-app") => Effe
|
|
|
2459
3083
|
|
|
2460
3084
|
// ../telemetry/src/trace-context.ts
|
|
2461
3085
|
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}$/)),
|
|
3086
|
+
traceId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/u)),
|
|
3087
|
+
spanId: Schema_exports.String.check(Schema_exports.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/u)),
|
|
2464
3088
|
sampled: Schema_exports.Boolean
|
|
2465
3089
|
});
|
|
2466
3090
|
var currentTraceContext = Effect_exports.currentSpan.pipe(
|
|
@@ -2502,6 +3126,10 @@ var pendingSpan = (name, options) => Effect_exports.gen(function* () {
|
|
|
2502
3126
|
|
|
2503
3127
|
export {
|
|
2504
3128
|
CurrentTelemetryConfig,
|
|
3129
|
+
ownedBy,
|
|
3130
|
+
owned,
|
|
3131
|
+
measuredSpan,
|
|
3132
|
+
makeOwnershipAccounting,
|
|
2505
3133
|
OtlpExporter_exports,
|
|
2506
3134
|
telemetryLayer,
|
|
2507
3135
|
captureTelemetry,
|