autotel-devtools 0.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 +156 -0
- package/dist/cli.cjs +889 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +886 -0
- package/dist/cli.js.map +1 -0
- package/dist/error-aggregator-BkO0l8ak.d.ts +147 -0
- package/dist/error-aggregator-CtZmjm-k.d.cts +147 -0
- package/dist/exporter-qIQPDw29.d.cts +159 -0
- package/dist/exporter-qIQPDw29.d.ts +159 -0
- package/dist/index.cjs +1242 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1234 -0
- package/dist/index.js.map +1 -0
- package/dist/server/exporter.cjs +154 -0
- package/dist/server/exporter.cjs.map +1 -0
- package/dist/server/exporter.d.cts +4 -0
- package/dist/server/exporter.d.ts +4 -0
- package/dist/server/exporter.js +152 -0
- package/dist/server/exporter.js.map +1 -0
- package/dist/server/index.cjs +1237 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/server/index.d.cts +38 -0
- package/dist/server/index.d.ts +38 -0
- package/dist/server/index.js +1222 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/log-exporter.cjs +111 -0
- package/dist/server/log-exporter.cjs.map +1 -0
- package/dist/server/log-exporter.d.cts +50 -0
- package/dist/server/log-exporter.d.ts +50 -0
- package/dist/server/log-exporter.js +109 -0
- package/dist/server/log-exporter.js.map +1 -0
- package/dist/server/remote-exporter.cjs +219 -0
- package/dist/server/remote-exporter.cjs.map +1 -0
- package/dist/server/remote-exporter.d.cts +87 -0
- package/dist/server/remote-exporter.d.ts +87 -0
- package/dist/server/remote-exporter.js +217 -0
- package/dist/server/remote-exporter.js.map +1 -0
- package/dist/widget.global.js +2 -0
- package/package.json +96 -0
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# autotel-devtools
|
|
2
|
+
|
|
3
|
+
Standalone OTLP receiver with web UI for local development. Think TanStack Devtools for OpenTelemetry.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`autotel-devtools` provides two modes:
|
|
8
|
+
|
|
9
|
+
1. **Standalone OTLP Receiver** - Run as CLI to receive OpenTelemetry data
|
|
10
|
+
2. **Embeddable Widget** - Add a devtools panel to your web app
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
┌─────────────────────────────────────────────┐
|
|
14
|
+
│ Standalone Mode │
|
|
15
|
+
│ │
|
|
16
|
+
│ npx autotel-devtools │
|
|
17
|
+
│ ┌───────────────────────────────────────┐ │
|
|
18
|
+
│ │ HTTP Server (port 4318) │ │
|
|
19
|
+
│ │ ├── POST /v1/traces ← OTLP JSON │ │
|
|
20
|
+
│ │ ├── POST /v1/logs ← OTLP JSON │ │
|
|
21
|
+
│ │ ├── POST /v1/metrics ← OTLP JSON │ │
|
|
22
|
+
│ │ ├── GET / → Full page UI │ │
|
|
23
|
+
│ │ ├── GET /widget.js → Widget bundle │ │
|
|
24
|
+
│ │ ├── GET /healthz → Health check │ │
|
|
25
|
+
│ │ └── WS /ws ←→ WebSocket │ │
|
|
26
|
+
│ └───────────────────────────────────────┘ │
|
|
27
|
+
└─────────────────────────────────────────────┘
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Standalone Mode
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Run the OTLP receiver
|
|
36
|
+
npx autotel-devtools
|
|
37
|
+
|
|
38
|
+
# Configure your app to send to it
|
|
39
|
+
OTEL_EXPORTER_OTLP_PROTOCOL=http/json \
|
|
40
|
+
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
|
|
41
|
+
node app.js
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Open http://localhost:4318 to see traces, logs, and metrics.
|
|
45
|
+
|
|
46
|
+
### Embedded Widget
|
|
47
|
+
|
|
48
|
+
Add the widget to your web app:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<script src="http://localhost:4318/widget.js"></script>
|
|
52
|
+
<autotel-devtools></autotel-devtools>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or programmatically:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<script>
|
|
59
|
+
// Mount the widget manually
|
|
60
|
+
const container = document.createElement('div');
|
|
61
|
+
document.body.appendChild(container);
|
|
62
|
+
|
|
63
|
+
// Auto-detect WebSocket URL
|
|
64
|
+
const script = document.currentScript;
|
|
65
|
+
const widgetUrl = new URL(script.src);
|
|
66
|
+
const wsUrl = `ws://${widgetUrl.host}/ws`;
|
|
67
|
+
|
|
68
|
+
// Widget opens as a floating panel
|
|
69
|
+
</script>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Programmatic API
|
|
73
|
+
|
|
74
|
+
Use in Node.js with autotel:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { init, trace } from 'autotel';
|
|
78
|
+
import { createDevtools } from 'autotel-devtools';
|
|
79
|
+
|
|
80
|
+
const { server, httpServer, exporter, port, close } = createDevtools({
|
|
81
|
+
port: 4318,
|
|
82
|
+
verbose: true,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Wire up to autotel
|
|
86
|
+
init({
|
|
87
|
+
service: 'my-app',
|
|
88
|
+
endpoint: 'http://localhost:4318',
|
|
89
|
+
spanProcessors: [exporter], // Stream to devtools
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Your traced code
|
|
93
|
+
const myFunction = trace((ctx) => async () => {
|
|
94
|
+
// ... this span appears in devtools
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Architecture
|
|
99
|
+
|
|
100
|
+
### Server (Node.js)
|
|
101
|
+
|
|
102
|
+
- **DevtoolsServer** - WebSocket server + in-memory data store
|
|
103
|
+
- **HTTP Routes** - OTLP receivers for traces/logs/metrics
|
|
104
|
+
- **Exporters** - OpenTelemetry span/log exporters
|
|
105
|
+
|
|
106
|
+
### Widget (Preact)
|
|
107
|
+
|
|
108
|
+
- **Shadow DOM** - Isolated styles, no conflicts with app CSS
|
|
109
|
+
- **Preact Signals** - Reactive state management
|
|
110
|
+
- **Views** - Traces, Logs, Metrics, Errors, Resources, Service Map
|
|
111
|
+
|
|
112
|
+
## Features
|
|
113
|
+
|
|
114
|
+
### Implemented
|
|
115
|
+
|
|
116
|
+
- ✅ Real-time OTLP ingestion (traces, logs, metrics)
|
|
117
|
+
- ✅ WebSocket streaming with history replay
|
|
118
|
+
- ✅ Traces view with waterfall + flame graph
|
|
119
|
+
- ✅ Logs view with severity/resource filtering
|
|
120
|
+
- ✅ Error aggregation and grouping
|
|
121
|
+
- ✅ Service map visualization
|
|
122
|
+
- ✅ Resources view (derived from telemetry)
|
|
123
|
+
- ✅ Search with debounce (300ms)
|
|
124
|
+
- ✅ Configurable telemetry limits (env vars)
|
|
125
|
+
- ✅ Widget position persistence (localStorage)
|
|
126
|
+
- ✅ Export traces as JSON
|
|
127
|
+
- ✅ Custom element support (`<autotel-devtools>`)
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
### Environment Variables
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
AUTOTEL_MAX_TRACE_COUNT=10000 # Max traces to keep (default: 100)
|
|
135
|
+
AUTOTEL_MAX_LOG_COUNT=10000 # Max logs to keep (default: 100)
|
|
136
|
+
AUTOTEL_MAX_METRIC_COUNT=50000 # Max metrics to keep (default: 100)
|
|
137
|
+
AUTOTEL_DEVTOOLS_PORT=4318 # Server port (default: 4318)
|
|
138
|
+
AUTOTEL_DEVTOOLS_HOST=127.0.0.1 # Bind host (default: 127.0.0.1)
|
|
139
|
+
AUTOTEL_DEVTOOLS_TITLE="My App" # Dashboard title (optional)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### CLI Options
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npx autotel-devtools --port 4319 --host 0.0.0.0
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Options:
|
|
149
|
+
|
|
150
|
+
- `--port, -p` - Port to listen on (default: 4318)
|
|
151
|
+
- `--host, -H` - Host to bind to (default: 127.0.0.1)
|
|
152
|
+
- `--title, -t` - Dashboard title
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|