Skip to content

Commit 44df421

Browse files
committed
Add dial9-viewer README with usage, API docs, and dev workflow
1 parent cba2fd7 commit 44df421

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

dial9-viewer/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# dial9-viewer
2+
3+
CLI tool that serves a web UI for browsing and viewing [dial9-tokio-telemetry](../dial9-tokio-telemetry) trace files stored in S3.
4+
5+
## Quick start
6+
7+
```bash
8+
# Build
9+
cargo build -p dial9-viewer
10+
11+
# Run with a default bucket
12+
AWS_PROFILE=my-profile cargo run -p dial9-viewer -- --bucket my-trace-bucket
13+
14+
# Run with a bucket and prefix
15+
AWS_PROFILE=my-profile cargo run -p dial9-viewer -- --bucket my-trace-bucket --prefix traces
16+
17+
# Custom port
18+
cargo run -p dial9-viewer -- --port 8080 --bucket my-trace-bucket
19+
```
20+
21+
Open `http://localhost:3000` to browse traces. Enter a search prefix (e.g. `2026-04-09/1910/checkout-api`), select one or more trace segments, and click "View Selected" to open them in the trace viewer.
22+
23+
## CLI options
24+
25+
| Flag | Default | Description |
26+
|------|---------|-------------|
27+
| `--port` | `3000` | Port to listen on |
28+
| `--bucket` | none | Default S3 bucket (can also be set per-request in the UI) |
29+
| `--prefix` | none | Default S3 key prefix prepended to searches |
30+
| `--ui-dir` | `ui` | Directory containing static UI files |
31+
32+
## API
33+
34+
| Endpoint | Description |
35+
|----------|-------------|
36+
| `GET /api/search?q=<prefix>&bucket=<bucket>` | List S3 objects matching the prefix |
37+
| `GET /api/trace?keys=<k1,k2,...>&bucket=<bucket>` | Fetch, gunzip, and concatenate trace segments |
38+
39+
The trace endpoint returns raw binary data (`application/octet-stream`) suitable for loading directly in the trace viewer via `?trace=` URL parameter. Maximum response size is 50 MB.
40+
41+
## S3 key layout
42+
43+
The viewer expects the [time-first key layout](../dial9-tokio-telemetry/design/s3-worker-design.md) used by `dial9-tokio-telemetry`'s S3 worker:
44+
45+
```
46+
{prefix}/{YYYY-MM-DD}/{HHMM}/{service}/{instance}/{epoch}-{index}.bin.gz
47+
```
48+
49+
Search by entering prefixes that match this structure, e.g.:
50+
- `2026-04-09/` — all traces from April 9
51+
- `2026-04-09/1910/` — traces from the 19:10 minute bucket
52+
- `2026-04-09/1910/checkout-api/` — traces from checkout-api at 19:10
53+
54+
## Development
55+
56+
The UI is plain HTML/JS with no build step. Edit files in `ui/` and refresh the browser.
57+
58+
```bash
59+
# Run the server (serves ui/ from disk — edit and refresh)
60+
cargo run -p dial9-viewer -- --bucket my-bucket
61+
62+
# Or use serve.py for UI-only iteration (no backend)
63+
./dial9-viewer/serve.py
64+
```
65+
66+
The existing `dial9-tokio-telemetry/serve.py` still works for iterating on the trace viewer (`index.html`) without the S3 browser.
67+
68+
## Testing
69+
70+
```bash
71+
cargo nextest run -p dial9-viewer
72+
```
73+
74+
Integration tests use [s3s](https://docs.rs/s3s/) to run a fake S3 server in-process.
75+
76+
## Future enhancements
77+
78+
- Structured search query parser (e.g. `19:10-19:20 checkout-api`)
79+
- Bucket listing endpoint and dropdown
80+
- Rich result metadata (service, instance, timestamp columns)
81+
- Deep linking with time range parameters
82+
- Pluggable backends (local filesystem, GCS)

0 commit comments

Comments
 (0)