autotel-hono 0.3.1 → 0.3.2
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/package.json +12 -5
- package/skills/autotel-hono/SKILL.md +49 -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')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-hono",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "OpenTelemetry Hono middleware powered by autotel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,14 +16,18 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"src",
|
|
19
|
-
"README.md"
|
|
19
|
+
"README.md",
|
|
20
|
+
"skills",
|
|
21
|
+
"!skills/_artifacts",
|
|
22
|
+
"bin"
|
|
20
23
|
],
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"
|
|
23
|
-
"autotel
|
|
25
|
+
"@tanstack/intent": "^0.0.13",
|
|
26
|
+
"autotel": "2.23.1",
|
|
27
|
+
"autotel-adapters": "0.1.2"
|
|
24
28
|
},
|
|
25
29
|
"peerDependencies": {
|
|
26
|
-
"hono": ">=4.12.
|
|
30
|
+
"hono": ">=4.12.5"
|
|
27
31
|
},
|
|
28
32
|
"peerDependenciesMeta": {
|
|
29
33
|
"hono": {
|
|
@@ -41,6 +45,9 @@
|
|
|
41
45
|
"url": "https://github.com/jagreehal/autotel",
|
|
42
46
|
"directory": "packages/autotel-hono"
|
|
43
47
|
},
|
|
48
|
+
"bin": {
|
|
49
|
+
"intent": "./bin/intent.js"
|
|
50
|
+
},
|
|
44
51
|
"scripts": {
|
|
45
52
|
"build": "tsup",
|
|
46
53
|
"dev": "tsup --watch",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: autotel-hono
|
|
3
|
+
description: >
|
|
4
|
+
OpenTelemetry middleware for Hono. Add otel() middleware to trace HTTP requests with semantic attributes, capture headers, and track request metrics.
|
|
5
|
+
type: integration
|
|
6
|
+
library: autotel-hono
|
|
7
|
+
library_version: "0.3.1"
|
|
8
|
+
sources:
|
|
9
|
+
- jagreehal/autotel:packages/autotel-hono/CLAUDE.md
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# autotel-hono
|
|
13
|
+
|
|
14
|
+
OpenTelemetry Hono middleware. One middleware call instruments all HTTP requests.
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { Hono } from 'hono';
|
|
20
|
+
import { otel } from 'autotel-hono';
|
|
21
|
+
|
|
22
|
+
const app = new Hono();
|
|
23
|
+
app.use(otel({ serviceName: 'my-api' }));
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
app.use(otel({
|
|
30
|
+
serviceName: 'my-api',
|
|
31
|
+
captureRequestHeaders: ['x-request-id'],
|
|
32
|
+
captureResponseHeaders: ['x-response-time'],
|
|
33
|
+
captureActiveRequests: true,
|
|
34
|
+
captureRequestDuration: true,
|
|
35
|
+
spanNameFactory: (c) => `${c.req.method} ${c.req.routePath}`,
|
|
36
|
+
}));
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## What Gets Traced
|
|
40
|
+
|
|
41
|
+
- Every HTTP request gets a span with method, route, URL, status code
|
|
42
|
+
- Errors (5xx) are recorded as span exceptions
|
|
43
|
+
- Optional: request/response headers, active request count, duration histogram
|
|
44
|
+
|
|
45
|
+
## Common Mistakes
|
|
46
|
+
|
|
47
|
+
- Do NOT call `otel()` per-route — register once with `app.use(otel(...))`.
|
|
48
|
+
- Do NOT pass a tracer unless you need a custom one — the middleware creates one from the global provider.
|
|
49
|
+
- Header capture requires listing header names upfront in config, not at request time.
|