autotel-cloudflare 2.16.0 → 2.17.1
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/bin/intent.js +6 -0
- package/dist/parse-error.d.ts +1 -0
- package/dist/parse-error.js +3 -0
- package/dist/parse-error.js.map +1 -0
- package/dist/sampling.d.ts +1 -0
- package/package.json +19 -8
- package/skills/autotel-cloudflare/SKILL.md +79 -0
- package/src/parse-error.ts +1 -0
package/bin/intent.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Auto-generated by @tanstack/intent setup
|
|
3
|
+
// Exposes the intent end-user CLI for consumers of this library.
|
|
4
|
+
// Commit this file, then add to your package.json:
|
|
5
|
+
// "bin": { "intent": "./bin/intent.js" }
|
|
6
|
+
await import('@tanstack/intent/intent-library')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ParsedError, parseError } from 'autotel-edge/parse-error';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"parse-error.js","sourcesContent":[]}
|
package/dist/sampling.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-cloudflare",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.1",
|
|
4
4
|
"description": "The #1 OpenTelemetry package for Cloudflare Workers - complete bindings coverage, native CF OTel integration, advanced sampling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,12 +42,19 @@
|
|
|
42
42
|
"./agents": {
|
|
43
43
|
"types": "./dist/agents.d.ts",
|
|
44
44
|
"import": "./dist/agents.js"
|
|
45
|
+
},
|
|
46
|
+
"./parse-error": {
|
|
47
|
+
"types": "./dist/parse-error.d.ts",
|
|
48
|
+
"import": "./dist/parse-error.js"
|
|
45
49
|
}
|
|
46
50
|
},
|
|
47
51
|
"files": [
|
|
48
52
|
"dist",
|
|
49
53
|
"src",
|
|
50
|
-
"README.md"
|
|
54
|
+
"README.md",
|
|
55
|
+
"skills",
|
|
56
|
+
"!skills/_artifacts",
|
|
57
|
+
"bin"
|
|
51
58
|
],
|
|
52
59
|
"keywords": [
|
|
53
60
|
"opentelemetry",
|
|
@@ -68,16 +75,17 @@
|
|
|
68
75
|
"license": "MIT",
|
|
69
76
|
"dependencies": {
|
|
70
77
|
"@opentelemetry/api": "^1.9.0",
|
|
71
|
-
"@opentelemetry/resources": "^2.
|
|
72
|
-
"
|
|
78
|
+
"@opentelemetry/resources": "^2.6.0",
|
|
79
|
+
"@tanstack/intent": "^0.0.13",
|
|
80
|
+
"autotel-edge": "3.15.1"
|
|
73
81
|
},
|
|
74
82
|
"peerDependencies": {
|
|
75
|
-
"@cloudflare/workers-types": "^4.
|
|
83
|
+
"@cloudflare/workers-types": "^4.20260307.1"
|
|
76
84
|
},
|
|
77
85
|
"devDependencies": {
|
|
78
|
-
"@cloudflare/workers-types": "^4.
|
|
79
|
-
"@opentelemetry/context-async-hooks": "^2.
|
|
80
|
-
"@types/node": "^25.3.
|
|
86
|
+
"@cloudflare/workers-types": "^4.20260307.1",
|
|
87
|
+
"@opentelemetry/context-async-hooks": "^2.6.0",
|
|
88
|
+
"@types/node": "^25.3.5",
|
|
81
89
|
"rimraf": "^6.1.3",
|
|
82
90
|
"tsup": "^8.5.1",
|
|
83
91
|
"typescript": "^5.9.3",
|
|
@@ -93,6 +101,9 @@
|
|
|
93
101
|
"url": "https://github.com/jagreehal/autotel/issues"
|
|
94
102
|
},
|
|
95
103
|
"homepage": "https://github.com/jagreehal/autotel/tree/main/packages/autotel-cloudflare#readme",
|
|
104
|
+
"bin": {
|
|
105
|
+
"intent": "./bin/intent.js"
|
|
106
|
+
},
|
|
96
107
|
"scripts": {
|
|
97
108
|
"build": "tsup",
|
|
98
109
|
"dev": "tsup --watch",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: autotel-cloudflare
|
|
3
|
+
description: >
|
|
4
|
+
OpenTelemetry for Cloudflare Workers. Instrument handlers, bindings (KV, R2, D1, AI, Vectorize, Queues, Durable Objects), and global fetch/cache. Multiple API styles for compatibility.
|
|
5
|
+
type: integration
|
|
6
|
+
library: autotel-cloudflare
|
|
7
|
+
library_version: "2.17.0"
|
|
8
|
+
sources:
|
|
9
|
+
- jagreehal/autotel:packages/autotel-cloudflare/CLAUDE.md
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# autotel-cloudflare
|
|
13
|
+
|
|
14
|
+
Complete OpenTelemetry for Cloudflare Workers. Three API styles, full bindings coverage.
|
|
15
|
+
|
|
16
|
+
## Quick Start — pick one style
|
|
17
|
+
|
|
18
|
+
### Style 1: instrument() (recommended)
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { instrument, instrumentKV } from 'autotel-cloudflare';
|
|
22
|
+
|
|
23
|
+
export default instrument(
|
|
24
|
+
{
|
|
25
|
+
async fetch(req, env, ctx) {
|
|
26
|
+
const kv = instrumentKV(env.MY_KV, { name: 'my-kv' });
|
|
27
|
+
const val = await kv.get('key'); // traced automatically
|
|
28
|
+
return new Response(val);
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{ service: { name: 'my-worker' } },
|
|
32
|
+
);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Style 2: wrapModule()
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { wrapModule } from 'autotel-cloudflare';
|
|
39
|
+
|
|
40
|
+
export default wrapModule(
|
|
41
|
+
{ service: { name: 'my-worker' } },
|
|
42
|
+
{ async fetch(req, env, ctx) { return new Response('OK'); } },
|
|
43
|
+
);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Style 3: Functional (from autotel-edge)
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { trace } from 'autotel-cloudflare';
|
|
50
|
+
export default { fetch: trace(async (req) => new Response('OK')) };
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Bindings Instrumentation
|
|
54
|
+
|
|
55
|
+
Every Cloudflare binding has a wrapper. Each creates spans for all operations.
|
|
56
|
+
|
|
57
|
+
| Binding | Wrapper | Import |
|
|
58
|
+
|---------|---------|--------|
|
|
59
|
+
| KV | `instrumentKV(env.KV, { name })` | `autotel-cloudflare` or `/bindings` |
|
|
60
|
+
| R2 | `instrumentR2(env.BUCKET, { name })` | same |
|
|
61
|
+
| D1 | `instrumentD1(env.DB, { name })` | same |
|
|
62
|
+
| Service Binding | `instrumentServiceBinding(env.SVC, { name })` | same |
|
|
63
|
+
| Workers AI | `instrumentAI(env.AI)` | same |
|
|
64
|
+
| Vectorize | `instrumentVectorize(env.INDEX, { name })` | same |
|
|
65
|
+
| Hyperdrive | `instrumentHyperdrive(env.HD, { name })` | same |
|
|
66
|
+
| Queue Producer | `instrumentQueueProducer(env.QUEUE, { name })` | same |
|
|
67
|
+
| Durable Objects | `instrumentDO(DOClass)` or `wrapDurableObject(config, DOClass)` | same |
|
|
68
|
+
|
|
69
|
+
Or use `instrumentBindings(env)` to auto-instrument all bindings at once.
|
|
70
|
+
|
|
71
|
+
## Handler Types
|
|
72
|
+
|
|
73
|
+
`instrument()` and `wrapModule()` automatically trace: `fetch`, `scheduled`, `queue`, `email`.
|
|
74
|
+
|
|
75
|
+
## Common Mistakes
|
|
76
|
+
|
|
77
|
+
- Do NOT call `instrumentKV()` etc. outside the handler — bindings aren't available at module scope.
|
|
78
|
+
- Do NOT use `await import()` for dynamic imports — use autotel's `safeRequire` helpers.
|
|
79
|
+
- Use `autotel-cloudflare/bindings` for tree-shaking if you only need binding wrappers.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseError, type ParsedError } from 'autotel-edge/parse-error';
|