apps 0.0.1-beta.126 → 0.0.1-beta.127
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/framework-reference.json +1 -1
- package/js/{chunk-7TDDMSZI.js → chunk-2XVGONUX.js} +6 -6
- package/js/{chunk-V3HWVVFZ.js → chunk-3CDTMIVU.js} +3 -3
- package/js/{chunk-7ASLJHSD.js → chunk-3II7MIAQ.js} +6 -6
- package/js/{chunk-3KNB4HRA.js → chunk-53GRY7ZE.js} +3 -3
- package/js/{chunk-7ZYZWLXS.js → chunk-5CMAHXQD.js} +60 -61
- package/js/{chunk-VXBCDIWD.js → chunk-5H5IO2NZ.js} +778 -213
- package/js/{chunk-2AI3RZXP.js → chunk-5WCWPY23.js} +10 -10
- package/js/{chunk-MJUHAHDG.js → chunk-67DM7ASO.js} +2 -2
- package/js/{chunk-QUFLMMTG.js → chunk-DJNOADLI.js} +182 -61
- package/js/{chunk-KJW5IPM4.js → chunk-FXJUHTFE.js} +1 -1
- package/js/{chunk-VEQDEM6J.js → chunk-J3CZECVS.js} +13 -13
- package/js/{chunk-SO33LZ7J.js → chunk-KKKUQPWD.js} +2 -2
- package/js/{chunk-CCJUTN55.js → chunk-LC6YCEVL.js} +1 -1
- package/js/chunk-N7HXZNBD.js +161 -0
- package/js/{chunk-5TYZML5C.js → chunk-NGL6EJL6.js} +1775 -626
- package/js/{chunk-2EEUUSL7.js → chunk-NMSQJSBM.js} +308 -331
- package/js/{chunk-TTMRK64V.js → chunk-O46YT2VS.js} +2 -2
- package/js/{chunk-5LGG5YSE.js → chunk-PZBT2QO5.js} +2 -2
- package/js/{chunk-U2GHFWX2.js → chunk-QYHUNAWH.js} +7415 -3500
- package/js/{chunk-EPZ3P7IX.js → chunk-SA7FJGUX.js} +2 -2
- package/js/{chunk-LOHZM4RK.js → chunk-UJWZMRV6.js} +5 -5
- package/js/{chunk-MVAS3VFK.js → chunk-V2TAC4IJ.js} +8 -8
- package/js/{chunk-NCOPALJZ.js → chunk-WE4FZOSH.js} +1 -1
- package/js/{chunk-GWAA3COO.js → chunk-ZU2ECYYF.js} +4 -4
- package/js/{chunk-55QLA7T7.js → chunk-ZU77L7HU.js} +6 -6
- package/js/client.js +10 -10
- package/js/contracts.js +7 -7
- package/js/effect.js +18 -18
- package/js/graphql.js +20 -20
- package/js/host.js +18 -18
- package/js/index.js +13 -13
- package/js/mcp/effect.js +19 -19
- package/js/mcp.js +21 -21
- package/js/openapi.js +16 -16
- package/js/react.js +2 -2
- package/js/skills/effect.js +6 -6
- package/js/skills.js +15 -15
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -5
- package/js/ui/serving.js +10 -10
- package/package.json +2 -2
- package/runtime.json +1 -1
- package/types/telemetry/src/layer.d.ts +1 -1
- package/js/chunk-EAPSQBFN.js +0 -75
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FetchHttpClient_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N7HXZNBD.js";
|
|
4
4
|
import {
|
|
5
5
|
recordedMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LC6YCEVL.js";
|
|
7
7
|
import {
|
|
8
8
|
HttpBody_exports,
|
|
9
9
|
HttpClient,
|
|
10
10
|
HttpClientError_exports,
|
|
11
11
|
HttpClientRequest_exports,
|
|
12
12
|
HttpClient_exports,
|
|
13
|
+
HttpMiddleware_exports,
|
|
13
14
|
HttpServerResponse_exports,
|
|
14
15
|
HttpTraceContext_exports,
|
|
15
16
|
TracerPropagationEnabled,
|
|
17
|
+
compressBody,
|
|
16
18
|
filterStatusOk,
|
|
17
19
|
isHttpClientError,
|
|
18
|
-
jsonUnsafe,
|
|
19
20
|
post,
|
|
20
21
|
retryTransient,
|
|
21
22
|
setBody,
|
|
22
23
|
tap,
|
|
23
24
|
tapError,
|
|
25
|
+
text,
|
|
24
26
|
transformResponse,
|
|
25
27
|
uint8Array
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-NGL6EJL6.js";
|
|
27
29
|
import {
|
|
28
30
|
Array as Array2,
|
|
29
31
|
Boolean2 as Boolean,
|
|
@@ -63,64 +65,67 @@ import {
|
|
|
63
65
|
addDelay,
|
|
64
66
|
addFinalizer,
|
|
65
67
|
all2 as all,
|
|
66
|
-
allocate,
|
|
67
68
|
andThen,
|
|
68
69
|
annotateLogs,
|
|
69
70
|
asVoid,
|
|
70
71
|
awaitEmpty,
|
|
71
72
|
await_,
|
|
72
73
|
catchCause,
|
|
74
|
+
concat,
|
|
73
75
|
context,
|
|
74
76
|
effect,
|
|
75
77
|
effectDiscard,
|
|
78
|
+
encode,
|
|
76
79
|
ensure,
|
|
77
80
|
firstSomeOf,
|
|
78
|
-
flatMap,
|
|
79
|
-
flatMap2,
|
|
81
|
+
flatMap2 as flatMap,
|
|
80
82
|
flow,
|
|
81
83
|
fnUntraced,
|
|
82
84
|
forEach,
|
|
83
85
|
forever,
|
|
84
|
-
forever2,
|
|
85
86
|
forkIn,
|
|
86
87
|
format,
|
|
87
88
|
fromInput2 as fromInput,
|
|
88
89
|
fromInputUnsafe,
|
|
89
|
-
fromRecordUnsafe,
|
|
90
|
-
fromUndefinedOr,
|
|
91
90
|
gen,
|
|
92
91
|
get,
|
|
92
|
+
getCurrentVersion,
|
|
93
|
+
getOrElse,
|
|
93
94
|
getOrUndefined,
|
|
94
95
|
hasInterruptsOnly,
|
|
95
96
|
identity,
|
|
96
97
|
ignore,
|
|
97
98
|
interruptible,
|
|
99
|
+
isFailure,
|
|
100
|
+
isFinite,
|
|
98
101
|
isSome,
|
|
99
102
|
layer,
|
|
100
103
|
logDebug,
|
|
101
104
|
make,
|
|
102
105
|
make4 as make2,
|
|
103
106
|
make5 as make3,
|
|
107
|
+
make6 as make4,
|
|
104
108
|
map,
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
map4 as map2,
|
|
110
|
+
map7 as map3,
|
|
107
111
|
max,
|
|
108
|
-
merge3 as merge,
|
|
109
112
|
millis,
|
|
110
113
|
option,
|
|
111
114
|
orDie,
|
|
112
115
|
orElse,
|
|
113
|
-
|
|
116
|
+
parseRetryAfter,
|
|
114
117
|
passthrough,
|
|
115
|
-
pretty,
|
|
116
118
|
prettyErrors,
|
|
117
119
|
provideMerge,
|
|
118
120
|
provideService,
|
|
121
|
+
race,
|
|
119
122
|
random,
|
|
123
|
+
retryAfterDelay,
|
|
120
124
|
run2 as run,
|
|
121
125
|
runtime,
|
|
122
126
|
schema,
|
|
123
127
|
seconds,
|
|
128
|
+
set3 as set,
|
|
124
129
|
sleep,
|
|
125
130
|
snapshotUnsafe,
|
|
126
131
|
succeed3 as succeed,
|
|
@@ -134,7 +139,7 @@ import {
|
|
|
134
139
|
withDefault2 as withDefault,
|
|
135
140
|
withTracerEnabled,
|
|
136
141
|
zero
|
|
137
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-QYHUNAWH.js";
|
|
138
143
|
import {
|
|
139
144
|
__export
|
|
140
145
|
} from "./chunk-CZ7CSFO4.js";
|
|
@@ -661,15 +666,15 @@ function getTextEncoding() {
|
|
|
661
666
|
const te = new globalThis.TextEncoder();
|
|
662
667
|
const td = new globalThis.TextDecoder();
|
|
663
668
|
globalThis[symbol] = {
|
|
664
|
-
encodeUtf8(
|
|
665
|
-
return te.encode(
|
|
669
|
+
encodeUtf8(text3) {
|
|
670
|
+
return te.encode(text3);
|
|
666
671
|
},
|
|
667
672
|
decodeUtf8(bytes) {
|
|
668
673
|
return td.decode(bytes);
|
|
669
674
|
},
|
|
670
|
-
checkUtf8(
|
|
675
|
+
checkUtf8(text3) {
|
|
671
676
|
try {
|
|
672
|
-
encodeURIComponent(
|
|
677
|
+
encodeURIComponent(text3);
|
|
673
678
|
return true;
|
|
674
679
|
} catch (_) {
|
|
675
680
|
return false;
|
|
@@ -1169,7 +1174,12 @@ var allowlistedSpan = (span) => {
|
|
|
1169
1174
|
addLinks: (links) => span.addLinks(links)
|
|
1170
1175
|
};
|
|
1171
1176
|
};
|
|
1172
|
-
var
|
|
1177
|
+
var httpSpanNames = Layer_exports.mergeAll(
|
|
1178
|
+
Layer_exports.succeed(HttpMiddleware_exports.SpanNameGenerator, (request) => `http.server ${request.method}`),
|
|
1179
|
+
Layer_exports.succeed(HttpClient_exports.SpanNameGenerator, (request) => `http.client ${request.method}`)
|
|
1180
|
+
);
|
|
1181
|
+
var spanAttributes = (clock, recordAll = false) => Layer_exports.merge(httpSpanNames, tracerWithAllowlist(clock, recordAll));
|
|
1182
|
+
var tracerWithAllowlist = (clock, recordAll) => Layer_exports.effect(Tracer_exports.Tracer)(
|
|
1173
1183
|
Tracer_exports.Tracer.pipe(
|
|
1174
1184
|
Effect_exports.map((tracer) => ({
|
|
1175
1185
|
...tracer,
|
|
@@ -1189,15 +1199,15 @@ var spanAttributes = (clock, recordAll = false) => Layer_exports.effect(Tracer_e
|
|
|
1189
1199
|
);
|
|
1190
1200
|
var allowlistedSpans = spanAttributes();
|
|
1191
1201
|
|
|
1192
|
-
// ../../node_modules/.bun/effect@4.
|
|
1202
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpLogger.js
|
|
1193
1203
|
var OtlpLogger_exports = {};
|
|
1194
1204
|
__export(OtlpLogger_exports, {
|
|
1195
1205
|
layer: () => layer2,
|
|
1196
1206
|
layerFromConfig: () => layerFromConfig,
|
|
1197
|
-
make: () =>
|
|
1207
|
+
make: () => make7
|
|
1198
1208
|
});
|
|
1199
1209
|
|
|
1200
|
-
// ../../node_modules/.bun/effect@4.
|
|
1210
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/internal/otlpEnv.js
|
|
1201
1211
|
var exporterList = (path) => Array2(String2, path).pipe(map3((_) => _.map((_2) => _2.toLowerCase().trim()).filter((_2) => _2 !== "")));
|
|
1202
1212
|
var headersRecord = (path) => Record(String2, StringFromUriComponent, path);
|
|
1203
1213
|
var headers = (signal) => headersRecord(`OTEL_EXPORTER_OTLP_${signal}_HEADERS`).pipe(orElse(() => headersRecord("OTEL_EXPORTER_OTLP_HEADERS")), withDefault(void 0));
|
|
@@ -1208,32 +1218,25 @@ var endpoint = (signal) => URL2(`OTEL_EXPORTER_OTLP_${signal}_ENDPOINT`).pipe(or
|
|
|
1208
1218
|
}))), withDefault(void 0));
|
|
1209
1219
|
var exporters = (signal) => exporterList(`OTEL_${signal}_EXPORTER`).pipe(withDefault([]));
|
|
1210
1220
|
|
|
1211
|
-
// ../../node_modules/.bun/effect@4.
|
|
1221
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpExporter.js
|
|
1212
1222
|
var OtlpExporter_exports = {};
|
|
1213
1223
|
__export(OtlpExporter_exports, {
|
|
1214
1224
|
Flusher: () => Flusher,
|
|
1215
1225
|
layerFlusher: () => layerFlusher,
|
|
1216
|
-
make: () =>
|
|
1226
|
+
make: () => make5
|
|
1217
1227
|
});
|
|
1218
|
-
var
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
return succeed2(seconds(seconds2.value));
|
|
1222
|
-
}
|
|
1223
|
-
if (value === void 0) {
|
|
1224
|
-
return succeed2(seconds(5));
|
|
1225
|
-
}
|
|
1226
|
-
const timestamp = Date.parse(value);
|
|
1227
|
-
if (Number.isNaN(timestamp)) {
|
|
1228
|
+
var retryAfterDelay2 = (value) => {
|
|
1229
|
+
const retryAfter = value === void 0 ? void 0 : parseRetryAfter(value);
|
|
1230
|
+
if (retryAfter === void 0 || isFailure(retryAfter)) {
|
|
1228
1231
|
return succeed2(seconds(5));
|
|
1229
1232
|
}
|
|
1230
|
-
return map2(Clock, (clock) =>
|
|
1233
|
+
return map2(Clock, (clock) => retryAfterDelay(retryAfter.success, clock.currentTimeMillisUnsafe()));
|
|
1231
1234
|
};
|
|
1232
1235
|
var policy = /* @__PURE__ */ forever.pipe(passthrough, /* @__PURE__ */ addDelay(({
|
|
1233
1236
|
output: error
|
|
1234
1237
|
}) => {
|
|
1235
1238
|
if (isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429) {
|
|
1236
|
-
return
|
|
1239
|
+
return retryAfterDelay2(error.reason.response.headers["retry-after"]);
|
|
1237
1240
|
}
|
|
1238
1241
|
return succeed2(seconds(1));
|
|
1239
1242
|
}));
|
|
@@ -1251,45 +1254,47 @@ var layerFlusher = /* @__PURE__ */ sync(Flusher, () => {
|
|
|
1251
1254
|
discard: true
|
|
1252
1255
|
});
|
|
1253
1256
|
}),
|
|
1254
|
-
register: (run2) =>
|
|
1257
|
+
register: (run2) => flatMap(Scope, (scope) => {
|
|
1255
1258
|
registry.add(run2);
|
|
1256
1259
|
return addFinalizer(scope, sync2(() => registry.delete(run2)));
|
|
1257
1260
|
})
|
|
1258
1261
|
};
|
|
1259
1262
|
});
|
|
1260
|
-
var
|
|
1263
|
+
var make5 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
1261
1264
|
const services = yield* context();
|
|
1262
1265
|
const clock = get(services, Clock);
|
|
1263
1266
|
const scope = get(services, Scope);
|
|
1264
1267
|
const exportInterval = max(fromInputUnsafe(options.exportInterval), zero);
|
|
1265
|
-
let disabledUntil = void 0;
|
|
1266
1268
|
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({
|
|
1267
1269
|
schedule: policy,
|
|
1268
1270
|
times: 3
|
|
1269
1271
|
}));
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
headers2 = merge(fromInput(options.headers), headers2);
|
|
1275
|
-
}
|
|
1272
|
+
const exporterUserAgent = `OTel-OTLP-Exporter-JavaScript-Effect-${options.label}/${getCurrentVersion()}`;
|
|
1273
|
+
const userHeaders = fromInput(options.headers);
|
|
1274
|
+
const userAgent = userHeaders["user-agent"];
|
|
1275
|
+
const headers2 = set(userHeaders, "user-agent", userAgent ? `${userAgent} ${exporterUserAgent}` : exporterUserAgent);
|
|
1276
1276
|
const request = post(options.url, {
|
|
1277
1277
|
headers: headers2
|
|
1278
1278
|
});
|
|
1279
|
+
const exportsEmpty = options.maxBatchSize === "disabled" && options.exportEmpty === true;
|
|
1279
1280
|
let buffer = [];
|
|
1281
|
+
let disabledUntil = void 0;
|
|
1282
|
+
const isDisabled = () => {
|
|
1283
|
+
if (disabledUntil === void 0) return false;
|
|
1284
|
+
if (clock.currentTimeMillisUnsafe() < disabledUntil) return true;
|
|
1285
|
+
disabledUntil = void 0;
|
|
1286
|
+
return false;
|
|
1287
|
+
};
|
|
1280
1288
|
const runExport = suspend(() => {
|
|
1281
|
-
if (
|
|
1282
|
-
return void_;
|
|
1283
|
-
} else if (disabledUntil !== void 0) {
|
|
1284
|
-
disabledUntil = void 0;
|
|
1285
|
-
}
|
|
1286
|
-
if (buffer.length === 0 && (options.maxBatchSize !== "disabled" || options.exportEmpty !== true)) {
|
|
1289
|
+
if (isDisabled() || buffer.length === 0 && !exportsEmpty) {
|
|
1287
1290
|
return void_;
|
|
1288
1291
|
}
|
|
1289
1292
|
const items = buffer;
|
|
1290
1293
|
buffer = [];
|
|
1291
1294
|
const [body, onSuccess] = options.body(items);
|
|
1292
|
-
|
|
1295
|
+
const batchRequest = setBody(request, body);
|
|
1296
|
+
const response = options.compression === "gzip" ? compressBody(batchRequest, "gzip").pipe(flatMap(client.execute)) : client.execute(batchRequest);
|
|
1297
|
+
return response.pipe(andThen(onSuccess), asVoid, withTracerEnabled(false));
|
|
1293
1298
|
}).pipe(catchCause((cause) => {
|
|
1294
1299
|
if (disabledUntil !== void 0) return void_;
|
|
1295
1300
|
disabledUntil = clock.currentTimeMillisUnsafe() + 6e4;
|
|
@@ -1299,51 +1304,69 @@ var make4 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1299
1304
|
package: "@effect/opentelemetry",
|
|
1300
1305
|
module: options.label
|
|
1301
1306
|
}));
|
|
1302
|
-
const exportFibers = yield*
|
|
1307
|
+
const exportFibers = yield* make3();
|
|
1303
1308
|
const runExportFork = yield* runtime(exportFibers)();
|
|
1304
|
-
const flusher = yield* Flusher;
|
|
1305
|
-
yield* flusher.register(runExport);
|
|
1306
1309
|
yield* addFinalizer(scope, suspend(() => {
|
|
1307
1310
|
if (disabledUntil !== void 0) return void_;
|
|
1308
1311
|
runExportFork(runExport);
|
|
1309
1312
|
return awaitEmpty(exportFibers);
|
|
1310
1313
|
}).pipe(ignore, interruptible, timeoutOption(options.shutdownTimeout)));
|
|
1311
|
-
|
|
1314
|
+
const timed = isFinite(exportInterval);
|
|
1315
|
+
const armed = yield* make2(exportsEmpty);
|
|
1316
|
+
const wake = yield* make2();
|
|
1317
|
+
const disarmIfEmpty = sync2(() => {
|
|
1318
|
+
if (exportsEmpty || buffer.length > 0 || !armed.closeUnsafe()) return;
|
|
1319
|
+
wake.openUnsafe();
|
|
1320
|
+
});
|
|
1321
|
+
if (timed) {
|
|
1322
|
+
yield* gen(function* () {
|
|
1323
|
+
while (true) {
|
|
1324
|
+
wake.closeUnsafe();
|
|
1325
|
+
yield* armed.await;
|
|
1326
|
+
yield* race(sleep(exportInterval), wake.await);
|
|
1327
|
+
yield* await_(yield* run(exportFibers, runExport));
|
|
1328
|
+
yield* disarmIfEmpty;
|
|
1329
|
+
}
|
|
1330
|
+
}).pipe(forkIn(scope));
|
|
1331
|
+
}
|
|
1332
|
+
const exportNow = andThen(runExport, disarmIfEmpty);
|
|
1333
|
+
const flusher = yield* Flusher;
|
|
1334
|
+
yield* flusher.register(exportNow);
|
|
1312
1335
|
return {
|
|
1313
1336
|
push(data) {
|
|
1314
|
-
if (
|
|
1337
|
+
if (isDisabled()) return;
|
|
1315
1338
|
buffer.push(data);
|
|
1316
1339
|
if (options.maxBatchSize !== "disabled" && buffer.length >= options.maxBatchSize) {
|
|
1317
|
-
runExportFork(
|
|
1340
|
+
runExportFork(exportNow);
|
|
1341
|
+
} else if (timed) {
|
|
1342
|
+
armed.openUnsafe();
|
|
1318
1343
|
}
|
|
1319
1344
|
}
|
|
1320
1345
|
};
|
|
1321
1346
|
});
|
|
1322
1347
|
|
|
1323
|
-
// ../../node_modules/.bun/effect@4.
|
|
1324
|
-
var
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
return {
|
|
1341
|
-
attributes: resourceAttributes,
|
|
1342
|
-
droppedAttributesCount: 0
|
|
1343
|
-
};
|
|
1344
|
-
};
|
|
1348
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpResource.js
|
|
1349
|
+
var isBrowser = "window" in globalThis || "importScripts" in globalThis;
|
|
1350
|
+
var make6 = (options) => ({
|
|
1351
|
+
attributes: entriesToAttributes(Object.entries({
|
|
1352
|
+
"telemetry.sdk.name": "effect",
|
|
1353
|
+
"telemetry.sdk.language": isBrowser ? "webjs" : "nodejs",
|
|
1354
|
+
"telemetry.sdk.version": getCurrentVersion(),
|
|
1355
|
+
...options.attributes,
|
|
1356
|
+
...options.serviceName ? {
|
|
1357
|
+
"service.name": options.serviceName
|
|
1358
|
+
} : void 0,
|
|
1359
|
+
...options.serviceVersion ? {
|
|
1360
|
+
"service.version": options.serviceVersion
|
|
1361
|
+
} : void 0
|
|
1362
|
+
})),
|
|
1363
|
+
droppedAttributesCount: 0
|
|
1364
|
+
});
|
|
1345
1365
|
var fromConfig = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
1346
|
-
const env = yield* Record(StringFromUriComponent, StringFromUriComponent, "OTEL_RESOURCE_ATTRIBUTES"
|
|
1366
|
+
const env = yield* Record(StringFromUriComponent, StringFromUriComponent, "OTEL_RESOURCE_ATTRIBUTES", {
|
|
1367
|
+
trim: true,
|
|
1368
|
+
keepEmptyValues: true
|
|
1369
|
+
}).pipe(withDefault(void 0));
|
|
1347
1370
|
const serviceName = options?.serviceName ?? options?.attributes?.["service.name"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_NAME")) ?? env?.["service.name"] ?? (yield* String3("OTEL_SERVICE_NAME"));
|
|
1348
1371
|
const serviceVersion = options?.serviceVersion ?? options?.attributes?.["service.version"] ?? (yield* schema(UndefinedOr(String2), "OTEL_SERVICE_VERSION")) ?? env?.["service.version"];
|
|
1349
1372
|
const attributes2 = {
|
|
@@ -1352,7 +1375,7 @@ var fromConfig = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1352
1375
|
};
|
|
1353
1376
|
delete attributes2["service.name"];
|
|
1354
1377
|
delete attributes2["service.version"];
|
|
1355
|
-
return
|
|
1378
|
+
return make6({
|
|
1356
1379
|
serviceName,
|
|
1357
1380
|
serviceVersion,
|
|
1358
1381
|
attributes: attributes2
|
|
@@ -1375,6 +1398,7 @@ var entriesToAttributes = (entries) => {
|
|
|
1375
1398
|
}
|
|
1376
1399
|
return attributes2;
|
|
1377
1400
|
};
|
|
1401
|
+
var int64Bound = 2 ** 63;
|
|
1378
1402
|
var unknownToAttributeValue = (value) => {
|
|
1379
1403
|
if (Array.isArray(value)) {
|
|
1380
1404
|
return {
|
|
@@ -1389,12 +1413,15 @@ var unknownToAttributeValue = (value) => {
|
|
|
1389
1413
|
stringValue: value
|
|
1390
1414
|
};
|
|
1391
1415
|
case "bigint":
|
|
1392
|
-
return {
|
|
1416
|
+
return BigInt.asIntN(64, value) === value ? {
|
|
1393
1417
|
intValue: String(value)
|
|
1418
|
+
} : {
|
|
1419
|
+
stringValue: String(value)
|
|
1394
1420
|
};
|
|
1395
1421
|
case "number":
|
|
1396
|
-
return Number.isInteger(value) ? {
|
|
1397
|
-
|
|
1422
|
+
return Number.isInteger(value) && value >= -int64Bound && value < int64Bound ? {
|
|
1423
|
+
// Unsafe integers would be rounded when written as JSON numbers
|
|
1424
|
+
intValue: Number.isSafeInteger(value) ? value : String(BigInt(value))
|
|
1398
1425
|
} : {
|
|
1399
1426
|
doubleValue: value
|
|
1400
1427
|
};
|
|
@@ -1409,7 +1436,7 @@ var unknownToAttributeValue = (value) => {
|
|
|
1409
1436
|
}
|
|
1410
1437
|
};
|
|
1411
1438
|
|
|
1412
|
-
// ../../node_modules/.bun/effect@4.
|
|
1439
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1413
1440
|
var OtlpSerialization_exports = {};
|
|
1414
1441
|
__export(OtlpSerialization_exports, {
|
|
1415
1442
|
OtlpSerialization: () => OtlpSerialization,
|
|
@@ -1417,7 +1444,7 @@ __export(OtlpSerialization_exports, {
|
|
|
1417
1444
|
layerProtobuf: () => layerProtobuf
|
|
1418
1445
|
});
|
|
1419
1446
|
|
|
1420
|
-
// ../../node_modules/.bun/effect@4.
|
|
1447
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/internal/protobuf.js
|
|
1421
1448
|
var WireType2 = {
|
|
1422
1449
|
Varint: 0,
|
|
1423
1450
|
Fixed64: 1,
|
|
@@ -1464,29 +1491,21 @@ var encodeHexBytes = (hex) => {
|
|
|
1464
1491
|
}
|
|
1465
1492
|
return bytes;
|
|
1466
1493
|
};
|
|
1467
|
-
var
|
|
1468
|
-
|
|
1469
|
-
const result = new Uint8Array(totalLength);
|
|
1470
|
-
let offset = 0;
|
|
1471
|
-
for (const arr of arrays) {
|
|
1472
|
-
result.set(arr, offset);
|
|
1473
|
-
offset += arr.length;
|
|
1474
|
-
}
|
|
1475
|
-
return result;
|
|
1476
|
-
};
|
|
1477
|
-
var varintField = (fieldNumber, value) => concat(encodeVarint(encodeTag(fieldNumber, WireType2.Varint)), encodeVarint(value));
|
|
1494
|
+
var concat2 = (...arrays) => concat(arrays);
|
|
1495
|
+
var varintField = (fieldNumber, value) => concat2(encodeVarint(encodeTag(fieldNumber, WireType2.Varint)), encodeVarint(value));
|
|
1478
1496
|
var boolField = (fieldNumber, value) => varintField(fieldNumber, value ? 1 : 0);
|
|
1479
|
-
var fixed64Field = (fieldNumber, value) =>
|
|
1480
|
-
var fixed32Field = (fieldNumber, value) =>
|
|
1481
|
-
var doubleField = (fieldNumber, value) =>
|
|
1482
|
-
var lengthDelimitedField = (fieldNumber, value) =>
|
|
1497
|
+
var fixed64Field = (fieldNumber, value) => concat2(encodeVarint(encodeTag(fieldNumber, WireType2.Fixed64)), encodeFixed64(value));
|
|
1498
|
+
var fixed32Field = (fieldNumber, value) => concat2(encodeVarint(encodeTag(fieldNumber, WireType2.Fixed32)), encodeFixed32(value));
|
|
1499
|
+
var doubleField = (fieldNumber, value) => concat2(encodeVarint(encodeTag(fieldNumber, WireType2.Fixed64)), encodeDouble(value));
|
|
1500
|
+
var lengthDelimitedField = (fieldNumber, value) => concat2(encodeVarint(encodeTag(fieldNumber, WireType2.LengthDelimited)), encodeVarint(value.length), value);
|
|
1483
1501
|
var stringField = (fieldNumber, value) => lengthDelimitedField(fieldNumber, encodeString(value));
|
|
1484
1502
|
var bytesFieldFromHex = (fieldNumber, hex) => lengthDelimitedField(fieldNumber, encodeHexBytes(hex));
|
|
1485
1503
|
var messageField = (fieldNumber, message) => lengthDelimitedField(fieldNumber, message);
|
|
1486
|
-
var repeatedField = (fieldNumber, values,
|
|
1504
|
+
var repeatedField = (fieldNumber, values, encode2) => concat2(...values.map((v) => messageField(fieldNumber, encode2(v))));
|
|
1487
1505
|
var optionalStringField = (fieldNumber, value) => value !== void 0 && value !== "" ? stringField(fieldNumber, value) : new Uint8Array(0);
|
|
1506
|
+
var optionalFixed64Field = (fieldNumber, value) => value !== void 0 ? fixed64Field(fieldNumber, BigInt(value)) : new Uint8Array(0);
|
|
1488
1507
|
|
|
1489
|
-
// ../../node_modules/.bun/effect@4.
|
|
1508
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/internal/otlpProtobuf.js
|
|
1490
1509
|
var encodeAnyValue = (value) => {
|
|
1491
1510
|
if (value.stringValue !== void 0 && value.stringValue !== null) {
|
|
1492
1511
|
return stringField(1, value.stringValue);
|
|
@@ -1513,41 +1532,52 @@ var encodeAnyValue = (value) => {
|
|
|
1513
1532
|
};
|
|
1514
1533
|
var encodeArrayValue = (value) => repeatedField(1, value.values, encodeAnyValue);
|
|
1515
1534
|
var encodeKeyValueList = (value) => repeatedField(1, value.values, encodeKeyValue);
|
|
1516
|
-
var encodeKeyValue = (kv) =>
|
|
1517
|
-
var encodeInstrumentationScope = (scope) =>
|
|
1518
|
-
var encodeResource = (resource) =>
|
|
1519
|
-
var encodeStatus = (status2) =>
|
|
1520
|
-
var encodeEvent = (event) =>
|
|
1521
|
-
var encodeLink = (link) =>
|
|
1522
|
-
var encodeSpan = (span) =>
|
|
1523
|
-
var encodeScopeSpans = (scopeSpans) =>
|
|
1524
|
-
var encodeResourceSpans = (resourceSpans) =>
|
|
1535
|
+
var encodeKeyValue = (kv) => concat2(stringField(1, kv.key), messageField(2, encodeAnyValue(kv.value)));
|
|
1536
|
+
var encodeInstrumentationScope = (scope) => concat2(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));
|
|
1537
|
+
var encodeResource = (resource) => concat2(repeatedField(1, resource.attributes, encodeKeyValue), resource.droppedAttributesCount > 0 ? varintField(2, resource.droppedAttributesCount) : new Uint8Array(0));
|
|
1538
|
+
var encodeStatus = (status2) => concat2(optionalStringField(2, status2.message), varintField(3, status2.code));
|
|
1539
|
+
var encodeEvent = (event) => concat2(fixed64Field(1, BigInt(event.timeUnixNano)), stringField(2, event.name), repeatedField(3, event.attributes, encodeKeyValue), event.droppedAttributesCount > 0 ? varintField(4, event.droppedAttributesCount) : new Uint8Array(0));
|
|
1540
|
+
var encodeLink = (link) => concat2(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));
|
|
1541
|
+
var encodeSpan = (span) => concat2(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));
|
|
1542
|
+
var encodeScopeSpans = (scopeSpans) => concat2(messageField(1, encodeInstrumentationScope(scopeSpans.scope)), repeatedField(2, scopeSpans.spans, encodeSpan), optionalStringField(3, scopeSpans.schemaUrl));
|
|
1543
|
+
var encodeResourceSpans = (resourceSpans) => concat2(messageField(1, encodeResource(resourceSpans.resource)), repeatedField(2, resourceSpans.scopeSpans, encodeScopeSpans), optionalStringField(3, resourceSpans.schemaUrl));
|
|
1525
1544
|
var encodeTracesData = (tracesData) => repeatedField(1, tracesData.resourceSpans, encodeResourceSpans);
|
|
1526
|
-
var encodeNumberDataPoint = (point) =>
|
|
1545
|
+
var encodeNumberDataPoint = (point) => concat2(optionalFixed64Field(2, 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));
|
|
1527
1546
|
var encodeHistogramDataPoint = (point) => {
|
|
1528
|
-
const bucketCountsEncoded =
|
|
1529
|
-
const explicitBoundsEncoded =
|
|
1530
|
-
return
|
|
1547
|
+
const bucketCountsEncoded = concat2(...point.bucketCounts.map((count2) => fixed64Field(6, BigInt(count2))));
|
|
1548
|
+
const explicitBoundsEncoded = concat2(...point.explicitBounds.map((bound) => doubleField(7, bound)));
|
|
1549
|
+
return concat2(optionalFixed64Field(2, 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));
|
|
1531
1550
|
};
|
|
1532
1551
|
var encodeGauge = (gauge) => repeatedField(1, gauge.dataPoints, encodeNumberDataPoint);
|
|
1533
|
-
var encodeSum = (sum) =>
|
|
1534
|
-
var encodeHistogram = (histogram) =>
|
|
1535
|
-
var
|
|
1536
|
-
var
|
|
1537
|
-
var
|
|
1552
|
+
var encodeSum = (sum) => concat2(repeatedField(1, sum.dataPoints, encodeNumberDataPoint), varintField(2, sum.aggregationTemporality), boolField(3, sum.isMonotonic));
|
|
1553
|
+
var encodeHistogram = (histogram) => concat2(repeatedField(1, histogram.dataPoints, encodeHistogramDataPoint), varintField(2, histogram.aggregationTemporality));
|
|
1554
|
+
var encodeSummaryDataPoint = (point) => concat2(optionalFixed64Field(2, point.startTimeUnixNano), fixed64Field(3, BigInt(point.timeUnixNano)), fixed64Field(4, BigInt(point.count)), doubleField(5, point.sum), repeatedField(6, point.quantileValues, (q) => concat2(doubleField(1, q.quantile), doubleField(2, q.value))), repeatedField(7, point.attributes, encodeKeyValue), point.flags !== void 0 ? varintField(8, point.flags) : new Uint8Array(0));
|
|
1555
|
+
var encodeSummary = (summary) => repeatedField(1, summary.dataPoints, encodeSummaryDataPoint);
|
|
1556
|
+
var encodeMetric = (metric) => concat2(stringField(1, metric.name), optionalStringField(2, metric.description), optionalStringField(3, metric.unit), metric.gauge !== void 0 ? messageField(5, encodeGauge(metric.gauge)) : new Uint8Array(0), metric.sum !== void 0 ? messageField(7, encodeSum(metric.sum)) : new Uint8Array(0), metric.histogram !== void 0 ? messageField(9, encodeHistogram(metric.histogram)) : new Uint8Array(0), metric.summary !== void 0 ? messageField(11, encodeSummary(metric.summary)) : new Uint8Array(0));
|
|
1557
|
+
var encodeScopeMetrics = (scopeMetrics) => concat2(messageField(1, encodeInstrumentationScope(scopeMetrics.scope)), repeatedField(2, scopeMetrics.metrics, encodeMetric), optionalStringField(3, scopeMetrics.schemaUrl));
|
|
1558
|
+
var encodeResourceMetrics = (resourceMetrics) => concat2(messageField(1, encodeResource(resourceMetrics.resource)), repeatedField(2, resourceMetrics.scopeMetrics, encodeScopeMetrics), optionalStringField(3, resourceMetrics.schemaUrl));
|
|
1538
1559
|
var encodeMetricsData = (metricsData) => repeatedField(1, metricsData.resourceMetrics, encodeResourceMetrics);
|
|
1539
|
-
var encodeLogRecord = (record) =>
|
|
1540
|
-
var encodeScopeLogs = (scopeLogs) =>
|
|
1541
|
-
var encodeResourceLogs = (resourceLogs) =>
|
|
1560
|
+
var encodeLogRecord = (record) => concat2(fixed64Field(1, BigInt(record.timeUnixNano)), record.severityNumber !== void 0 ? varintField(2, record.severityNumber) : new Uint8Array(0), optionalStringField(3, record.severityText), record.body !== void 0 ? messageField(5, encodeAnyValue(record.body)) : new Uint8Array(0), repeatedField(6, record.attributes, encodeKeyValue), record.droppedAttributesCount !== void 0 && record.droppedAttributesCount > 0 ? varintField(7, record.droppedAttributesCount) : new Uint8Array(0), record.flags !== void 0 ? fixed32Field(8, record.flags) : new Uint8Array(0), record.traceId !== void 0 && record.traceId !== "" ? bytesFieldFromHex(9, record.traceId) : new Uint8Array(0), record.spanId !== void 0 && record.spanId !== "" ? bytesFieldFromHex(10, record.spanId) : new Uint8Array(0), record.observedTimeUnixNano !== void 0 ? fixed64Field(11, BigInt(record.observedTimeUnixNano)) : new Uint8Array(0));
|
|
1561
|
+
var encodeScopeLogs = (scopeLogs) => concat2(messageField(1, encodeInstrumentationScope(scopeLogs.scope)), repeatedField(2, scopeLogs.logRecords, encodeLogRecord), optionalStringField(3, scopeLogs.schemaUrl));
|
|
1562
|
+
var encodeResourceLogs = (resourceLogs) => concat2(messageField(1, encodeResource(resourceLogs.resource)), repeatedField(2, resourceLogs.scopeLogs, encodeScopeLogs), optionalStringField(3, resourceLogs.schemaUrl));
|
|
1542
1563
|
var encodeLogsData = (logsData) => repeatedField(1, logsData.resourceLogs, encodeResourceLogs);
|
|
1543
1564
|
|
|
1544
|
-
// ../../node_modules/.bun/effect@4.
|
|
1565
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpSerialization.js
|
|
1545
1566
|
var OtlpSerialization = class extends (/* @__PURE__ */ Service()("effect/observability/OtlpSerialization")) {
|
|
1546
1567
|
};
|
|
1568
|
+
function jsonReplacer(key, value) {
|
|
1569
|
+
if (typeof value === "number" && !Number.isFinite(value)) return String(value);
|
|
1570
|
+
if (key === "bytesValue" && this[key] instanceof Uint8Array) return encode(this[key]);
|
|
1571
|
+
return value;
|
|
1572
|
+
}
|
|
1573
|
+
var jsonBody = (data) => {
|
|
1574
|
+
const json = JSON.stringify(data);
|
|
1575
|
+
return text(json.includes("null") || json.includes('"bytesValue":') ? JSON.stringify(data, jsonReplacer) : json, "application/json");
|
|
1576
|
+
};
|
|
1547
1577
|
var layerJson = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
1548
|
-
traces: (spans) =>
|
|
1549
|
-
metrics: (metrics) =>
|
|
1550
|
-
logs: (logs) =>
|
|
1578
|
+
traces: (spans) => jsonBody(spans),
|
|
1579
|
+
metrics: (metrics) => jsonBody(metrics),
|
|
1580
|
+
logs: (logs) => jsonBody(logs)
|
|
1551
1581
|
});
|
|
1552
1582
|
var layerProtobuf = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
1553
1583
|
traces: (spans) => uint8Array(encodeTracesData(spans), "application/x-protobuf"),
|
|
@@ -1555,17 +1585,19 @@ var layerProtobuf = /* @__PURE__ */ succeed(OtlpSerialization, {
|
|
|
1555
1585
|
logs: (logs) => uint8Array(encodeLogsData(logs), "application/x-protobuf")
|
|
1556
1586
|
});
|
|
1557
1587
|
|
|
1558
|
-
// ../../node_modules/.bun/effect@4.
|
|
1559
|
-
var
|
|
1588
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpLogger.js
|
|
1589
|
+
var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
1560
1590
|
const serialization = yield* OtlpSerialization;
|
|
1561
1591
|
const otelResource = yield* fromConfig(options.resource);
|
|
1562
1592
|
const scope = {
|
|
1563
|
-
name:
|
|
1593
|
+
name: "effect",
|
|
1594
|
+
version: getCurrentVersion()
|
|
1564
1595
|
};
|
|
1565
|
-
const exporter = yield*
|
|
1596
|
+
const exporter = yield* make5({
|
|
1566
1597
|
label: "OtlpLogger",
|
|
1567
1598
|
url: options.url,
|
|
1568
1599
|
headers: options.headers,
|
|
1600
|
+
compression: options.compression,
|
|
1569
1601
|
maxBatchSize: options.maxBatchSize ?? 1e3,
|
|
1570
1602
|
exportInterval: options.exportInterval ?? seconds(1),
|
|
1571
1603
|
body: (data) => [serialization.logs({
|
|
@@ -1583,11 +1615,11 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1583
1615
|
excludeLogSpans: options.excludeLogSpans ?? false,
|
|
1584
1616
|
clock: yield* Clock
|
|
1585
1617
|
};
|
|
1586
|
-
return
|
|
1618
|
+
return make4((options2) => {
|
|
1587
1619
|
exporter.push(makeLogRecord(options2, opts));
|
|
1588
1620
|
});
|
|
1589
1621
|
});
|
|
1590
|
-
var layer2 = (options) => layer([
|
|
1622
|
+
var layer2 = (options) => layer([make7(options)], {
|
|
1591
1623
|
mergeWithExisting: options.mergeWithExisting ?? true
|
|
1592
1624
|
}).pipe(provideMerge(layerFlusher));
|
|
1593
1625
|
var layerFromConfig = (options) => gen(function* () {
|
|
@@ -1604,12 +1636,16 @@ var layerFromConfig = (options) => gen(function* () {
|
|
|
1604
1636
|
return layerFlusher;
|
|
1605
1637
|
}
|
|
1606
1638
|
const {
|
|
1639
|
+
baseCompression,
|
|
1640
|
+
compression,
|
|
1607
1641
|
baseTimeout,
|
|
1608
1642
|
logsTimeout,
|
|
1609
1643
|
exportTimeout,
|
|
1610
1644
|
scheduleDelay,
|
|
1611
1645
|
maxBatchSize
|
|
1612
1646
|
} = yield* all({
|
|
1647
|
+
baseCompression: option(Literals(["gzip", "none"], "OTEL_EXPORTER_OTLP_COMPRESSION")),
|
|
1648
|
+
compression: option(Literals(["gzip", "none"], "OTEL_EXPORTER_OTLP_LOGS_COMPRESSION")),
|
|
1613
1649
|
baseTimeout: option(Int("OTEL_EXPORTER_OTLP_TIMEOUT")),
|
|
1614
1650
|
logsTimeout: option(Int("OTEL_EXPORTER_OTLP_LOGS_TIMEOUT")),
|
|
1615
1651
|
exportTimeout: option(Int("OTEL_BLRP_EXPORT_TIMEOUT")),
|
|
@@ -1622,6 +1658,7 @@ var layerFromConfig = (options) => gen(function* () {
|
|
|
1622
1658
|
url: endpoint2.toString(),
|
|
1623
1659
|
resource: options?.resource,
|
|
1624
1660
|
headers: options?.headers ?? (yield* headers("LOGS")),
|
|
1661
|
+
compression: getOrElse(firstSomeOf([compression, baseCompression]), () => "none"),
|
|
1625
1662
|
exportInterval: getOrUndefined(exportInterval),
|
|
1626
1663
|
maxBatchSize: getOrUndefined(maxBatchSize),
|
|
1627
1664
|
shutdownTimeout: getOrUndefined(shutdownTimeout),
|
|
@@ -1629,47 +1666,40 @@ var layerFromConfig = (options) => gen(function* () {
|
|
|
1629
1666
|
mergeWithExisting: options?.mergeWithExisting
|
|
1630
1667
|
});
|
|
1631
1668
|
}).pipe(orDie, unwrap);
|
|
1669
|
+
var nanosPerMilli = /* @__PURE__ */ BigInt(1e6);
|
|
1632
1670
|
var makeLogRecord = (options, opts) => {
|
|
1633
|
-
const
|
|
1634
|
-
const
|
|
1635
|
-
const
|
|
1636
|
-
const attributes2 =
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
intValue: options.fiber.id
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1671
|
+
const observedTime = opts.clock.currentTimeNanosUnsafe().toString();
|
|
1672
|
+
const eventMillis = options.date.getTime();
|
|
1673
|
+
const eventTime = (BigInt(eventMillis) * nanosPerMilli).toString();
|
|
1674
|
+
const attributes2 = {
|
|
1675
|
+
...options.fiber.getRef(CurrentLogAnnotations)
|
|
1676
|
+
};
|
|
1677
|
+
attributes2["effect.fiberId"] = options.fiber.id;
|
|
1643
1678
|
if (!opts.excludeLogSpans) {
|
|
1644
1679
|
for (const [label, startTime] of options.fiber.getRef(CurrentLogSpans)) {
|
|
1645
|
-
attributes2.
|
|
1646
|
-
key: `logSpan.${label}`,
|
|
1647
|
-
value: {
|
|
1648
|
-
stringValue: `${nowMillis - startTime}ms`
|
|
1649
|
-
}
|
|
1650
|
-
});
|
|
1680
|
+
attributes2[`effect.log_span.${label}`] = eventMillis - startTime;
|
|
1651
1681
|
}
|
|
1652
1682
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1683
|
+
const errors = prettyErrors(options.cause, {
|
|
1684
|
+
includeCauseInStack: true
|
|
1685
|
+
});
|
|
1686
|
+
if (errors.length > 0) {
|
|
1687
|
+
attributes2["exception.type"] = errors[0].name;
|
|
1688
|
+
attributes2["exception.message"] = errors[0].message;
|
|
1689
|
+
attributes2["exception.stacktrace"] = errors.map((error) => error.stack).join("\n");
|
|
1660
1690
|
}
|
|
1661
1691
|
const message = ensure(options.message);
|
|
1662
1692
|
const logRecord = {
|
|
1663
1693
|
severityNumber: logLevelToSeverityNumber(options.logLevel),
|
|
1664
1694
|
severityText: options.logLevel,
|
|
1665
|
-
timeUnixNano:
|
|
1666
|
-
observedTimeUnixNano:
|
|
1667
|
-
attributes: attributes2,
|
|
1695
|
+
timeUnixNano: eventTime,
|
|
1696
|
+
observedTimeUnixNano: observedTime,
|
|
1697
|
+
attributes: entriesToAttributes(Object.entries(attributes2)),
|
|
1668
1698
|
body: unknownToAttributeValue(message.length === 1 ? message[0] : message),
|
|
1669
1699
|
droppedAttributesCount: 0
|
|
1670
1700
|
};
|
|
1671
1701
|
if (options.fiber.cache.span) {
|
|
1672
|
-
logRecord.traceId = options.fiber.cache.span.traceId;
|
|
1702
|
+
logRecord.traceId = options.fiber.cache.span.traceId.padStart(32, "0");
|
|
1673
1703
|
logRecord.spanId = options.fiber.cache.span.spanId;
|
|
1674
1704
|
}
|
|
1675
1705
|
return logRecord;
|
|
@@ -1721,14 +1751,14 @@ var ESeverityNumber = {
|
|
|
1721
1751
|
SEVERITY_NUMBER_FATAL4: 24
|
|
1722
1752
|
};
|
|
1723
1753
|
|
|
1724
|
-
// ../../node_modules/.bun/effect@4.
|
|
1754
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpMetrics.js
|
|
1725
1755
|
var OtlpMetrics_exports = {};
|
|
1726
1756
|
__export(OtlpMetrics_exports, {
|
|
1727
1757
|
layer: () => layer3,
|
|
1728
1758
|
layerFromConfig: () => layerFromConfig2,
|
|
1729
|
-
make: () =>
|
|
1759
|
+
make: () => make8
|
|
1730
1760
|
});
|
|
1731
|
-
var
|
|
1761
|
+
var make8 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
1732
1762
|
const clock = yield* Clock;
|
|
1733
1763
|
const serialization = yield* OtlpSerialization;
|
|
1734
1764
|
const startTimeNanos = yield* clock.currentTimeNanos;
|
|
@@ -1743,7 +1773,6 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1743
1773
|
let previousCounterState = /* @__PURE__ */ new Map();
|
|
1744
1774
|
let previousHistogramState = /* @__PURE__ */ new Map();
|
|
1745
1775
|
let previousFrequencyState = /* @__PURE__ */ new Map();
|
|
1746
|
-
let previousSummaryState = /* @__PURE__ */ new Map();
|
|
1747
1776
|
let snapshotSequence = 0;
|
|
1748
1777
|
let committedSnapshotSequence = -1;
|
|
1749
1778
|
const snapshot = () => {
|
|
@@ -1751,10 +1780,9 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1751
1780
|
const currentSnapshotSequence = snapshotSequence++;
|
|
1752
1781
|
const nowNanos = clock.currentTimeNanosUnsafe();
|
|
1753
1782
|
const nowTime = String(nowNanos);
|
|
1754
|
-
const nextCounterState = new Map(
|
|
1755
|
-
const nextHistogramState = new Map(
|
|
1756
|
-
const nextFrequencyState = new Map(
|
|
1757
|
-
const nextSummaryState = new Map(previousSummaryState);
|
|
1783
|
+
const nextCounterState = /* @__PURE__ */ new Map();
|
|
1784
|
+
const nextHistogramState = /* @__PURE__ */ new Map();
|
|
1785
|
+
const nextFrequencyState = /* @__PURE__ */ new Map();
|
|
1758
1786
|
const metricData = [];
|
|
1759
1787
|
const metricDataByName = /* @__PURE__ */ new Map();
|
|
1760
1788
|
const addMetricData = (data) => {
|
|
@@ -1766,7 +1794,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1766
1794
|
const intervalStartTime = isDelta ? String(previousExportTimeNanos) : startTime;
|
|
1767
1795
|
for (let i = 0, len = snapshot2.length; i < len; i++) {
|
|
1768
1796
|
const state = snapshot2[i];
|
|
1769
|
-
const unit = state.attributes?.unit ?? state.attributes?.time_unit
|
|
1797
|
+
const unit = toUcumUnit(state.attributes?.unit ?? state.attributes?.time_unit);
|
|
1770
1798
|
const attributes2 = state.attributes ? entriesToAttributes(Object.entries(state.attributes)) : [];
|
|
1771
1799
|
const metricKey = makeMetricKey(state.id, state.attributes);
|
|
1772
1800
|
switch (state.type) {
|
|
@@ -1798,7 +1826,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1798
1826
|
timeUnixNano: nowTime
|
|
1799
1827
|
};
|
|
1800
1828
|
if (typeof reportValue === "bigint") {
|
|
1801
|
-
dataPoint.asInt =
|
|
1829
|
+
dataPoint.asInt = bigintToInt64(reportValue);
|
|
1802
1830
|
} else {
|
|
1803
1831
|
dataPoint.asDouble = reportValue;
|
|
1804
1832
|
}
|
|
@@ -1825,7 +1853,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1825
1853
|
timeUnixNano: nowTime
|
|
1826
1854
|
};
|
|
1827
1855
|
if (typeof state.state.value === "bigint") {
|
|
1828
|
-
dataPoint.asInt =
|
|
1856
|
+
dataPoint.asInt = bigintToInt64(state.state.value);
|
|
1829
1857
|
} else {
|
|
1830
1858
|
dataPoint.asDouble = state.state.value;
|
|
1831
1859
|
}
|
|
@@ -1844,39 +1872,34 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1844
1872
|
break;
|
|
1845
1873
|
}
|
|
1846
1874
|
case "Histogram": {
|
|
1847
|
-
const size = state.state.buckets.length;
|
|
1848
1875
|
const currentBuckets = {
|
|
1849
|
-
boundaries:
|
|
1850
|
-
counts:
|
|
1876
|
+
boundaries: [],
|
|
1877
|
+
counts: []
|
|
1851
1878
|
};
|
|
1852
|
-
let idx = 0;
|
|
1853
1879
|
let prev = 0;
|
|
1854
1880
|
for (const [boundary, value] of state.state.buckets) {
|
|
1855
|
-
if (
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
currentBuckets.counts[idx] = value - prev;
|
|
1881
|
+
if (boundary === Number.POSITIVE_INFINITY) break;
|
|
1882
|
+
currentBuckets.boundaries.push(boundary);
|
|
1883
|
+
currentBuckets.counts.push(value - prev);
|
|
1859
1884
|
prev = value;
|
|
1860
|
-
idx++;
|
|
1861
1885
|
}
|
|
1886
|
+
currentBuckets.counts.push(state.state.count - prev);
|
|
1862
1887
|
let reportCount = state.state.count;
|
|
1863
1888
|
let reportSum = state.state.sum;
|
|
1864
1889
|
let reportBucketCounts = currentBuckets.counts;
|
|
1865
|
-
|
|
1866
|
-
const reportMax = state.state.max;
|
|
1890
|
+
let reportExtrema = true;
|
|
1867
1891
|
if (isDelta) {
|
|
1868
1892
|
const previousState = previousHistogramState.get(metricKey);
|
|
1869
1893
|
if (previousState !== void 0) {
|
|
1870
1894
|
reportCount = state.state.count - previousState.count;
|
|
1871
1895
|
reportSum = state.state.sum - previousState.sum;
|
|
1872
1896
|
reportBucketCounts = currentBuckets.counts.map((c, i2) => Math.max(0, c - (previousState.bucketCounts[i2] ?? 0)));
|
|
1897
|
+
reportExtrema = false;
|
|
1873
1898
|
}
|
|
1874
1899
|
nextHistogramState.set(metricKey, {
|
|
1875
1900
|
count: state.state.count,
|
|
1876
1901
|
sum: state.state.sum,
|
|
1877
|
-
bucketCounts: currentBuckets.counts.slice()
|
|
1878
|
-
min: state.state.min,
|
|
1879
|
-
max: state.state.max
|
|
1902
|
+
bucketCounts: currentBuckets.counts.slice()
|
|
1880
1903
|
});
|
|
1881
1904
|
}
|
|
1882
1905
|
const dataPoint = {
|
|
@@ -1884,8 +1907,10 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1884
1907
|
startTimeUnixNano: intervalStartTime,
|
|
1885
1908
|
timeUnixNano: nowTime,
|
|
1886
1909
|
count: reportCount,
|
|
1887
|
-
|
|
1888
|
-
|
|
1910
|
+
...reportExtrema ? {
|
|
1911
|
+
min: state.state.min,
|
|
1912
|
+
max: state.state.max
|
|
1913
|
+
} : void 0,
|
|
1889
1914
|
sum: reportSum,
|
|
1890
1915
|
bucketCounts: reportBucketCounts,
|
|
1891
1916
|
explicitBounds: currentBuckets.boundaries
|
|
@@ -1950,99 +1975,26 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
1950
1975
|
break;
|
|
1951
1976
|
}
|
|
1952
1977
|
case "Summary": {
|
|
1953
|
-
const
|
|
1954
|
-
attributes: [...attributes2, {
|
|
1955
|
-
key: "quantile",
|
|
1956
|
-
value: {
|
|
1957
|
-
stringValue: "min"
|
|
1958
|
-
}
|
|
1959
|
-
}],
|
|
1960
|
-
startTimeUnixNano: intervalStartTime,
|
|
1961
|
-
timeUnixNano: nowTime,
|
|
1962
|
-
asDouble: state.state.min
|
|
1963
|
-
}];
|
|
1964
|
-
for (const [quantile, value] of state.state.quantiles) {
|
|
1965
|
-
dataPoints.push({
|
|
1966
|
-
attributes: [...attributes2, {
|
|
1967
|
-
key: "quantile",
|
|
1968
|
-
value: {
|
|
1969
|
-
stringValue: quantile.toString()
|
|
1970
|
-
}
|
|
1971
|
-
}],
|
|
1972
|
-
startTimeUnixNano: intervalStartTime,
|
|
1973
|
-
timeUnixNano: nowTime,
|
|
1974
|
-
asDouble: value ?? 0
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
dataPoints.push({
|
|
1978
|
-
attributes: [...attributes2, {
|
|
1979
|
-
key: "quantile",
|
|
1980
|
-
value: {
|
|
1981
|
-
stringValue: "max"
|
|
1982
|
-
}
|
|
1983
|
-
}],
|
|
1984
|
-
startTimeUnixNano: intervalStartTime,
|
|
1985
|
-
timeUnixNano: nowTime,
|
|
1986
|
-
asDouble: state.state.max
|
|
1987
|
-
});
|
|
1988
|
-
let reportCount = state.state.count;
|
|
1989
|
-
let reportSum = state.state.sum;
|
|
1990
|
-
if (isDelta) {
|
|
1991
|
-
const previousState = previousSummaryState.get(metricKey);
|
|
1992
|
-
if (previousState !== void 0) {
|
|
1993
|
-
reportCount = state.state.count - previousState.count;
|
|
1994
|
-
reportSum = state.state.sum - previousState.sum;
|
|
1995
|
-
}
|
|
1996
|
-
nextSummaryState.set(metricKey, {
|
|
1997
|
-
count: state.state.count,
|
|
1998
|
-
sum: state.state.sum
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
const countDataPoint = {
|
|
2002
|
-
attributes: attributes2,
|
|
2003
|
-
startTimeUnixNano: intervalStartTime,
|
|
2004
|
-
timeUnixNano: nowTime,
|
|
2005
|
-
asInt: reportCount
|
|
2006
|
-
};
|
|
2007
|
-
const sumDataPoint = {
|
|
1978
|
+
const dataPoint = {
|
|
2008
1979
|
attributes: attributes2,
|
|
2009
|
-
startTimeUnixNano:
|
|
1980
|
+
startTimeUnixNano: startTime,
|
|
2010
1981
|
timeUnixNano: nowTime,
|
|
2011
|
-
|
|
1982
|
+
count: state.state.count,
|
|
1983
|
+
sum: state.state.sum,
|
|
1984
|
+
quantileValues: state.state.quantiles.flatMap(([quantile, value]) => value === void 0 ? [] : [{
|
|
1985
|
+
quantile,
|
|
1986
|
+
value
|
|
1987
|
+
}])
|
|
2012
1988
|
};
|
|
2013
|
-
if (metricDataByName.has(
|
|
2014
|
-
metricDataByName.get(
|
|
2015
|
-
metricDataByName.get(`${state.id}_count`).sum.dataPoints.push(countDataPoint);
|
|
2016
|
-
metricDataByName.get(`${state.id}_sum`).sum.dataPoints.push(sumDataPoint);
|
|
1989
|
+
if (metricDataByName.has(state.id)) {
|
|
1990
|
+
metricDataByName.get(state.id).summary.dataPoints.push(dataPoint);
|
|
2017
1991
|
} else {
|
|
2018
1992
|
addMetricData({
|
|
2019
|
-
name:
|
|
1993
|
+
name: state.id,
|
|
2020
1994
|
description: state.description,
|
|
2021
1995
|
unit,
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
isMonotonic: false,
|
|
2025
|
-
dataPoints
|
|
2026
|
-
}
|
|
2027
|
-
});
|
|
2028
|
-
addMetricData({
|
|
2029
|
-
name: `${state.id}_count`,
|
|
2030
|
-
description: state.description,
|
|
2031
|
-
unit: "1",
|
|
2032
|
-
sum: {
|
|
2033
|
-
aggregationTemporality: aggregationTemporalityEnum,
|
|
2034
|
-
isMonotonic: true,
|
|
2035
|
-
dataPoints: [countDataPoint]
|
|
2036
|
-
}
|
|
2037
|
-
});
|
|
2038
|
-
addMetricData({
|
|
2039
|
-
name: `${state.id}_sum`,
|
|
2040
|
-
description: state.description,
|
|
2041
|
-
unit: "1",
|
|
2042
|
-
sum: {
|
|
2043
|
-
aggregationTemporality: aggregationTemporalityEnum,
|
|
2044
|
-
isMonotonic: true,
|
|
2045
|
-
dataPoints: [sumDataPoint]
|
|
1996
|
+
summary: {
|
|
1997
|
+
dataPoints: [dataPoint]
|
|
2046
1998
|
}
|
|
2047
1999
|
});
|
|
2048
2000
|
}
|
|
@@ -2064,16 +2016,16 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
2064
2016
|
previousCounterState = nextCounterState;
|
|
2065
2017
|
previousHistogramState = nextHistogramState;
|
|
2066
2018
|
previousFrequencyState = nextFrequencyState;
|
|
2067
|
-
previousSummaryState = nextSummaryState;
|
|
2068
2019
|
previousExportTimeNanos = nowNanos;
|
|
2069
2020
|
committedSnapshotSequence = currentSnapshotSequence;
|
|
2070
2021
|
}) : void_;
|
|
2071
2022
|
return [body, onSuccess];
|
|
2072
2023
|
};
|
|
2073
|
-
yield*
|
|
2024
|
+
yield* make5({
|
|
2074
2025
|
label: "OtlpMetrics",
|
|
2075
2026
|
url: options.url,
|
|
2076
2027
|
headers: options.headers,
|
|
2028
|
+
compression: options.compression,
|
|
2077
2029
|
maxBatchSize: "disabled",
|
|
2078
2030
|
exportEmpty: true,
|
|
2079
2031
|
exportInterval: options.exportInterval ?? seconds(10),
|
|
@@ -2081,7 +2033,7 @@ var make7 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
2081
2033
|
shutdownTimeout: options.shutdownTimeout ?? seconds(3)
|
|
2082
2034
|
});
|
|
2083
2035
|
});
|
|
2084
|
-
var layer3 = (options) => effectDiscard(
|
|
2036
|
+
var layer3 = (options) => effectDiscard(make8(options)).pipe(provideMerge(layerFlusher));
|
|
2085
2037
|
var layerFromConfig2 = (options) => gen(function* () {
|
|
2086
2038
|
const {
|
|
2087
2039
|
disabled,
|
|
@@ -2096,12 +2048,16 @@ var layerFromConfig2 = (options) => gen(function* () {
|
|
|
2096
2048
|
return layerFlusher;
|
|
2097
2049
|
}
|
|
2098
2050
|
const {
|
|
2051
|
+
baseCompression,
|
|
2052
|
+
compression,
|
|
2099
2053
|
baseTimeout,
|
|
2100
2054
|
metricsTimeout,
|
|
2101
2055
|
exportTimeout,
|
|
2102
2056
|
exportInterval,
|
|
2103
2057
|
temporalityPreference
|
|
2104
2058
|
} = yield* all({
|
|
2059
|
+
baseCompression: option(Literals(["gzip", "none"], "OTEL_EXPORTER_OTLP_COMPRESSION")),
|
|
2060
|
+
compression: option(Literals(["gzip", "none"], "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION")),
|
|
2105
2061
|
baseTimeout: option(Int("OTEL_EXPORTER_OTLP_TIMEOUT")),
|
|
2106
2062
|
metricsTimeout: option(Int("OTEL_EXPORTER_OTLP_METRICS_TIMEOUT")),
|
|
2107
2063
|
exportTimeout: option(Int("OTEL_METRIC_EXPORT_TIMEOUT")),
|
|
@@ -2113,6 +2069,7 @@ var layerFromConfig2 = (options) => gen(function* () {
|
|
|
2113
2069
|
url: endpoint2.toString(),
|
|
2114
2070
|
resource: options?.resource,
|
|
2115
2071
|
headers: options?.headers ?? (yield* headers("METRICS")),
|
|
2072
|
+
compression: getOrElse(firstSomeOf([compression, baseCompression]), () => "none"),
|
|
2116
2073
|
exportInterval: getOrUndefined(exportInterval),
|
|
2117
2074
|
shutdownTimeout: getOrUndefined(shutdownTimeout),
|
|
2118
2075
|
temporality: getOrUndefined(temporalityPreference)
|
|
@@ -2125,6 +2082,9 @@ var makeMetricKey = (id, attributes2) => {
|
|
|
2125
2082
|
const sortedEntries = Object.entries(attributes2).sort((a, b) => a[0].localeCompare(b[0]));
|
|
2126
2083
|
return `${id}:${JSON.stringify(sortedEntries)}`;
|
|
2127
2084
|
};
|
|
2085
|
+
var ucumUnits = /* @__PURE__ */ new Map([["nanoseconds", "ns"], ["microseconds", "us"], ["milliseconds", "ms"], ["seconds", "s"], ["bytes", "By"]]);
|
|
2086
|
+
var toUcumUnit = (unit = "") => ucumUnits.get(unit) ?? unit;
|
|
2087
|
+
var bigintToInt64 = (value) => Number.isSafeInteger(Number(value)) ? Number(value) : value.toString();
|
|
2128
2088
|
var EAggregationTemporality = {
|
|
2129
2089
|
AGGREGATION_TEMPORALITY_UNSPECIFIED: 0,
|
|
2130
2090
|
/** DELTA is an AggregationTemporality for a metric aggregator which reports
|
|
@@ -2184,23 +2144,25 @@ var EAggregationTemporality = {
|
|
|
2184
2144
|
AGGREGATION_TEMPORALITY_CUMULATIVE: 2
|
|
2185
2145
|
};
|
|
2186
2146
|
|
|
2187
|
-
// ../../node_modules/.bun/effect@4.
|
|
2147
|
+
// ../../node_modules/.bun/effect@4.1.4/node_modules/effect/dist/observability/OtlpTracer.js
|
|
2188
2148
|
var OtlpTracer_exports = {};
|
|
2189
2149
|
__export(OtlpTracer_exports, {
|
|
2190
2150
|
layer: () => layer4,
|
|
2191
2151
|
layerFromConfig: () => layerFromConfig3,
|
|
2192
|
-
make: () =>
|
|
2152
|
+
make: () => make9
|
|
2193
2153
|
});
|
|
2194
|
-
var
|
|
2154
|
+
var make9 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
2195
2155
|
const otelResource = yield* fromConfig(options.resource);
|
|
2196
2156
|
const serialization = yield* OtlpSerialization;
|
|
2197
2157
|
const scope = {
|
|
2198
|
-
name:
|
|
2158
|
+
name: "effect",
|
|
2159
|
+
version: getCurrentVersion()
|
|
2199
2160
|
};
|
|
2200
|
-
const exporter = yield*
|
|
2161
|
+
const exporter = yield* make5({
|
|
2201
2162
|
label: "OtlpTracer",
|
|
2202
2163
|
url: options.url,
|
|
2203
2164
|
headers: options.headers,
|
|
2165
|
+
compression: options.compression,
|
|
2204
2166
|
exportInterval: options.exportInterval ?? seconds(5),
|
|
2205
2167
|
maxBatchSize: options.maxBatchSize ?? 1e3,
|
|
2206
2168
|
body(spans) {
|
|
@@ -2233,7 +2195,7 @@ var make8 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
2233
2195
|
} : void 0
|
|
2234
2196
|
});
|
|
2235
2197
|
});
|
|
2236
|
-
var layer4 = /* @__PURE__ */ flow(
|
|
2198
|
+
var layer4 = /* @__PURE__ */ flow(make9, /* @__PURE__ */ effect(Tracer), /* @__PURE__ */ provideMerge(layerFlusher));
|
|
2237
2199
|
var layerFromConfig3 = (options) => gen(function* () {
|
|
2238
2200
|
const {
|
|
2239
2201
|
disabled,
|
|
@@ -2248,12 +2210,16 @@ var layerFromConfig3 = (options) => gen(function* () {
|
|
|
2248
2210
|
return layerFlusher;
|
|
2249
2211
|
}
|
|
2250
2212
|
const {
|
|
2213
|
+
baseCompression,
|
|
2214
|
+
compression,
|
|
2251
2215
|
baseTimeout,
|
|
2252
2216
|
tracesTimeout,
|
|
2253
2217
|
exportTimeout,
|
|
2254
2218
|
scheduleDelay,
|
|
2255
2219
|
maxBatchSize
|
|
2256
2220
|
} = yield* all({
|
|
2221
|
+
baseCompression: option(Literals(["gzip", "none"], "OTEL_EXPORTER_OTLP_COMPRESSION")),
|
|
2222
|
+
compression: option(Literals(["gzip", "none"], "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION")),
|
|
2257
2223
|
baseTimeout: option(Int("OTEL_EXPORTER_OTLP_TIMEOUT")),
|
|
2258
2224
|
tracesTimeout: option(Int("OTEL_EXPORTER_OTLP_TRACES_TIMEOUT")),
|
|
2259
2225
|
exportTimeout: option(Int("OTEL_BSP_EXPORT_TIMEOUT")),
|
|
@@ -2265,6 +2231,7 @@ var layerFromConfig3 = (options) => gen(function* () {
|
|
|
2265
2231
|
url: endpoint2.toString(),
|
|
2266
2232
|
resource: options?.resource,
|
|
2267
2233
|
headers: options?.headers ?? (yield* headers("TRACES")),
|
|
2234
|
+
compression: getOrElse(firstSomeOf([compression, baseCompression]), () => "none"),
|
|
2268
2235
|
exportInterval: getOrUndefined(scheduleDelay),
|
|
2269
2236
|
maxBatchSize: getOrUndefined(maxBatchSize),
|
|
2270
2237
|
context: options?.context,
|
|
@@ -2311,6 +2278,7 @@ var SpanImpl = class {
|
|
|
2311
2278
|
return this._events ??= [];
|
|
2312
2279
|
}
|
|
2313
2280
|
end(endTime, exit) {
|
|
2281
|
+
if (this.status._tag === "Ended") return;
|
|
2314
2282
|
this.status = {
|
|
2315
2283
|
_tag: "Ended",
|
|
2316
2284
|
startTime: this.status.startTime,
|
|
@@ -2320,12 +2288,15 @@ var SpanImpl = class {
|
|
|
2320
2288
|
this.export(this);
|
|
2321
2289
|
}
|
|
2322
2290
|
attribute(key, value) {
|
|
2291
|
+
if (this.status._tag === "Ended") return;
|
|
2323
2292
|
this.attributes.set(key, value);
|
|
2324
2293
|
}
|
|
2325
2294
|
event(name, startTime, attributes2) {
|
|
2295
|
+
if (this.status._tag === "Ended") return;
|
|
2326
2296
|
this.events.push([name, startTime, attributes2]);
|
|
2327
2297
|
}
|
|
2328
2298
|
addLinks(links) {
|
|
2299
|
+
if (this.status._tag === "Ended") return;
|
|
2329
2300
|
this.links.push(...links);
|
|
2330
2301
|
}
|
|
2331
2302
|
};
|
|
@@ -2347,20 +2318,14 @@ var makeOtlpSpan = (self) => {
|
|
|
2347
2318
|
let otelStatus;
|
|
2348
2319
|
if (status2.exit._tag === "Success") {
|
|
2349
2320
|
otelStatus = {
|
|
2350
|
-
code: StatusCode.
|
|
2321
|
+
code: StatusCode.Unset
|
|
2351
2322
|
};
|
|
2352
2323
|
} else if (hasInterruptsOnly(status2.exit.cause)) {
|
|
2353
2324
|
otelStatus = {
|
|
2354
|
-
code: StatusCode.
|
|
2355
|
-
message: "Interrupted"
|
|
2325
|
+
code: StatusCode.Unset
|
|
2356
2326
|
};
|
|
2357
2327
|
attributes2.push({
|
|
2358
|
-
key: "
|
|
2359
|
-
value: {
|
|
2360
|
-
stringValue: "\u26A0\uFE0E Interrupted"
|
|
2361
|
-
}
|
|
2362
|
-
}, {
|
|
2363
|
-
key: "status.interrupted",
|
|
2328
|
+
key: "effect.fiber.interrupted",
|
|
2364
2329
|
value: {
|
|
2365
2330
|
boolValue: true
|
|
2366
2331
|
}
|
|
@@ -2369,48 +2334,48 @@ var makeOtlpSpan = (self) => {
|
|
|
2369
2334
|
const errors = prettyErrors(status2.exit.cause, {
|
|
2370
2335
|
includeCauseInStack: true
|
|
2371
2336
|
});
|
|
2372
|
-
otelStatus = {
|
|
2373
|
-
code: StatusCode.Error
|
|
2337
|
+
otelStatus = errors.length > 0 ? {
|
|
2338
|
+
code: StatusCode.Error,
|
|
2339
|
+
message: errors[0].message
|
|
2340
|
+
} : {
|
|
2341
|
+
code: StatusCode.Unset
|
|
2374
2342
|
};
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
"
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
"
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
"
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
}]
|
|
2398
|
-
});
|
|
2399
|
-
}
|
|
2343
|
+
for (const error of errors) {
|
|
2344
|
+
events.push({
|
|
2345
|
+
name: "exception",
|
|
2346
|
+
timeUnixNano: String(status2.endTime),
|
|
2347
|
+
droppedAttributesCount: 0,
|
|
2348
|
+
attributes: [{
|
|
2349
|
+
"key": "exception.type",
|
|
2350
|
+
"value": {
|
|
2351
|
+
"stringValue": error.name
|
|
2352
|
+
}
|
|
2353
|
+
}, {
|
|
2354
|
+
"key": "exception.message",
|
|
2355
|
+
"value": {
|
|
2356
|
+
"stringValue": error.message
|
|
2357
|
+
}
|
|
2358
|
+
}, {
|
|
2359
|
+
"key": "exception.stacktrace",
|
|
2360
|
+
"value": {
|
|
2361
|
+
"stringValue": error.stack ?? "No stack trace available"
|
|
2362
|
+
}
|
|
2363
|
+
}]
|
|
2364
|
+
});
|
|
2400
2365
|
}
|
|
2401
2366
|
}
|
|
2402
2367
|
const links = [];
|
|
2403
2368
|
for (let i = 0; i < self.links.length; i++) {
|
|
2404
2369
|
const link = self.links[i];
|
|
2405
2370
|
links.push({
|
|
2406
|
-
traceId: link.span.traceId,
|
|
2371
|
+
traceId: link.span.traceId.padStart(32, "0"),
|
|
2407
2372
|
spanId: link.span.spanId,
|
|
2408
2373
|
attributes: entriesToAttributes(Object.entries(link.attributes)),
|
|
2409
2374
|
droppedAttributesCount: 0
|
|
2410
2375
|
});
|
|
2411
2376
|
}
|
|
2412
2377
|
return {
|
|
2413
|
-
traceId: self.traceId,
|
|
2378
|
+
traceId: self.traceId.padStart(32, "0"),
|
|
2414
2379
|
spanId: self.spanId,
|
|
2415
2380
|
parentSpanId: isSome(self.parent) ? self.parent.value.spanId : void 0,
|
|
2416
2381
|
name: self.name,
|
|
@@ -2451,7 +2416,9 @@ var telemetryLayer = (config, lifetime = "process", logger = Logger_exports.with
|
|
|
2451
2416
|
url: target.url,
|
|
2452
2417
|
resource,
|
|
2453
2418
|
...target.headers === void 0 ? {} : { headers: Redacted_exports.value(target.headers) },
|
|
2454
|
-
|
|
2419
|
+
// An event exports when its scope closes. With no interval the exporter runs no loop, so a
|
|
2420
|
+
// span or log recorded from another event never resumes a fiber of this one.
|
|
2421
|
+
exportInterval: lifetime === "event" ? Duration_exports.infinity : "1 second",
|
|
2455
2422
|
shutdownTimeout: shutdownTimeouts[name] ?? "3 seconds"
|
|
2456
2423
|
});
|
|
2457
2424
|
const console = Logger_exports.layer([logger]);
|
|
@@ -2666,20 +2633,27 @@ var failureCodes = /* @__PURE__ */ new Set([
|
|
|
2666
2633
|
"cache",
|
|
2667
2634
|
"integrity"
|
|
2668
2635
|
]);
|
|
2669
|
-
var
|
|
2636
|
+
var text2 = (value) => typeof value["stringValue"] === "string" ? value["stringValue"] : void 0;
|
|
2670
2637
|
var integer = (value) => {
|
|
2671
2638
|
const raw = value["intValue"];
|
|
2672
2639
|
const number = typeof raw === "string" && /^-?\d{1,15}$/.test(raw) ? Number(raw) : raw;
|
|
2673
2640
|
return typeof number === "number" && Number.isSafeInteger(number) ? number : void 0;
|
|
2674
2641
|
};
|
|
2675
2642
|
var oneOf = (...values) => (value) => {
|
|
2676
|
-
const found =
|
|
2643
|
+
const found = text2(value);
|
|
2677
2644
|
return found !== void 0 && values.includes(found) ? { stringValue: found } : void 0;
|
|
2678
2645
|
};
|
|
2679
2646
|
var classified = (known) => (value) => {
|
|
2680
|
-
const found =
|
|
2647
|
+
const found = text2(value);
|
|
2681
2648
|
return found === void 0 ? void 0 : { stringValue: known.has(found) ? found : unrecognized };
|
|
2682
2649
|
};
|
|
2650
|
+
var errorType = (value) => {
|
|
2651
|
+
const found = text2(value);
|
|
2652
|
+
if (found === void 0) return void 0;
|
|
2653
|
+
return {
|
|
2654
|
+
stringValue: errorKinds.has(found) || /^[45]\d\d$/u.test(found) ? found : unrecognized
|
|
2655
|
+
};
|
|
2656
|
+
};
|
|
2683
2657
|
var flag = (value) => typeof value["boolValue"] === "boolean" ? { boolValue: value["boolValue"] } : void 0;
|
|
2684
2658
|
var count = (value) => {
|
|
2685
2659
|
const found = integer(value);
|
|
@@ -2700,7 +2674,7 @@ var spanAttributes2 = {
|
|
|
2700
2674
|
"executor.trace.parent_sampled": flag,
|
|
2701
2675
|
"executor.failure.source": oneOf("app", "storage", "service"),
|
|
2702
2676
|
"executor.failure.code": classified(failureCodes),
|
|
2703
|
-
"error.type":
|
|
2677
|
+
"error.type": errorType,
|
|
2704
2678
|
"cache.operation": oneOf(
|
|
2705
2679
|
"read",
|
|
2706
2680
|
"acquire",
|
|
@@ -2729,6 +2703,9 @@ var spanAttributes2 = {
|
|
|
2729
2703
|
"http.request.method": oneOf(...httpMethods),
|
|
2730
2704
|
"http.response.status_code": status,
|
|
2731
2705
|
"url.scheme": oneOf("http", "https"),
|
|
2706
|
+
// Effect 4.1 marks an interrupted span with `effect.fiber.interrupted`; apps built on an
|
|
2707
|
+
// earlier Effect still send the label and `status.interrupted`.
|
|
2708
|
+
"effect.fiber.interrupted": flag,
|
|
2732
2709
|
"span.label": oneOf("\u26A0\uFE0E Interrupted"),
|
|
2733
2710
|
"status.interrupted": flag,
|
|
2734
2711
|
"executor.milestone.reached": flag,
|
|
@@ -2779,7 +2756,7 @@ var exception = (event) => {
|
|
|
2779
2756
|
const named = (Array.isArray(event["attributes"]) ? event["attributes"] : []).find(
|
|
2780
2757
|
(attribute) => isObject(attribute) && attribute["key"] === "exception.type"
|
|
2781
2758
|
);
|
|
2782
|
-
const type = isObject(named) && isObject(named["value"]) ?
|
|
2759
|
+
const type = isObject(named) && isObject(named["value"]) ? text2(named["value"]) : void 0;
|
|
2783
2760
|
const recorded2 = type !== void 0 && errorKinds.has(type) ? type : unrecognized;
|
|
2784
2761
|
const time = nanos(event["timeUnixNano"]);
|
|
2785
2762
|
return {
|
|
@@ -2820,7 +2797,7 @@ var appLog = (log) => {
|
|
|
2820
2797
|
const observed = nanos(log["observedTimeUnixNano"]);
|
|
2821
2798
|
const severity = between(log["severityNumber"], 1, 24);
|
|
2822
2799
|
const level = log["severityText"];
|
|
2823
|
-
const body = isObject(log["body"]) ?
|
|
2800
|
+
const body = isObject(log["body"]) ? text2(log["body"]) : void 0;
|
|
2824
2801
|
return {
|
|
2825
2802
|
...log.traceId === void 0 ? {} : { traceId: log.traceId },
|
|
2826
2803
|
...log.spanId === void 0 ? {} : { spanId: log.spanId },
|