autotel-cloudflare 17.0.0 → 18.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/actors.d.ts +7 -7
- package/dist/agents.d.ts +103 -103
- package/dist/{handlers-BRfAgfP7.d.ts → handlers-CEAD5hVy.d.ts} +3 -1
- package/dist/{handlers-4X_6aEtg.js → handlers-a5qrd5nR.js} +89 -12
- package/dist/handlers.d.ts +2 -2
- package/dist/handlers.js +2 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.js +14 -7
- package/dist/native-tracing-DjyDA54H.js +63 -0
- package/dist/native.js +1 -1
- package/dist/tail.d.ts +110 -0
- package/dist/tail.js +249 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +0 -2
- package/package.json +18 -14
- package/dist/native-tracing-D0EyAtsF.js +0 -32
package/README.md
CHANGED
|
@@ -40,6 +40,8 @@ enabled = true
|
|
|
40
40
|
|
|
41
41
|
When native tracing is active, autotel **defers to the platform**: it does not proxy-instrument bindings (no duplicate spans) and does not run its own exporter. It routes your custom spans to `tracing.enterSpan()` and surfaces the `cf-ray` id as `ctx.correlationId` + a `correlation.id` span attribute. Controlled by `nativeTracing: 'auto' | 'on' | 'off'` (default `'auto'`).
|
|
42
42
|
|
|
43
|
+
In both modes autotel also records the issue signals Workers Issues derives from logs, as span exceptions: `console.error(...)` (status untouched, `captureConsoleErrors: false` to opt out), `autotel.LogFlood` for logging in a loop (`logFloodThreshold`, default `100`), and `autotel.RunawayAlarm` when a Durable Object's `alarm()` runs more than 10 times in 60s (`runawayAlarm: { maxRuns, windowMs }` or `false`).
|
|
44
|
+
|
|
43
45
|
### Same code, both modes: captured evidence
|
|
44
46
|
|
|
45
47
|
This is real output from [`apps/cloudflare-example`](../../apps/cloudflare-example) (`node scripts/capture-evidence.mjs`). Identical business logic, two runtimes:
|
|
@@ -68,6 +70,44 @@ Note the native tree has **no `KV MY_KV: get` span**. Cloudflare emits that nati
|
|
|
68
70
|
|
|
69
71
|
Full details, degradation map, and the forward-compatible trace-id story: [docs/CLOUDFLARE-NATIVE-TRACING.md](../../docs/CLOUDFLARE-NATIVE-TRACING.md).
|
|
70
72
|
|
|
73
|
+
## No SDK: a Tail Worker
|
|
74
|
+
|
|
75
|
+
Observe a Worker without changing its code. A [Tail Worker](https://developers.cloudflare.com/workers/observability/logs/tail-workers/)
|
|
76
|
+
receives every invocation of the Workers that list it: outcome, uncaught
|
|
77
|
+
exceptions, console output (with the exception behind each `console.error`
|
|
78
|
+
argument), the request and response status, and the version that ran.
|
|
79
|
+
`autotel-cloudflare/tail` turns each invocation into an OTLP span and its
|
|
80
|
+
console output into OTLP logs, so autotel-devtools and autotel-mcp group them
|
|
81
|
+
into issues (with source maps and automations) exactly as for an instrumented
|
|
82
|
+
app. A request carrying `traceparent` joins the caller's trace.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
// tail-worker/src/index.ts
|
|
86
|
+
import { createTailHandler } from 'autotel-cloudflare/tail';
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
tail: createTailHandler({
|
|
90
|
+
endpoint: (env) => env.OTLP_ENDPOINT, // posts to /v1/traces and /v1/logs
|
|
91
|
+
headers: (env) => ({ authorization: `Bearer ${env.OTLP_TOKEN}` }),
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```jsonc
|
|
97
|
+
// the observed Worker's wrangler.jsonc: no code change
|
|
98
|
+
{ "tail_consumers": [{ "service": "tail-worker" }] }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
It also reports logging in a loop (`autotel.LogFlood`) and Durable Object
|
|
102
|
+
alarms firing in a loop (`autotel.RunawayAlarm`). Tail Workers need the Workers
|
|
103
|
+
Paid plan in production. Under `wrangler dev` (run both with
|
|
104
|
+
`wrangler dev -c app/wrangler.jsonc -c tail/wrangler.jsonc`), wrangler's error
|
|
105
|
+
middleware turns an uncaught exception into a plain 500 before the tail sees it
|
|
106
|
+
and events carry no script name, so pass `serviceName`; deployed, the
|
|
107
|
+
exception and the Worker's name arrive as-is. What the tail cannot see are
|
|
108
|
+
attributes set inside the Worker (`user.id` and the like): add those with the
|
|
109
|
+
SDK or Cloudflare's `tracing.getActiveSpan()`.
|
|
110
|
+
|
|
71
111
|
## Installation
|
|
72
112
|
|
|
73
113
|
```bash
|
package/dist/actors.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ type ActorEnv = UnknownRecord;
|
|
|
120
120
|
* @param config - Configuration (static object or function)
|
|
121
121
|
* @returns Instrumented Actor class
|
|
122
122
|
*/
|
|
123
|
-
declare function instrumentActor<C extends ActorConstructor>(actorClass: C, config: ActorConfig | ((env: ActorEnv, trigger?: ActorPayload) => ActorConfig)): C;
|
|
123
|
+
export declare function instrumentActor<C extends ActorConstructor>(actorClass: C, config: ActorConfig | ((env: ActorEnv, trigger?: ActorPayload) => ActorConfig)): C;
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/actors/traced-handler.d.ts
|
|
126
126
|
/**
|
|
@@ -162,7 +162,7 @@ interface WorkerHandler<E = unknown> {
|
|
|
162
162
|
* @param config - Configuration (static object or function)
|
|
163
163
|
* @returns A Worker handler with full tracing
|
|
164
164
|
*/
|
|
165
|
-
declare function tracedHandler<E, A extends ActorLike>(actorClass: ActorConstructor<A> & {
|
|
165
|
+
export declare function tracedHandler<E, A extends ActorLike>(actorClass: ActorConstructor<A> & {
|
|
166
166
|
nameFromRequest?(request: Request): Promise<string | undefined>;
|
|
167
167
|
configuration?(request: Request): {
|
|
168
168
|
locationHint?: DurableObjectLocationHint;
|
|
@@ -186,7 +186,7 @@ declare function tracedHandler<E, A extends ActorLike>(actorClass: ActorConstruc
|
|
|
186
186
|
* }))
|
|
187
187
|
* ```
|
|
188
188
|
*/
|
|
189
|
-
declare function wrapHandler<E>(originalHandler: WorkerHandler<E>, config: ActorConfig | ((env: E, trigger?: unknown) => ActorConfig)): WorkerHandler<E>;
|
|
189
|
+
export declare function wrapHandler<E>(originalHandler: WorkerHandler<E>, config: ActorConfig | ((env: E, trigger?: unknown) => ActorConfig)): WorkerHandler<E>;
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/actors/storage.d.ts
|
|
192
192
|
/**
|
|
@@ -196,7 +196,7 @@ declare function wrapHandler<E>(originalHandler: WorkerHandler<E>, config: Actor
|
|
|
196
196
|
* - SQL query operations
|
|
197
197
|
* - Key-value operations (if available)
|
|
198
198
|
*/
|
|
199
|
-
declare function instrumentActorStorage(storage: unknown, actorInstance: ActorLike, actorClass: object): unknown;
|
|
199
|
+
export declare function instrumentActorStorage(storage: unknown, actorInstance: ActorLike, actorClass: object): unknown;
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region src/actors/alarms.d.ts
|
|
202
202
|
/**
|
|
@@ -208,7 +208,7 @@ declare function instrumentActorStorage(storage: unknown, actorInstance: ActorLi
|
|
|
208
208
|
* - cancel: Cancel an alarm
|
|
209
209
|
* - cancelAll: Cancel all alarms
|
|
210
210
|
*/
|
|
211
|
-
declare function instrumentActorAlarms(alarms: unknown, actorInstance: ActorLike, actorClass: object): unknown;
|
|
211
|
+
export declare function instrumentActorAlarms(alarms: unknown, actorInstance: ActorLike, actorClass: object): unknown;
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/actors/sockets.d.ts
|
|
214
214
|
/**
|
|
@@ -219,6 +219,6 @@ declare function instrumentActorAlarms(alarms: unknown, actorInstance: ActorLike
|
|
|
219
219
|
* - broadcast: Send message to all connected sockets
|
|
220
220
|
* - send: Send message to a specific socket
|
|
221
221
|
*/
|
|
222
|
-
declare function instrumentActorSockets(sockets: unknown, actorInstance: ActorLike, actorClass: object): unknown;
|
|
222
|
+
export declare function instrumentActorSockets(sockets: unknown, actorInstance: ActorLike, actorClass: object): unknown;
|
|
223
223
|
//#endregion
|
|
224
|
-
export {
|
|
224
|
+
export type { ActorConfig, ActorInstrumentationOptions, ActorLifecycle };
|
package/dist/agents.d.ts
CHANGED
|
@@ -362,7 +362,7 @@ interface ObservabilityChannel<TEvent extends ObservabilityEvent = Observability
|
|
|
362
362
|
name: string;
|
|
363
363
|
publish(event: TEvent): void;
|
|
364
364
|
}
|
|
365
|
-
declare const channels: {
|
|
365
|
+
export declare const channels: {
|
|
366
366
|
readonly state: ObservabilityChannel<BaseEvent<"state:update">>;
|
|
367
367
|
readonly rpc: ObservabilityChannel<BaseEvent<"rpc", {
|
|
368
368
|
method: string;
|
|
@@ -371,99 +371,99 @@ declare const channels: {
|
|
|
371
371
|
method: string;
|
|
372
372
|
error: string;
|
|
373
373
|
}>>;
|
|
374
|
-
readonly message: ObservabilityChannel<BaseEvent<"message:
|
|
374
|
+
readonly message: ObservabilityChannel<BaseEvent<"message:clear"> | BaseEvent<"message:request"> | BaseEvent<"message:response"> | BaseEvent<"message:cancel", {
|
|
375
375
|
requestId: string;
|
|
376
376
|
}> | BaseEvent<"message:error", {
|
|
377
377
|
error: string;
|
|
378
|
-
}> | BaseEvent<"tool:result", {
|
|
379
|
-
toolCallId: string;
|
|
380
|
-
toolName: string;
|
|
381
|
-
}> | BaseEvent<"tool:approval", {
|
|
382
|
-
toolCallId: string;
|
|
383
|
-
approved: boolean;
|
|
384
378
|
}> | BaseEvent<"submission:create", {
|
|
385
379
|
submissionId: string;
|
|
386
380
|
requestId?: string;
|
|
387
381
|
idempotencyKey?: string;
|
|
388
|
-
}> | BaseEvent<"submission:status", {
|
|
389
|
-
submissionId: string;
|
|
390
|
-
requestId?: string;
|
|
391
|
-
status: string;
|
|
392
382
|
}> | BaseEvent<"submission:error", {
|
|
393
383
|
submissionId: string;
|
|
394
384
|
requestId?: string;
|
|
395
385
|
error: string;
|
|
386
|
+
}> | BaseEvent<"submission:status", {
|
|
387
|
+
submissionId: string;
|
|
388
|
+
requestId?: string;
|
|
389
|
+
status: string;
|
|
390
|
+
}> | BaseEvent<"tool:approval", {
|
|
391
|
+
toolCallId: string;
|
|
392
|
+
approved: boolean;
|
|
393
|
+
}> | BaseEvent<"tool:result", {
|
|
394
|
+
toolCallId: string;
|
|
395
|
+
toolName: string;
|
|
396
396
|
}>>;
|
|
397
|
-
readonly chat: ObservabilityChannel<BaseEvent<"chat:
|
|
397
|
+
readonly chat: ObservabilityChannel<BaseEvent<"chat:context:compacted", {
|
|
398
|
+
reason: 'proactive' | 'reactive';
|
|
399
|
+
shortened: boolean;
|
|
398
400
|
requestId?: string;
|
|
399
|
-
|
|
400
|
-
|
|
401
|
+
attempt?: number;
|
|
402
|
+
}> | BaseEvent<"chat:hydration:windowed", {
|
|
403
|
+
totalContentBytes: number;
|
|
404
|
+
budgetBytes: number;
|
|
405
|
+
hydratedMessages: number;
|
|
406
|
+
}> | BaseEvent<"chat:media:evicted", {
|
|
407
|
+
messages: number;
|
|
408
|
+
parts: number;
|
|
409
|
+
bytes: number;
|
|
410
|
+
externalizedBytes: number;
|
|
411
|
+
}> | BaseEvent<"chat:onstart:degraded", {
|
|
412
|
+
step: 'transcript-hydration' | 'scheduled-task-reconcile' | 'durable-work-recovery';
|
|
401
413
|
error: string;
|
|
402
|
-
}> | BaseEvent<"chat:recovery:
|
|
414
|
+
}> | BaseEvent<"chat:recovery:attempt", {
|
|
403
415
|
incidentId: string;
|
|
404
416
|
requestId: string;
|
|
405
417
|
attempt: number;
|
|
406
418
|
maxAttempts: number;
|
|
407
|
-
recoveryKind:
|
|
408
|
-
}> | BaseEvent<"chat:recovery:
|
|
419
|
+
recoveryKind: 'retry' | 'continue';
|
|
420
|
+
}> | BaseEvent<"chat:recovery:completed", {
|
|
409
421
|
incidentId: string;
|
|
410
422
|
requestId: string;
|
|
411
423
|
attempt: number;
|
|
412
424
|
maxAttempts: number;
|
|
413
|
-
recoveryKind:
|
|
414
|
-
}> | BaseEvent<"chat:recovery:
|
|
425
|
+
recoveryKind: 'retry' | 'continue';
|
|
426
|
+
}> | BaseEvent<"chat:recovery:detected", {
|
|
415
427
|
incidentId: string;
|
|
416
428
|
requestId: string;
|
|
417
429
|
attempt: number;
|
|
418
430
|
maxAttempts: number;
|
|
419
|
-
recoveryKind:
|
|
420
|
-
}> | BaseEvent<"chat:recovery:
|
|
431
|
+
recoveryKind: 'retry' | 'continue';
|
|
432
|
+
}> | BaseEvent<"chat:recovery:exhausted", {
|
|
421
433
|
incidentId: string;
|
|
422
434
|
requestId: string;
|
|
423
435
|
attempt: number;
|
|
424
436
|
maxAttempts: number;
|
|
425
|
-
recoveryKind:
|
|
426
|
-
|
|
437
|
+
recoveryKind: 'retry' | 'continue';
|
|
438
|
+
reason: string;
|
|
439
|
+
}> | BaseEvent<"chat:recovery:failed", {
|
|
427
440
|
incidentId: string;
|
|
428
441
|
requestId: string;
|
|
429
442
|
attempt: number;
|
|
430
443
|
maxAttempts: number;
|
|
431
|
-
recoveryKind:
|
|
444
|
+
recoveryKind: 'retry' | 'continue';
|
|
432
445
|
reason?: string;
|
|
433
|
-
}> | BaseEvent<"chat:recovery:
|
|
446
|
+
}> | BaseEvent<"chat:recovery:scheduled", {
|
|
434
447
|
incidentId: string;
|
|
435
448
|
requestId: string;
|
|
436
449
|
attempt: number;
|
|
437
450
|
maxAttempts: number;
|
|
438
|
-
recoveryKind:
|
|
439
|
-
|
|
440
|
-
}> | BaseEvent<"chat:recovery:failed", {
|
|
451
|
+
recoveryKind: 'retry' | 'continue';
|
|
452
|
+
}> | BaseEvent<"chat:recovery:skipped", {
|
|
441
453
|
incidentId: string;
|
|
442
454
|
requestId: string;
|
|
443
455
|
attempt: number;
|
|
444
456
|
maxAttempts: number;
|
|
445
|
-
recoveryKind:
|
|
457
|
+
recoveryKind: 'retry' | 'continue';
|
|
446
458
|
reason?: string;
|
|
447
|
-
}> | BaseEvent<"chat:
|
|
448
|
-
|
|
459
|
+
}> | BaseEvent<"chat:request:failed", {
|
|
460
|
+
requestId?: string;
|
|
461
|
+
stage: 'parse' | 'persist' | 'turn' | 'stream' | 'recovery' | 'transcript';
|
|
462
|
+
messagesPersisted?: boolean;
|
|
449
463
|
error: string;
|
|
450
|
-
}> | BaseEvent<"chat:hydration:windowed", {
|
|
451
|
-
totalContentBytes: number;
|
|
452
|
-
budgetBytes: number;
|
|
453
|
-
hydratedMessages: number;
|
|
454
|
-
}> | BaseEvent<"chat:media:evicted", {
|
|
455
|
-
messages: number;
|
|
456
|
-
parts: number;
|
|
457
|
-
bytes: number;
|
|
458
|
-
externalizedBytes: number;
|
|
459
464
|
}> | BaseEvent<"chat:stream:stalled", {
|
|
460
465
|
requestId: string;
|
|
461
466
|
timeoutMs: number;
|
|
462
|
-
}> | BaseEvent<"chat:context:compacted", {
|
|
463
|
-
reason: "proactive" | "reactive";
|
|
464
|
-
shortened: boolean;
|
|
465
|
-
requestId?: string;
|
|
466
|
-
attempt?: number;
|
|
467
467
|
}>>;
|
|
468
468
|
readonly transcript: ObservabilityChannel<BaseEvent<"chat:transcript:repaired", {
|
|
469
469
|
requestId?: string;
|
|
@@ -471,116 +471,116 @@ declare const channels: {
|
|
|
471
471
|
normalizedInputs: number;
|
|
472
472
|
toolCallIds?: string[];
|
|
473
473
|
}>>;
|
|
474
|
-
readonly fiber: ObservabilityChannel<BaseEvent<"fiber:
|
|
474
|
+
readonly fiber: ObservabilityChannel<BaseEvent<"fiber:recovery:attempt", {
|
|
475
475
|
fiberId: string;
|
|
476
476
|
fiberName: string;
|
|
477
477
|
managed?: boolean;
|
|
478
|
-
|
|
478
|
+
recoveryReason: 'interrupted';
|
|
479
|
+
}> | BaseEvent<"fiber:recovery:detected", {
|
|
479
480
|
fiberId: string;
|
|
480
481
|
fiberName: string;
|
|
481
482
|
elapsedMs?: number;
|
|
482
483
|
managed?: boolean;
|
|
483
|
-
|
|
484
|
+
recoveryReason: 'interrupted';
|
|
485
|
+
}> | BaseEvent<"fiber:recovery:failed", {
|
|
484
486
|
fiberId: string;
|
|
485
487
|
fiberName: string;
|
|
486
488
|
error: string;
|
|
487
489
|
elapsedMs?: number;
|
|
488
|
-
|
|
489
|
-
}> | BaseEvent<"fiber:
|
|
490
|
+
reason?: string;
|
|
491
|
+
}> | BaseEvent<"fiber:recovery:handled", {
|
|
490
492
|
fiberId: string;
|
|
491
493
|
fiberName: string;
|
|
494
|
+
status?: string;
|
|
492
495
|
elapsedMs?: number;
|
|
493
496
|
managed?: boolean;
|
|
494
|
-
|
|
495
|
-
}> | BaseEvent<"fiber:recovery:detected", {
|
|
497
|
+
}> | BaseEvent<"fiber:recovery:skipped", {
|
|
496
498
|
fiberId: string;
|
|
497
499
|
fiberName: string;
|
|
500
|
+
reason: string;
|
|
498
501
|
elapsedMs?: number;
|
|
499
502
|
managed?: boolean;
|
|
500
|
-
|
|
501
|
-
}> | BaseEvent<"fiber:recovery:attempt", {
|
|
503
|
+
}> | BaseEvent<"fiber:run:completed", {
|
|
502
504
|
fiberId: string;
|
|
503
505
|
fiberName: string;
|
|
506
|
+
elapsedMs?: number;
|
|
504
507
|
managed?: boolean;
|
|
505
|
-
|
|
506
|
-
}> | BaseEvent<"fiber:recovery:handled", {
|
|
508
|
+
}> | BaseEvent<"fiber:run:failed", {
|
|
507
509
|
fiberId: string;
|
|
508
510
|
fiberName: string;
|
|
509
|
-
|
|
511
|
+
error: string;
|
|
510
512
|
elapsedMs?: number;
|
|
511
513
|
managed?: boolean;
|
|
512
|
-
}> | BaseEvent<"fiber:
|
|
514
|
+
}> | BaseEvent<"fiber:run:interrupted", {
|
|
513
515
|
fiberId: string;
|
|
514
516
|
fiberName: string;
|
|
515
|
-
reason: string;
|
|
516
517
|
elapsedMs?: number;
|
|
517
518
|
managed?: boolean;
|
|
518
|
-
|
|
519
|
+
recoveryReason: 'interrupted';
|
|
520
|
+
}> | BaseEvent<"fiber:run:started", {
|
|
519
521
|
fiberId: string;
|
|
520
522
|
fiberName: string;
|
|
521
|
-
|
|
522
|
-
elapsedMs?: number;
|
|
523
|
-
reason?: string;
|
|
523
|
+
managed?: boolean;
|
|
524
524
|
}>>;
|
|
525
525
|
readonly agentTool: ObservabilityChannel<BaseEvent<"agent_tool:recovery:begin", {
|
|
526
526
|
runCount: number;
|
|
527
527
|
totalTimeoutMs?: number;
|
|
528
|
-
}> | BaseEvent<"agent_tool:recovery:
|
|
529
|
-
|
|
530
|
-
agentType: string;
|
|
531
|
-
status: string;
|
|
532
|
-
reason?: string;
|
|
528
|
+
}> | BaseEvent<"agent_tool:recovery:complete", {
|
|
529
|
+
runCount: number;
|
|
533
530
|
elapsedMs?: number;
|
|
534
531
|
}> | BaseEvent<"agent_tool:recovery:deadline", {
|
|
535
532
|
runId: string;
|
|
536
533
|
agentType: string;
|
|
537
534
|
elapsedMs?: number;
|
|
535
|
+
}> | BaseEvent<"agent_tool:recovery:failed", {
|
|
536
|
+
error: string;
|
|
538
537
|
}> | BaseEvent<"agent_tool:recovery:reattach", {
|
|
539
538
|
runId: string;
|
|
540
539
|
agentType: string;
|
|
541
540
|
budgetMs: number;
|
|
542
|
-
}> | BaseEvent<"agent_tool:recovery:
|
|
543
|
-
|
|
541
|
+
}> | BaseEvent<"agent_tool:recovery:row", {
|
|
542
|
+
runId: string;
|
|
543
|
+
agentType: string;
|
|
544
|
+
status: string;
|
|
545
|
+
reason?: string;
|
|
544
546
|
elapsedMs?: number;
|
|
545
|
-
}> | BaseEvent<"agent_tool:recovery:failed", {
|
|
546
|
-
error: string;
|
|
547
547
|
}>>;
|
|
548
|
-
readonly schedule: ObservabilityChannel<BaseEvent<"
|
|
549
|
-
callback: string;
|
|
550
|
-
id: string;
|
|
551
|
-
}> | BaseEvent<"schedule:execute", {
|
|
548
|
+
readonly schedule: ObservabilityChannel<BaseEvent<"queue:create", {
|
|
552
549
|
callback: string;
|
|
553
550
|
id: string;
|
|
554
|
-
}> | BaseEvent<"
|
|
551
|
+
}> | BaseEvent<"queue:error", {
|
|
555
552
|
callback: string;
|
|
556
553
|
id: string;
|
|
557
|
-
|
|
554
|
+
error: string;
|
|
555
|
+
attempts: number;
|
|
556
|
+
}> | BaseEvent<"queue:retry", {
|
|
558
557
|
callback: string;
|
|
559
558
|
id: string;
|
|
560
559
|
attempt: number;
|
|
561
560
|
maxAttempts: number;
|
|
562
|
-
}> | BaseEvent<"schedule:
|
|
561
|
+
}> | BaseEvent<"schedule:cancel", {
|
|
562
|
+
callback: string;
|
|
563
|
+
id: string;
|
|
564
|
+
}> | BaseEvent<"schedule:create", {
|
|
563
565
|
callback: string;
|
|
564
566
|
id: string;
|
|
565
|
-
error: string;
|
|
566
|
-
attempts: number;
|
|
567
567
|
}> | BaseEvent<"schedule:duplicate_warning", {
|
|
568
568
|
callback: string;
|
|
569
569
|
count: number;
|
|
570
570
|
type: string;
|
|
571
|
-
}> | BaseEvent<"
|
|
571
|
+
}> | BaseEvent<"schedule:error", {
|
|
572
572
|
callback: string;
|
|
573
573
|
id: string;
|
|
574
|
-
|
|
574
|
+
error: string;
|
|
575
|
+
attempts: number;
|
|
576
|
+
}> | BaseEvent<"schedule:execute", {
|
|
575
577
|
callback: string;
|
|
576
578
|
id: string;
|
|
577
|
-
|
|
578
|
-
maxAttempts: number;
|
|
579
|
-
}> | BaseEvent<"queue:error", {
|
|
579
|
+
}> | BaseEvent<"schedule:retry", {
|
|
580
580
|
callback: string;
|
|
581
581
|
id: string;
|
|
582
|
-
|
|
583
|
-
|
|
582
|
+
attempt: number;
|
|
583
|
+
maxAttempts: number;
|
|
584
584
|
}>>;
|
|
585
585
|
readonly lifecycle: ObservabilityChannel<BaseEvent<"destroy"> | BaseEvent<"connect", {
|
|
586
586
|
connectionId: string;
|
|
@@ -589,28 +589,28 @@ declare const channels: {
|
|
|
589
589
|
code: number;
|
|
590
590
|
reason: string;
|
|
591
591
|
}>>;
|
|
592
|
-
readonly workflow: ObservabilityChannel<BaseEvent<"workflow:
|
|
592
|
+
readonly workflow: ObservabilityChannel<BaseEvent<"workflow:approved", {
|
|
593
593
|
workflowId: string;
|
|
594
|
-
|
|
594
|
+
reason?: string;
|
|
595
595
|
}> | BaseEvent<"workflow:event", {
|
|
596
596
|
workflowId: string;
|
|
597
597
|
eventType?: string;
|
|
598
|
-
}> | BaseEvent<"workflow:
|
|
598
|
+
}> | BaseEvent<"workflow:paused", {
|
|
599
599
|
workflowId: string;
|
|
600
|
-
|
|
600
|
+
workflowName?: string;
|
|
601
601
|
}> | BaseEvent<"workflow:rejected", {
|
|
602
602
|
workflowId: string;
|
|
603
603
|
reason?: string;
|
|
604
|
-
}> | BaseEvent<"workflow:
|
|
604
|
+
}> | BaseEvent<"workflow:restarted", {
|
|
605
605
|
workflowId: string;
|
|
606
606
|
workflowName?: string;
|
|
607
|
-
}> | BaseEvent<"workflow:
|
|
607
|
+
}> | BaseEvent<"workflow:resumed", {
|
|
608
608
|
workflowId: string;
|
|
609
609
|
workflowName?: string;
|
|
610
|
-
}> | BaseEvent<"workflow:
|
|
610
|
+
}> | BaseEvent<"workflow:start", {
|
|
611
611
|
workflowId: string;
|
|
612
612
|
workflowName?: string;
|
|
613
|
-
}> | BaseEvent<"workflow:
|
|
613
|
+
}> | BaseEvent<"workflow:terminated", {
|
|
614
614
|
workflowId: string;
|
|
615
615
|
workflowName?: string;
|
|
616
616
|
}>>;
|
|
@@ -629,8 +629,8 @@ declare const channels: {
|
|
|
629
629
|
subject: string;
|
|
630
630
|
}>>;
|
|
631
631
|
};
|
|
632
|
-
declare const genericObservability: Observability;
|
|
633
|
-
declare function subscribe<K extends keyof ChannelEventMap>(channelKey: K, callback: (event: ChannelEventMap[K]) => void): () => void;
|
|
632
|
+
export declare const genericObservability: Observability;
|
|
633
|
+
export declare function subscribe<K extends keyof ChannelEventMap>(channelKey: K, callback: (event: ChannelEventMap[K]) => void): () => void;
|
|
634
634
|
//#endregion
|
|
635
635
|
//#region src/agents/types.d.ts
|
|
636
636
|
type ObservabilityExecutionContext = DurableObjectState | ExecutionContext;
|
|
@@ -681,7 +681,7 @@ interface AgentSpanAttributes {
|
|
|
681
681
|
* Implements the Agents SDK Observability interface and converts
|
|
682
682
|
* events into OpenTelemetry spans.
|
|
683
683
|
*/
|
|
684
|
-
declare class OtelObservability implements Observability {
|
|
684
|
+
export declare class OtelObservability implements Observability {
|
|
685
685
|
private readonly config;
|
|
686
686
|
private readonly options;
|
|
687
687
|
private initialized;
|
|
@@ -689,7 +689,7 @@ declare class OtelObservability implements Observability {
|
|
|
689
689
|
private initialize;
|
|
690
690
|
emit(event: ObservabilityEvent, ctx?: ObservabilityExecutionContext): void;
|
|
691
691
|
}
|
|
692
|
-
declare function createOtelObservability(config: OtelObservabilityConfig): OtelObservability;
|
|
693
|
-
declare function createOtelObservabilityFromEnv(env: UnknownRecord, options?: AgentInstrumentationOptions): OtelObservability;
|
|
692
|
+
export declare function createOtelObservability(config: OtelObservabilityConfig): OtelObservability;
|
|
693
|
+
export declare function createOtelObservabilityFromEnv(env: UnknownRecord, options?: AgentInstrumentationOptions): OtelObservability;
|
|
694
694
|
//#endregion
|
|
695
|
-
export {
|
|
695
|
+
export type { AgentInstrumentationOptions, AgentObservabilityEvent, AgentSpanAttributes, BaseEvent, ChannelEventMap, MCPObservabilityEvent, Observability, ObservabilityEvent, OtelObservabilityConfig };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ConfigurationOption } from "autotel-edge";
|
|
2
2
|
//#region src/handlers/durable-objects.d.ts
|
|
3
|
+
/** `exception.type` of the alarm-loop signal. */
|
|
4
|
+
declare const RUNAWAY_ALARM_EXCEPTION = "autotel.RunawayAlarm";
|
|
3
5
|
/**
|
|
4
6
|
* Instrument a Durable Object class
|
|
5
7
|
*
|
|
@@ -91,4 +93,4 @@ declare function instrumentDO<C extends new (...args: any[]) => any>(doClass: C,
|
|
|
91
93
|
*/
|
|
92
94
|
declare function instrumentWorkflow<C extends new (...args: any[]) => any>(workflowClass: C, workflowName: string, config: ConfigurationOption): C;
|
|
93
95
|
//#endregion
|
|
94
|
-
export {
|
|
96
|
+
export { RUNAWAY_ALARM_EXCEPTION as n, instrumentDO as r, instrumentWorkflow as t };
|