apps 0.0.1-beta.142 → 0.0.1-beta.144
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/check-publish.mjs +0 -1
- package/framework-reference.json +1 -1
- package/js/{chunk-I6QAWNUM.js → chunk-2OGVSUNI.js} +2 -2
- package/js/{chunk-RIOLCZAV.js → chunk-455CCO6Q.js} +9 -17
- package/js/{chunk-W2C3IOZJ.js → chunk-5MEOL2SG.js} +32 -29
- package/js/{chunk-PQKQIH3T.js → chunk-6NRWFVK2.js} +10 -31
- package/js/{chunk-WZ36P57R.js → chunk-6OWHQINS.js} +11 -16
- package/js/{chunk-LSOHA2RH.js → chunk-6XBOKQ4E.js} +1 -1
- package/js/{chunk-H2K7OZ47.js → chunk-7A4ZSEM3.js} +1 -1
- package/js/{chunk-QTX7OUFH.js → chunk-A6FRLRCN.js} +2 -3
- package/js/{chunk-ZQVWMEH6.js → chunk-AFEMXP3F.js} +6 -7
- package/js/{chunk-Z5O7ON6S.js → chunk-B2PSDMZP.js} +2 -2
- package/js/{chunk-Q7PE4PLU.js → chunk-B4JN2A6F.js} +3 -3
- package/js/{chunk-VX36SA7Y.js → chunk-BHSWVS3Q.js} +1 -1
- package/js/{chunk-APPCHQHK.js → chunk-BU3UOD2T.js} +4 -4
- package/js/{chunk-HMYAZUNZ.js → chunk-EXL6F456.js} +6 -4
- package/js/{chunk-6QZVXLF2.js → chunk-INQON4A2.js} +2 -2
- package/js/{chunk-MB6L5YZE.js → chunk-IWLFLMIL.js} +1 -1
- package/js/{chunk-EKXBHVMR.js → chunk-JLHRRTRH.js} +8 -15
- package/js/{chunk-YFSOSNF3.js → chunk-NXEGROI6.js} +116 -116
- package/js/{chunk-ICIVU5SQ.js → chunk-OFSXKKD6.js} +27 -42
- package/js/{chunk-63DHI5Y4.js → chunk-QDF7PQAD.js} +6 -8
- package/js/{chunk-YVN2AMAU.js → chunk-QLUWYCOT.js} +2 -2
- package/js/{chunk-JH3MOQZR.js → chunk-T4MICYGT.js} +10 -51
- package/js/{chunk-OBT33ZDK.js → chunk-TMYRAFMC.js} +3 -3
- package/js/{chunk-2XDCAXAR.js → chunk-W6V5OIHB.js} +1 -1
- package/js/{chunk-34RH47V5.js → chunk-XR7KZNKD.js} +2 -2
- package/js/client.js +10 -15
- package/js/contracts.js +9 -7
- package/js/effect.js +18 -18
- package/js/graphql.js +20 -22
- package/js/host.js +18 -20
- package/js/index.js +14 -19
- package/js/mcp/effect.js +19 -19
- package/js/mcp.js +21 -21
- package/js/openapi.js +18 -25
- package/js/react.js +2 -2
- package/js/skills/effect.js +6 -6
- package/js/skills.js +21 -27
- 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 +1 -1
- package/runtime.json +1 -1
- package/types/app-cache/src/index.d.ts +1 -40
- package/types/app-data/src/contracts/database.d.ts +0 -21
- package/types/apps/src/contracts/host.d.ts +6 -0
- package/types/telemetry/src/app-records.d.ts +0 -24
- package/types/telemetry/src/browser-operations.d.ts +0 -8
- package/types/telemetry/src/browser-performance.d.ts +0 -2
- package/types/telemetry/src/browser-request-timing.d.ts +0 -1
- package/types/telemetry/src/browser.d.ts +0 -10
- package/types/telemetry/src/config.d.ts +0 -8
- package/types/telemetry/src/context.d.ts +0 -6
- package/types/telemetry/src/index.d.ts +0 -1
- package/types/telemetry/src/keepalive.d.ts +0 -44
- package/types/telemetry/src/layer.d.ts +0 -8
- package/types/telemetry/src/measurements.d.ts +0 -8
- package/types/telemetry/src/ownership.d.ts +0 -45
- package/types/telemetry/src/pending-span.d.ts +0 -2
- package/types/telemetry/src/recorded-failure.d.ts +0 -26
- package/types/telemetry/src/relay.d.ts +0 -29
- package/types/telemetry/src/span-attributes.d.ts +0 -38
- package/types/telemetry/src/trace-context.d.ts +0 -6
- package/types/telemetry/src/transport.d.ts +0 -10
- package/types/utils/src/api-error.d.ts +0 -22
- package/types/utils/src/connection-failure.d.ts +0 -10
- package/types/utils/src/random-uuid.d.ts +0 -5
- package/types/utils/src/recorded-message.d.ts +0 -15
- package/types/utils/src/schema-definitions.d.ts +0 -6
- package/types/utils/src/user-facing-error.d.ts +0 -19
|
@@ -1,58 +1,28 @@
|
|
|
1
|
-
/** Portable Effect cache mechanics. Adapters own storage and the background task lifetime. */
|
|
2
1
|
import { Duration, Effect, Schema } from "effect";
|
|
3
2
|
import { CacheError, type CacheTransport } from "./contracts/cache.js";
|
|
4
3
|
export * from "./contracts/cache.js";
|
|
5
|
-
/** Hash key material before storage or transport; keys and credential scope never enter telemetry. */
|
|
6
4
|
export declare const cacheKey: (key: unknown) => Effect.Effect<string, CacheError, never>;
|
|
7
|
-
/** A cache hit is decoded with the caller's schema. Loader failures are never cached. */
|
|
8
5
|
export interface CacheGet<A> {
|
|
9
6
|
readonly key: Schema.Json;
|
|
10
7
|
readonly schema: Schema.Decoder<A>;
|
|
11
8
|
readonly freshFor: Duration.Input;
|
|
12
9
|
readonly staleFor?: Duration.Input;
|
|
13
|
-
/**
|
|
14
|
-
* What a read does with a value past `freshFor` and within `staleFor`. `serve`, the default,
|
|
15
|
-
* returns it while one background load replaces it. `revalidate` awaits that load first, like a
|
|
16
|
-
* miss; the value stays readable to the load, which can confirm it instead of rebuilding it.
|
|
17
|
-
*/
|
|
18
10
|
readonly stale?: "serve" | "revalidate";
|
|
19
11
|
readonly load: Effect.Effect<A, unknown>;
|
|
20
12
|
}
|
|
21
|
-
|
|
22
|
-
export declare const makeCache: (host: CacheTransport, background: (task: Effect.Effect<void, unknown>) => Effect.Effect<void>, scope?: Schema.Json,
|
|
23
|
-
/** The caller's own deadline, when the host supplies one. Waiting never runs past it. */
|
|
24
|
-
deadline?: number,
|
|
25
|
-
/**
|
|
26
|
-
* Wraps the time this caller waits on another caller's load of the same entry, polls included,
|
|
27
|
-
* so the host can trace it and count it as waiting rather than as its own work.
|
|
28
|
-
*/
|
|
29
|
-
leaseWait?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) => {
|
|
30
|
-
/** Read arbitrary retained JSON entries without initiating a refresh. Missing and null are distinct. */
|
|
13
|
+
export declare const makeCache: (host: CacheTransport, background: (task: Effect.Effect<void, unknown>) => Effect.Effect<void>, scope?: Schema.Json, deadline?: number, leaseWait?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) => {
|
|
31
14
|
read: (keys: readonly Schema.Json[]) => Effect.Effect<readonly ({
|
|
32
15
|
readonly value: Schema.Json;
|
|
33
16
|
readonly version: string;
|
|
34
17
|
readonly freshUntil: number;
|
|
35
18
|
readonly staleUntil: number;
|
|
36
19
|
} | null)[], CacheError, never>;
|
|
37
|
-
/** Publish bounded immutable parts before publishing the manifest that references them. */
|
|
38
20
|
write: (entries: readonly {
|
|
39
21
|
readonly key: Schema.Json;
|
|
40
22
|
readonly value: Schema.Json;
|
|
41
23
|
}[], retention: Duration.Input) => Effect.Effect<void, CacheError, never>;
|
|
42
|
-
/** Revoke retained data and any loader's right to publish its in-flight result. */
|
|
43
24
|
invalidate: (key: Schema.Json) => Effect.Effect<void, CacheError, never>;
|
|
44
|
-
/**
|
|
45
|
-
* Read fresh data, refresh stale data in the background (or first, with `stale: "revalidate"`),
|
|
46
|
-
* or wait for the lease owner.
|
|
47
|
-
*/
|
|
48
25
|
get: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
|
|
49
|
-
/**
|
|
50
|
-
* `get`, also reading the keys of this scope that `keys` names in the same round trip. `keys`
|
|
51
|
-
* gets the entry's store key, which is unique to this scope and key, so a caller can remember
|
|
52
|
-
* what it read under it. `reads` holds their entries, undecoded and in order, when the value
|
|
53
|
-
* was read from the store; it is undefined when the value was loaded or the store did not read
|
|
54
|
-
* them, and the caller then reads what it still needs.
|
|
55
|
-
*/
|
|
56
26
|
getWith: <A>(options: CacheGet<A>, keys: (key: string) => readonly Schema.Json[]) => Effect.Effect<{
|
|
57
27
|
value: A;
|
|
58
28
|
key: string;
|
|
@@ -63,17 +33,9 @@ leaseWait?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>)
|
|
|
63
33
|
readonly staleUntil: number;
|
|
64
34
|
} | null)[] | undefined;
|
|
65
35
|
}, unknown, never>;
|
|
66
|
-
/** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
|
|
67
36
|
revalidate: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
|
|
68
37
|
};
|
|
69
|
-
/**
|
|
70
|
-
* Host-side lease ownership for one app invocation. Leases the invocation claims are renewed while
|
|
71
|
-
* it runs, so a slow load keeps its key, and released when the host ends the invocation, including
|
|
72
|
-
* interrupted and cancelled ones and loads whose own release never arrived. A holder that stops
|
|
73
|
-
* running, or whose store channel stops answering, loses its lease within `leaseMs`.
|
|
74
|
-
*/
|
|
75
38
|
export declare const holdLeases: (transport: CacheTransport) => Effect.Effect<{
|
|
76
|
-
/** Use for every command of the invocation. Each command is bounded by `commandTimeoutMs`. */
|
|
77
39
|
transport: (input: {
|
|
78
40
|
readonly operation: "read";
|
|
79
41
|
readonly keys: readonly string[];
|
|
@@ -120,6 +82,5 @@ export declare const holdLeases: (transport: CacheTransport) => Effect.Effect<{
|
|
|
120
82
|
readonly operation: "invalidate";
|
|
121
83
|
readonly key: string;
|
|
122
84
|
}) => Effect.Effect<Schema.Json, CacheError, never>;
|
|
123
|
-
/** Stop renewing and release every lease the invocation still holds. */
|
|
124
85
|
close: Effect.Effect<void, never, never>;
|
|
125
86
|
}, never, never>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/** Portable, serialized app database declarations and operations. No product identity or database secrets cross this boundary. */
|
|
2
1
|
import { Schema, type Effect } from "effect";
|
|
3
|
-
/** Names have Lakebed's identifier shape and are always bound SQL values, never raw SQL. */
|
|
4
2
|
export declare const DataName: Schema.String;
|
|
5
|
-
/** Stored fields and index terms use finite scalar values; absent optional fields are represented by null in transport. */
|
|
6
3
|
export declare const Scalar: Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>;
|
|
7
4
|
export type Scalar = typeof Scalar.Type;
|
|
8
5
|
export declare const Field: Schema.Struct<{
|
|
@@ -42,7 +39,6 @@ export declare const DatabaseSchema: Schema.$Record<Schema.String, Schema.Struct
|
|
|
42
39
|
}>>;
|
|
43
40
|
}>>;
|
|
44
41
|
export type DatabaseSchema = typeof DatabaseSchema.Type;
|
|
45
|
-
/** The engine owns stable row identity and timestamps. */
|
|
46
42
|
export declare const Row: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
47
43
|
export type Row = typeof Row.Type;
|
|
48
44
|
export declare const RowMetadata: Schema.Struct<{
|
|
@@ -140,10 +136,8 @@ export type OperationResult = typeof OperationResult.Type;
|
|
|
140
136
|
declare const AppDatabaseError_base: Schema.Class<AppDatabaseError, Schema.TaggedStruct<"AppDatabaseError", {
|
|
141
137
|
readonly reason: Schema.Literals<readonly ["schema", "schema_changed", "table", "index", "range", "value", "readonly", "cursor", "limit", "closed", "storage", "replay"]>;
|
|
142
138
|
}>, import("effect/Cause").YieldableError>;
|
|
143
|
-
/** Safe expected failures, without supplied documents, SQL text, cursor payloads or credentials. */
|
|
144
139
|
export declare class AppDatabaseError extends AppDatabaseError_base {
|
|
145
140
|
}
|
|
146
|
-
/** Bounded work per authored operation. collect/count do not silently truncate. */
|
|
147
141
|
export declare const DatabaseLimits: Schema.Struct<{
|
|
148
142
|
readonly rowsRead: Schema.Int;
|
|
149
143
|
readonly rowsReturned: Schema.Int;
|
|
@@ -155,12 +149,7 @@ export declare const DatabaseLimits: Schema.Struct<{
|
|
|
155
149
|
readonly indexBytes: Schema.Int;
|
|
156
150
|
}>;
|
|
157
151
|
export type DatabaseLimits = typeof DatabaseLimits.Type;
|
|
158
|
-
/** Current per-invocation budgets, shared by every database adapter. */
|
|
159
152
|
export declare const defaultDatabaseLimits: DatabaseLimits;
|
|
160
|
-
/**
|
|
161
|
-
* The budget a query or mutation exhausted. `pageSize` bounds one take(n) or paginate call;
|
|
162
|
-
* `valueBytes` bounds one stored row; the rest accumulate across the whole invocation.
|
|
163
|
-
*/
|
|
164
153
|
export declare const DatabaseLimit: Schema.Literals<readonly ["scanCalls", "directGets", "rowsRead", "rowsReturned", "pageSize", "bytesRead", "writes", "valueBytes"]>;
|
|
165
154
|
export type DatabaseLimit = typeof DatabaseLimit.Type;
|
|
166
155
|
declare const DatabaseLimitExceeded_base: Schema.Class<DatabaseLimitExceeded, Schema.TaggedStruct<"DatabaseLimitExceeded", {
|
|
@@ -168,51 +157,41 @@ declare const DatabaseLimitExceeded_base: Schema.Class<DatabaseLimitExceeded, Sc
|
|
|
168
157
|
readonly maximum: Schema.Int;
|
|
169
158
|
readonly requested: Schema.Int;
|
|
170
159
|
}>, import("effect/Cause").YieldableError>;
|
|
171
|
-
/** A query or mutation exceeded one of its database budgets. Nothing it wrote is committed. */
|
|
172
160
|
export declare class DatabaseLimitExceeded extends DatabaseLimitExceeded_base {
|
|
173
161
|
get message(): string;
|
|
174
162
|
}
|
|
175
|
-
/** Host-owned row metadata that authored tables cannot declare. */
|
|
176
163
|
export declare const reservedFieldNames: readonly ["id", "createdAt", "updatedAt"];
|
|
177
164
|
declare const DatabaseFieldReserved_base: Schema.Class<DatabaseFieldReserved, Schema.TaggedStruct<"DatabaseFieldReserved", {
|
|
178
165
|
readonly table: Schema.String;
|
|
179
166
|
readonly field: Schema.Literals<readonly ["id", "createdAt", "updatedAt"]>;
|
|
180
167
|
}>, import("effect/Cause").YieldableError>;
|
|
181
|
-
/** A table declared a field the host adds to every row. */
|
|
182
168
|
export declare class DatabaseFieldReserved extends DatabaseFieldReserved_base {
|
|
183
169
|
get message(): string;
|
|
184
170
|
}
|
|
185
|
-
/** Failures a database session reports to authored code and its host. */
|
|
186
171
|
export type DatabaseError = AppDatabaseError | DatabaseLimitExceeded;
|
|
187
|
-
/** Host resource bounds outside an individual database transaction. Durations are milliseconds. */
|
|
188
172
|
export declare const DatabaseRuntimeLimits: Schema.Struct<{
|
|
189
173
|
readonly maxCursorChars: Schema.Int;
|
|
190
174
|
readonly connectionCacheCapacity: Schema.Int;
|
|
191
175
|
readonly connectionCacheTtlMs: Schema.Int;
|
|
192
176
|
}>;
|
|
193
177
|
export type DatabaseRuntimeLimits = typeof DatabaseRuntimeLimits.Type;
|
|
194
|
-
/** Cache eviction closes idle connections; it does not limit installed apps or expire their data. */
|
|
195
178
|
export declare const defaultDatabaseRuntimeLimits: {
|
|
196
179
|
readonly maxCursorChars: number;
|
|
197
180
|
readonly connectionCacheCapacity: number;
|
|
198
181
|
readonly connectionCacheTtlMs: number;
|
|
199
182
|
};
|
|
200
|
-
/** The host binds one database and read/write authority for the entire invocation. */
|
|
201
183
|
export interface DatabaseSession {
|
|
202
|
-
/** Host-only idempotency receipt, committed atomically with the mutation and validated result. */
|
|
203
184
|
readonly once: <E, R>(key: string, fingerprint: string, work: () => Effect.Effect<Schema.Json, E, R>) => Effect.Effect<Schema.Json, E | DatabaseError, R>;
|
|
204
185
|
readonly readTables: ReadonlySet<string>;
|
|
205
186
|
readonly changedTables: ReadonlySet<string>;
|
|
206
187
|
readonly execute: (operation: DatabaseOperation) => Effect.Effect<OperationResult, DatabaseError>;
|
|
207
188
|
}
|
|
208
|
-
/** Native operation scope owns snapshot consistency, write rollback and commit notifications. */
|
|
209
189
|
export interface AppDatabase {
|
|
210
190
|
readonly schema: DatabaseSchema;
|
|
211
191
|
readonly schemaHash: string;
|
|
212
192
|
readonly read: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
|
|
213
193
|
readonly mutate: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
|
|
214
194
|
}
|
|
215
|
-
/** Product-independent app partitions. A host supplies persistent storage; callers never choose filenames. */
|
|
216
195
|
export interface AppDatabases {
|
|
217
196
|
readonly read: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
|
|
218
197
|
readonly mutate: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
|
|
@@ -1567,6 +1567,12 @@ export declare const HostDataError: Schema.Union<readonly [typeof OpenapiRespons
|
|
|
1567
1567
|
export declare const ToolResultObservation: Context.Reference<{
|
|
1568
1568
|
readonly failed: () => void;
|
|
1569
1569
|
}>;
|
|
1570
|
+
/**
|
|
1571
|
+
* Runs work the invocation's reply does not wait for, such as ending an MCP session whose call
|
|
1572
|
+
* was answered. The host's runner keeps the invocation alive until that work has settled, and
|
|
1573
|
+
* cancels it with the invocation. Undefined where the host has no such runner: run it inline.
|
|
1574
|
+
*/
|
|
1575
|
+
export declare const AfterReply: Context.Reference<((work: Effect.Effect<void>) => Effect.Effect<void>) | undefined>;
|
|
1570
1576
|
/**
|
|
1571
1577
|
* One tool invocation's own timing, on the isolate's clock: how long it ran, and how much of that
|
|
1572
1578
|
* it waited on upstream providers, waited on elicitation answers and ran the app's authored code.
|
|
@@ -1,40 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What the host keeps of the spans and logs an app isolate returns.
|
|
3
|
-
*
|
|
4
|
-
* Those records come from whatever framework the app's build bundles, and the app's own code runs
|
|
5
|
-
* in the same isolate: it can throw any text, name its errors and codes, and rewrite every record
|
|
6
|
-
* before the isolate returns it. So the host does not filter the records it receives. It builds
|
|
7
|
-
* new ones from a closed vocabulary: the framework's span names, attributes whose values are
|
|
8
|
-
* closed sets, counts and status codes, and each exception's kind. Ids, parents and timings are
|
|
9
|
-
* kept. Everything else, including events other than exceptions, links, status and exception
|
|
10
|
-
* messages, stacks and log bodies, is dropped or replaced with a fixed sentence.
|
|
11
|
-
*
|
|
12
|
-
* The vocabulary is the framework's (`packages/apps`, `app-cache`, `app-data`): host request
|
|
13
|
-
* operations, failure sources and reasons, MCP and cache attributes. A name or value outside it is
|
|
14
|
-
* recorded as `unrecognized` or not at all. `bun run check` (`scripts/check-app-telemetry.ts`)
|
|
15
|
-
* fails when the framework names a span or sets an attribute key this vocabulary does not know.
|
|
16
|
-
*/
|
|
17
1
|
import type { Schema } from "effect";
|
|
18
2
|
type Json = Schema.Json;
|
|
19
3
|
type JsonObject = {
|
|
20
4
|
readonly [key: string]: Json;
|
|
21
5
|
};
|
|
22
|
-
/** What an exception message, stack or log body from an app isolate records instead. */
|
|
23
6
|
export declare const appText = "Text from the app is not recorded";
|
|
24
|
-
/** The framework's span names, and the libraries' spans it runs. */
|
|
25
7
|
export declare const appSpanNames: ReadonlySet<string>;
|
|
26
8
|
export declare const appSpanAttributeKeys: ReadonlySet<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Attributes the framework sets whose values the app chooses, such as its tool names, so the host
|
|
29
|
-
* drops them. `scripts/check-app-telemetry.ts` fails on a framework attribute in neither set.
|
|
30
|
-
*/
|
|
31
9
|
export declare const droppedAppAttributeKeys: ReadonlySet<string>;
|
|
32
|
-
/** The span the host records for one an app isolate returned, or nothing without its timings. */
|
|
33
10
|
export declare const appSpan: (span: JsonObject & {
|
|
34
11
|
readonly traceId: string;
|
|
35
12
|
readonly spanId: string;
|
|
36
13
|
}) => JsonObject | undefined;
|
|
37
|
-
/** The log record the host records for one an app isolate returned. */
|
|
38
14
|
export declare const appLog: (log: JsonObject & {
|
|
39
15
|
readonly traceId?: string | undefined;
|
|
40
16
|
readonly spanId?: string | undefined;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
/** Correlate transport and decoded outcomes without exporting response bodies or errors. */
|
|
2
1
|
import { Effect, Schema, Tracer } from "effect";
|
|
3
2
|
import { HttpClient, HttpClientError } from "effect/http";
|
|
4
|
-
/**
|
|
5
|
-
* A random identity for the current browser document. It is never an authentication or user
|
|
6
|
-
* identifier. Server renders have no document, so they get none instead of sharing one per isolate.
|
|
7
|
-
*/
|
|
8
3
|
export declare const browserPageId: () => string | undefined;
|
|
9
|
-
/** Safe event shared with the host's error reporter and product analytics. */
|
|
10
4
|
export declare const BrowserOperationFailure: Schema.Struct<{
|
|
11
5
|
readonly error_type: Schema.Literals<readonly ["BrowserDecodeFailed", "BrowserConnectionFailed", "BrowserTransportFailed", "BrowserOperationFailed"]>;
|
|
12
6
|
readonly trace_id: Schema.String;
|
|
13
7
|
readonly span_id: Schema.String;
|
|
14
8
|
readonly page_id: Schema.String;
|
|
15
9
|
}>;
|
|
16
|
-
/** Observe transport failure and retain only its trace identity for the subsequent decoder. */
|
|
17
10
|
export declare const observeBrowserTransport: (client: HttpClient.HttpClient) => HttpClient.HttpClient.With<HttpClientError.HttpClientError, never>;
|
|
18
|
-
/** AtomHttpApi invokes this after status/body decoding, including handled schema failures. */
|
|
19
11
|
export declare const observeBrowserResponse: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** Native page measurements. Observers and reporting fibers belong to the browser Layer. */
|
|
2
1
|
import { Effect } from "effect";
|
|
3
|
-
/** Collect page measurements without making them parents of unrelated API calls. */
|
|
4
2
|
export declare const observeBrowserPerformance: Effect.Effect<{
|
|
5
3
|
flush: Effect.Effect<void, never, never>;
|
|
6
4
|
pause: Effect.Effect<void, never, never>;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
/** Browser-owned Effect telemetry, shared by Promise calls and Atom runtimes. */
|
|
2
1
|
import { Context, Effect, Layer, ManagedRuntime } from "effect";
|
|
3
2
|
import { OtlpExporter } from "effect/observability";
|
|
4
3
|
import { Atom } from "effect/reactivity";
|
|
5
4
|
import type { TelemetryConfig } from "./config.js";
|
|
6
5
|
declare const BrowserTelemetry_base: Context.ServiceClass<BrowserTelemetry, "executor/BrowserTelemetry", {
|
|
7
|
-
/**
|
|
8
|
-
* `load` names the document's initial route without a span: hydration resolves no route
|
|
9
|
-
* change, and first load is measured by the vitals. `start` opens a `ui.navigation` span
|
|
10
|
-
* that the router's next `end` closes or the next `start` interrupts.
|
|
11
|
-
*/
|
|
12
6
|
readonly navigation: (event: {
|
|
13
7
|
readonly type: "load" | "start";
|
|
14
8
|
readonly path: string;
|
|
@@ -17,16 +11,12 @@ declare const BrowserTelemetry_base: Context.ServiceClass<BrowserTelemetry, "exe
|
|
|
17
11
|
}) => Effect.Effect<void>;
|
|
18
12
|
readonly flush: Effect.Effect<void>;
|
|
19
13
|
}>;
|
|
20
|
-
/** Page events use the same tracer and export scope as browser API operations. */
|
|
21
14
|
export declare class BrowserTelemetry extends BrowserTelemetry_base {
|
|
22
15
|
}
|
|
23
|
-
/** Install listeners for this page lifetime. Closing the Layer removes them and drains exporters. */
|
|
24
16
|
export declare const browserTelemetryLayer: (settings: Effect.Effect<TelemetryConfig>) => Layer.Layer<OtlpExporter.Flusher | BrowserTelemetry, never, never>;
|
|
25
|
-
/** Share a memo map so the page and its Atom registries acquire one telemetry Layer. */
|
|
26
17
|
export declare const makeBrowserTelemetry: (settings: Effect.Effect<TelemetryConfig>) => {
|
|
27
18
|
runtime: ManagedRuntime.ManagedRuntime<OtlpExporter.Flusher | BrowserTelemetry, never>;
|
|
28
19
|
atoms: Atom.SharedRuntimeFactory;
|
|
29
20
|
};
|
|
30
|
-
/** Read public build metadata and use only same-origin telemetry endpoints. */
|
|
31
21
|
export declare const browserSettings: (basePath: string, service: string) => Effect.Effect<TelemetryConfig>;
|
|
32
22
|
export { browserPageId, BrowserOperationFailure, observeBrowserTransport, observeBrowserResponse, } from "./browser-operations.js";
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
/** Telemetry configuration is parsed at composition roots; headers remain redacted. */
|
|
2
1
|
import { Config, Context, Effect, Schema } from "effect";
|
|
3
|
-
/** Bound each collector request, including its acknowledgement; exporter retries retain the batch. */
|
|
4
2
|
export declare const telemetryRequestTimeout: "5 seconds";
|
|
5
|
-
/** One private exporter target. Endpoints are complete signal URLs. */
|
|
6
3
|
export declare const TelemetryTarget: Schema.Struct<{
|
|
7
4
|
readonly url: Schema.String;
|
|
8
5
|
readonly headers: Schema.optional<Schema.RedactedFromValue<Schema.$Record<Schema.String, Schema.String>>>;
|
|
9
6
|
}>;
|
|
10
|
-
/** Parsed target with redaction-safe headers. */
|
|
11
7
|
export type TelemetryTarget = typeof TelemetryTarget.Type;
|
|
12
|
-
/** Shared identity and independently selectable OTLP signals. */
|
|
13
8
|
export declare const TelemetryConfig: Schema.Struct<{
|
|
14
9
|
readonly service: Schema.NonEmptyString;
|
|
15
10
|
readonly version: Schema.NonEmptyString;
|
|
@@ -29,9 +24,7 @@ export declare const TelemetryConfig: Schema.Struct<{
|
|
|
29
24
|
}>>;
|
|
30
25
|
readonly metricsProtocol: Schema.optional<Schema.Literals<readonly ["http/json", "http/protobuf"]>>;
|
|
31
26
|
}>;
|
|
32
|
-
/** Resolved telemetry configuration. */
|
|
33
27
|
export type TelemetryConfig = typeof TelemetryConfig.Type;
|
|
34
|
-
/** Host-only destinations; never copied into an app's invocation telemetry capability. */
|
|
35
28
|
export declare const CurrentTelemetryConfig: Context.Reference<{
|
|
36
29
|
readonly service: string;
|
|
37
30
|
readonly version: string;
|
|
@@ -57,7 +50,6 @@ export declare const CurrentTelemetryConfig: Context.Reference<{
|
|
|
57
50
|
} | undefined;
|
|
58
51
|
readonly metricsProtocol?: "http/json" | "http/protobuf" | undefined;
|
|
59
52
|
} | undefined>;
|
|
60
|
-
/** Read OTLP endpoints uniformly for all signals; development chooses which signals to configure. */
|
|
61
53
|
export declare const telemetryConfig: (service: string) => Effect.Effect<{
|
|
62
54
|
readonly service: string;
|
|
63
55
|
readonly version: string;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
/** Explicit telemetry-only context across Promise and HTTP boundaries. */
|
|
2
1
|
import { Context, Effect, Tracer } from "effect";
|
|
3
|
-
/** Trusted in-process capability containing no product authority, database or credentials. */
|
|
4
2
|
export interface InvocationTelemetry {
|
|
5
3
|
readonly context: Context.Context<never>;
|
|
6
4
|
}
|
|
7
|
-
/** Capture the tracer, loggers, registry and parent for a host-owned callback. */
|
|
8
5
|
export declare const captureTelemetry: Effect.Effect<InvocationTelemetry>;
|
|
9
|
-
/** Encode the active span; absent tracing remains a valid no-header case. */
|
|
10
6
|
export declare const traceHeaders: Effect.Effect<Readonly<Record<string, string>>>;
|
|
11
|
-
/** Decode W3C context and start a server span in the recipient's own telemetry runtime. */
|
|
12
7
|
export declare const withRemoteSpan: (request: Request, name: string) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
13
|
-
/** Plain fetch for app authors, correlated with the invocation and cancelled by its owner. */
|
|
14
8
|
export declare const invocationFetch: (signal: AbortSignal) => Effect.Effect<(input: string | URL | Request, init?: RequestInit) => Promise<Response>, never, never>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Effect-native observability shared by Executor hosts and framework operations. */
|
|
2
1
|
export { CurrentTelemetryConfig, TelemetryConfig, TelemetryTarget, telemetryConfig, } from "./config.js";
|
|
3
2
|
export { telemetryLayer, telemetryFromConfig } from "./layer.js";
|
|
4
3
|
export { captureTelemetry, traceHeaders, withRemoteSpan, invocationFetch, type InvocationTelemetry, } from "./context.js";
|
|
@@ -1,53 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One page-wide budget for keepalive request bodies.
|
|
3
|
-
*
|
|
4
|
-
* Fetch refuses a keepalive request, and `sendBeacon` refuses a beacon, once the page's keepalive
|
|
5
|
-
* bodies in flight would pass 64 KiB. Chromium counts every sender on the page together, the
|
|
6
|
-
* Sentry SDK's sandboxed fetch included, while each SDK counts only its own requests. A refused
|
|
7
|
-
* request never leaves the browser and its sender drops it: an error report sent while trace and
|
|
8
|
-
* log exports were in flight was lost this way.
|
|
9
|
-
*
|
|
10
|
-
* Counted here: the dashboard's trace and log exports, its Sentry reports and its analytics
|
|
11
|
-
* events, each of which goes as an ordinary request when it does not fit. Not counted: PostHog's
|
|
12
|
-
* own requests, which the dashboard sends without keepalive, except the beacons PostHog sends as
|
|
13
|
-
* the page unloads (its queued requests and the last replay chunk); and any other keepalive
|
|
14
|
-
* request or beacon on the page. Those can still fill the quota; a keepalive request the browser
|
|
15
|
-
* refuses then goes once more as an ordinary request, and the page records that it did.
|
|
16
|
-
*/
|
|
17
|
-
/** Which of the page's telemetry senders a request belongs to: a fixed name, never an identifier. */
|
|
18
1
|
export type KeepaliveSender = "exports" | "error-reports" | "error-sessions" | "analytics";
|
|
19
|
-
/** What became of a request the browser refused and the page sent once more as an ordinary one. */
|
|
20
2
|
export type KeepaliveResend = "resent" | "resend-failed";
|
|
21
3
|
type ResendListener = (sender: KeepaliveSender, outcome: KeepaliveResend) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Hear each resend of a refused keepalive request, including those before this was called. The
|
|
24
|
-
* page's telemetry records them; the returned function stops listening.
|
|
25
|
-
*/
|
|
26
4
|
export declare const onKeepaliveResend: (listener: ResendListener) => () => void;
|
|
27
|
-
/**
|
|
28
|
-
* The page's own `fetch`, taken when this module first loads, before any SDK wraps it. The Sentry
|
|
29
|
-
* SDK wraps `window.fetch` to record each request as a breadcrumb on later reports; the page's own
|
|
30
|
-
* reports and analytics events go through this one, so neither becomes a breadcrumb.
|
|
31
|
-
*/
|
|
32
5
|
export declare const pageFetch: typeof fetch;
|
|
33
|
-
/** The keepalive body bytes the page can still send before the browser refuses one. */
|
|
34
6
|
export declare const keepaliveRoom: () => number;
|
|
35
|
-
/**
|
|
36
|
-
* Send with keepalive, counting `keepaliveBytes`, the body's size, against the page's budget; or,
|
|
37
|
-
* given `false`, as an ordinary request. The browser counts a keepalive request until its whole
|
|
38
|
-
* response has arrived, not just its headers, so the bytes are counted until a copy of the
|
|
39
|
-
* response body has been read. Only for idempotent telemetry: see `budgetedFetch`.
|
|
40
|
-
*/
|
|
41
7
|
export declare const countedFetch: (sender: KeepaliveSender, send: typeof fetch, input: RequestInfo | URL, init: RequestInit, keepaliveBytes: number | false) => Promise<Response>;
|
|
42
|
-
/**
|
|
43
|
-
* `send`, with a requested keepalive kept only when the body fits what is left of the page's
|
|
44
|
-
* budget. Otherwise the request goes as an ordinary one, which the browser sends at once but may
|
|
45
|
-
* cancel if the page unloads first.
|
|
46
|
-
*
|
|
47
|
-
* Only for idempotent telemetry: a keepalive request that fails with a TypeError is sent once more,
|
|
48
|
-
* and a TypeError cannot tell a refusal, which sent nothing, from a connection lost after the
|
|
49
|
-
* request was sent. A request whose repeat would do something twice, such as a write, must not
|
|
50
|
-
* use this.
|
|
51
|
-
*/
|
|
52
8
|
export declare const budgetedFetch: (sender: KeepaliveSender, send?: typeof fetch) => typeof fetch;
|
|
53
9
|
export {};
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
/** Portable Effect exporters. The host owns scope and export lifetime. */
|
|
2
1
|
import { Duration, Layer, Logger } from "effect";
|
|
3
2
|
import { type TelemetryConfig } from "./config.js";
|
|
4
|
-
/** How long each signal's final flush may take when the scope closes. */
|
|
5
3
|
export type ShutdownTimeouts = Partial<Record<"traces" | "logs" | "metrics", Duration.Input>>;
|
|
6
|
-
/**
|
|
7
|
-
* Build one tracer per runtime. Event mode defers export until Worker scope finalization.
|
|
8
|
-
* A signal's final flush gets three seconds unless `shutdownTimeouts` names its own bound; only
|
|
9
|
-
* the host that owns a destination knows it answers faster.
|
|
10
|
-
*/
|
|
11
4
|
export declare const telemetryLayer: (config: TelemetryConfig, lifetime?: "process" | "event", logger?: Logger.Logger<unknown, void>, shutdownTimeouts?: ShutdownTimeouts) => Layer.Layer<import("effect/observability/OtlpExporter").Flusher, never, never>;
|
|
12
|
-
/** Node/local entry points resolve telemetry once and share it for their process lifetime. */
|
|
13
5
|
export declare const telemetryFromConfig: (service: string) => Layer.Layer<import("effect/observability/OtlpExporter").Flusher, import("effect/Schema").SchemaError | import("effect/Config").ConfigError, never>;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
/** Low-cardinality transport measurements; these are wall/CPU totals with explicit units, not app data. */
|
|
2
1
|
import { Effect } from "effect";
|
|
3
|
-
/** Classify URLs into a fixed set before attaching attributes; raw paths and query strings are never labels. */
|
|
4
2
|
export declare const recordResponseReady: (path: string | undefined, method: string, status: number, milliseconds: number) => Effect.Effect<void, never, never>;
|
|
5
|
-
/**
|
|
6
|
-
* Count and log one failed export. `elapsedMs`, when known, is how long its request had run when
|
|
7
|
-
* it failed: an interruption at an exporter's deadline, such as the relay's three seconds, shows
|
|
8
|
-
* that deadline.
|
|
9
|
-
*/
|
|
10
3
|
export declare const recordExportFailure: (path: string, reason: "transport" | "interrupted" | "partial-success" | "capacity" | "acknowledgement" | "timeout" | "relay" | "shutdown", records?: number, elapsedMs?: number) => Effect.Effect<void, never, never>;
|
|
11
|
-
/** Record provider-owned invocation totals separately from response-ready timing. */
|
|
12
4
|
export declare const recordWorkerMeasurements: (worker: string, outcome: string, cpu: number, wall: number) => Effect.Effect<void, never, never>;
|
|
@@ -1,60 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Who a span's work belongs to, and how a measured span's time divides among them. A span that
|
|
3
|
-
* starts work for someone other than its caller declares the owner with `ownedBy`; any other span
|
|
4
|
-
* works for whoever its parent works for. Each instant then belongs to the innermost boundary in
|
|
5
|
-
* progress, so Executor's work inside an upstream session stays Executor's, and an app's callback
|
|
6
|
-
* inside Executor's cache stays the app's. Background work is the exception: everything inside it
|
|
7
|
-
* is background, and it runs beside its caller rather than inside it. It takes no instant from the
|
|
8
|
-
* caller's window; how long it ran within the window is reported beside the division.
|
|
9
|
-
*
|
|
10
|
-
* Workers clocks advance only on I/O, so durations are comparable within one isolate and not across
|
|
11
|
-
* isolates: each isolate measures its own part, and the spans that already bracket the work define
|
|
12
|
-
* it, so the accounting and the trace agree.
|
|
13
|
-
*/
|
|
14
1
|
import { Context, Effect, Tracer } from "effect";
|
|
15
|
-
/**
|
|
16
|
-
* Executor's own work; the app's authored code; waiting on an upstream provider; waiting on a
|
|
17
|
-
* person's answer; waiting on another call that holds the lease to load a cache entry; or work
|
|
18
|
-
* handed to the background, such as refreshing a stale cache entry, that no caller waits on.
|
|
19
|
-
*/
|
|
20
2
|
export type Owner = "executor" | "app" | "upstream" | "person" | "lease" | "background";
|
|
21
|
-
/** The attribute that shows a boundary's owner in the trace; the telemetry tracer sets it. */
|
|
22
3
|
export declare const ownerAttribute = "executor.owner";
|
|
23
|
-
/** The owner a span declared when it started, if it is an ownership boundary. */
|
|
24
4
|
export declare const declaredOwner: (annotations: Context.Context<never>) => Owner | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Options for a span whose work belongs to `owner`. Every ownership boundary uses them, at the point
|
|
27
|
-
* the work starts: provider requests and sessions are the upstream's, Executor's services called by
|
|
28
|
-
* an app are Executor's, an app's callbacks are the app's, and waiting for an answer is the person's.
|
|
29
|
-
*/
|
|
30
5
|
export declare const ownedBy: (owner: Owner, options?: Tracer.SpanOptionsNoTrace) => Tracer.SpanOptionsNoTrace;
|
|
31
|
-
/** Run `effect` in span `name`, owned by `owner`. */
|
|
32
6
|
export declare const owned: (owner: Owner, name: string, options?: Tracer.SpanOptionsNoTrace) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
33
|
-
/** What a measured span does with its work and its end. */
|
|
34
7
|
export interface SpanMeasure {
|
|
35
|
-
/** Wraps the work inside the span, for example to observe the spans it opens. */
|
|
36
8
|
readonly around?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
37
|
-
/** Receives the span's end, before the span ends, to record what it measured on it. */
|
|
38
9
|
readonly end: (end: bigint, span: Tracer.Span) => void;
|
|
39
10
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Run `effect` in span `name`, measured by `measure` from the span's own start to its own end, so
|
|
42
|
-
* the span's duration and the measurement share both boundaries.
|
|
43
|
-
*/
|
|
44
11
|
export declare const measuredSpan: (name: string, options: Tracer.SpanOptionsNoTrace, measure: (start: bigint) => SpanMeasure) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>;
|
|
45
|
-
/**
|
|
46
|
-
* Divide a window that starts at `origin`, whose own work is `owner`'s, among owners. At each
|
|
47
|
-
* instant, the work in progress is the innermost span of each branch: a span with no child still
|
|
48
|
-
* open. Its owner takes the instant. With nothing open inside the window, `owner` takes it. Spans
|
|
49
|
-
* are counted as they open and end, in constant time each, and only spans still open are kept.
|
|
50
|
-
* `background` is not part of the division: it is how long background work was in progress.
|
|
51
|
-
*/
|
|
52
12
|
export declare const makeOwnershipAccounting: (origin: bigint, owner: Owner) => {
|
|
53
|
-
/** Run `effect` with the spans it opens observed, including spans it hands to later work. */
|
|
54
13
|
observe: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
55
|
-
/**
|
|
56
|
-
* Close the window at `end` and return its milliseconds by owner, each instant counted once.
|
|
57
|
-
* Spans still open count up to `end`; spans that open or end afterwards are ignored.
|
|
58
|
-
*/
|
|
59
14
|
read: (end: bigint) => Readonly<Record<Owner, number>>;
|
|
60
15
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** A span ending at an asynchronous milestone, with cancellation owned by its enclosing scope. */
|
|
2
1
|
import { Effect, Exit, type Tracer } from "effect";
|
|
3
|
-
/** End exactly once at completion, failure, or scope release. It is not installed as a parent implicitly. */
|
|
4
2
|
export declare const pendingSpan: (name: string, options?: Tracer.SpanOptionsNoTrace) => Effect.Effect<{
|
|
5
3
|
span: Tracer.Span;
|
|
6
4
|
finish: (exit: Exit.Exit<unknown, unknown>) => Effect.Effect<void, never, never>;
|
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Failures as Executor's telemetry records them. Traces and error reports keep an error's text only
|
|
3
|
-
* when Executor wrote it: a tagged error is recorded by its tag and the fixed sentence it declares
|
|
4
|
-
* (see `RecordedMessage`), or by its tag alone when it declares none. Its fields, message, stack and
|
|
5
|
-
* cause are not recorded, so a value an error carries for its caller, an app's text or a service's
|
|
6
|
-
* reply cannot reach telemetry by an error forgetting to declare. The error itself, and what its
|
|
7
|
-
* caller receives, are unchanged.
|
|
8
|
-
*/
|
|
9
1
|
import { Cause } from "effect";
|
|
10
|
-
/**
|
|
11
|
-
* The error a trace or error report records in place of `error`.
|
|
12
|
-
*
|
|
13
|
-
* - A tagged error is named by its tag: a field called `name`, such as a requested skill's or an
|
|
14
|
-
* app's, replaces the error's own name. Its message is the sentence it declares, or empty. Its
|
|
15
|
-
* stack is generated here and names no frames: the error's own stack begins with its message,
|
|
16
|
-
* which can span lines that look like frames. Traces still show where it failed through the
|
|
17
|
-
* operation's own spans, which Effect appends to a recorded stack.
|
|
18
|
-
* - Any other value that is not an `Error`, such as a plain object Effect would print as JSON, is
|
|
19
|
-
* recorded as `UnrecognizedFailure` with no text.
|
|
20
|
-
* - An untagged `Error` is a defect or a platform's error: its message and stack come from the
|
|
21
|
-
* JavaScript engine or a library and are kept, as they are the only diagnosis of an Executor bug.
|
|
22
|
-
* Its cause is recorded by these same rules.
|
|
23
|
-
*/
|
|
24
2
|
export declare const recordedError: (error: unknown) => unknown;
|
|
25
|
-
/**
|
|
26
|
-
* A failure's cause as traces record it: each failure and defect by `recordedError`. Interruptions
|
|
27
|
-
* are unchanged, and each reason keeps its annotations, which locate it.
|
|
28
|
-
*/
|
|
29
3
|
export declare const recordedCause: <E>(cause: Cause.Cause<E>) => Cause.Cause<unknown>;
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
/** Bounded OTLP return channel for credential-free app isolates. The parent owns export. */
|
|
2
1
|
import { Context, Effect, Schema, Scope } from "effect";
|
|
3
|
-
/**
|
|
4
|
-
* A telemetry wait a request's close makes that reached its bound: the forwarder's drain, or the
|
|
5
|
-
* product analytics flush. A host that reports how its requests closed records it; the default
|
|
6
|
-
* records nothing.
|
|
7
|
-
*/
|
|
8
2
|
export type TelemetryWait = "forwarder" | "analytics";
|
|
9
3
|
export declare const TelemetryWaitReport: Context.Reference<(wait: TelemetryWait) => Effect.Effect<void>>;
|
|
10
|
-
/**
|
|
11
|
-
* The scope a host gives telemetry it waits for when a request ends: the forwarder's queue and
|
|
12
|
-
* its drain. A host that closes this scope after the request's other resources, such as its
|
|
13
|
-
* database connections, never holds them while it waits on a telemetry endpoint. Unset, the
|
|
14
|
-
* forwarder lives in the scope it is built in. The host may close this scope's finalizers in
|
|
15
|
-
* parallel; each user keeps its own order in a scope of its own.
|
|
16
|
-
*/
|
|
17
4
|
export declare const TelemetryDrainScope: Context.Reference<Scope.Scope | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* Forward app telemetry in the host scope without delaying an app result.
|
|
20
|
-
* Batches wait in one queue and a single sender exports everything waiting as one request per
|
|
21
|
-
* signal, so a burst of finished runs costs a few exports instead of one each. The queue holds at
|
|
22
|
-
* most eight MiB of payload and one export carries at most four. Overload and shutdown loss are
|
|
23
|
-
* reported through the normal safe export-failure signal. Scope release drains for the same
|
|
24
|
-
* three-second budget as the other exporters, in {@link TelemetryDrainScope} when the host sets it.
|
|
25
|
-
*/
|
|
26
5
|
export declare const makeTelemetryForwarder: Effect.Effect<(batch: TelemetryBatch, traceId: string, source: TelemetrySource) => Effect.Effect<void, never, never>, never, Scope.Scope>;
|
|
27
|
-
/** Untrusted isolate batches are bounded before decoding; no endpoint or credential crosses back. */
|
|
28
6
|
export declare const TelemetryBatch: Schema.Struct<{
|
|
29
7
|
readonly traces: Schema.$Array<Schema.String>;
|
|
30
8
|
readonly logs: Schema.$Array<Schema.String>;
|
|
31
9
|
readonly dropped: Schema.Int;
|
|
32
10
|
}>;
|
|
33
|
-
/** Parsed isolate telemetry envelope. */
|
|
34
11
|
export type TelemetryBatch = typeof TelemetryBatch.Type;
|
|
35
|
-
/** Collect one invocation into memory, flush before returning, and never contact a remote collector. */
|
|
36
12
|
export declare const collectTelemetry: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<{
|
|
37
13
|
value: A;
|
|
38
14
|
telemetry: {
|
|
@@ -41,13 +17,8 @@ export declare const collectTelemetry: <A, E, R>(effect: Effect.Effect<A, E, R>)
|
|
|
41
17
|
dropped: number;
|
|
42
18
|
};
|
|
43
19
|
}, E, Exclude<Exclude<R, import("effect/observability/OtlpExporter").Flusher>, never>>;
|
|
44
|
-
/**
|
|
45
|
-
* What the host knows about the records' source, from its own invocation rather than the records:
|
|
46
|
-
* the build that ran and, for an app isolate, the app's opaque ID. Both become resource attributes.
|
|
47
|
-
*/
|
|
48
20
|
export interface TelemetrySource {
|
|
49
21
|
readonly build?: string | undefined;
|
|
50
22
|
readonly app?: string | undefined;
|
|
51
23
|
}
|
|
52
|
-
/** Validate isolated records and export only this call's trace, using parent-owned credentials/identity. */
|
|
53
24
|
export declare const forwardTelemetry: (batch: TelemetryBatch, traceId: string | undefined, source: TelemetrySource, service?: "executor-app" | "executor-web") => Effect.Effect<void, Schema.SchemaError | import("effect/http/HttpClientError").HttpClientError | import("effect/Cause").TimeoutError, never>;
|