autotel-cloudflare 2.17.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 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')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-cloudflare",
3
- "version": "2.17.0",
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",
@@ -51,7 +51,10 @@
51
51
  "files": [
52
52
  "dist",
53
53
  "src",
54
- "README.md"
54
+ "README.md",
55
+ "skills",
56
+ "!skills/_artifacts",
57
+ "bin"
55
58
  ],
56
59
  "keywords": [
57
60
  "opentelemetry",
@@ -72,16 +75,17 @@
72
75
  "license": "MIT",
73
76
  "dependencies": {
74
77
  "@opentelemetry/api": "^1.9.0",
75
- "@opentelemetry/resources": "^2.5.1",
76
- "autotel-edge": "3.15.0"
78
+ "@opentelemetry/resources": "^2.6.0",
79
+ "@tanstack/intent": "^0.0.13",
80
+ "autotel-edge": "3.15.1"
77
81
  },
78
82
  "peerDependencies": {
79
- "@cloudflare/workers-types": "^4.20260302.0"
83
+ "@cloudflare/workers-types": "^4.20260307.1"
80
84
  },
81
85
  "devDependencies": {
82
- "@cloudflare/workers-types": "^4.20260302.0",
83
- "@opentelemetry/context-async-hooks": "^2.5.1",
84
- "@types/node": "^25.3.3",
86
+ "@cloudflare/workers-types": "^4.20260307.1",
87
+ "@opentelemetry/context-async-hooks": "^2.6.0",
88
+ "@types/node": "^25.3.5",
85
89
  "rimraf": "^6.1.3",
86
90
  "tsup": "^8.5.1",
87
91
  "typescript": "^5.9.3",
@@ -97,6 +101,9 @@
97
101
  "url": "https://github.com/jagreehal/autotel/issues"
98
102
  },
99
103
  "homepage": "https://github.com/jagreehal/autotel/tree/main/packages/autotel-cloudflare#readme",
104
+ "bin": {
105
+ "intent": "./bin/intent.js"
106
+ },
100
107
  "scripts": {
101
108
  "build": "tsup",
102
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.