You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Investigate a rewatch OTEL trace report from a span ID.
4
+
user-invocable: true
5
+
---
6
+
7
+
# OTEL Investigation Skill
8
+
9
+
The user invokes this as `/investigate-otel <span_id>` where `<span_id>` is a 16-character hex string identifying an `lsp.llm_report` span in the local otel-viewer.
10
+
11
+
## OTEL Viewer API (http://localhost:4707)
12
+
13
+
Only these endpoints exist — do NOT invent others:
14
+
15
+
-`GET /api/spans/{span_id}/context` — **start here** for `lsp.llm_report` spans. Returns the report's `message` attribute AND the session timeline (filtered `did_save`/`did_change`/`flush` siblings) in one call.
16
+
-`GET /api/spans/{span_id}/flush` — structured flush summary with errors inlined. Use for flush spans found in the context.
17
+
-`GET /api/spans/{span_id}` — full span detail (attributes, events). Use for drill-down.
18
+
-`GET /api/spans/{span_id}/children` — direct children of a span. Use for drill-down.
19
+
20
+
## Procedure
21
+
22
+
1.**Fetch context** — this is the entry point, gives you the report message and session timeline:
Copy file name to clipboardExpand all lines: AGENTS.md
+21-17Lines changed: 21 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -387,21 +387,7 @@ make test-rewatch # Run integration tests
387
387
388
388
**Note**: The rewatch project is located in the `rewatch/` directory with its own `Cargo.toml` file. All cargo commands should be run from the project root using the `--manifest-path rewatch/Cargo.toml` flag, as shown in the CI workflow.
389
389
390
-
**Integration Tests**: The `make test-rewatch` command runs bash-based integration tests located in `rewatch/tests/suite.sh`. These tests use the `rewatch/testrepo/` directory as a test workspace with various package configurations to verify rewatch's behavior across different scenarios.
391
-
392
-
**Running Individual Integration Tests**: You can run individual test scripts directly by setting up the environment manually:
This is useful for iterating on a specific test without running the full suite.
390
+
**Integration Tests**: The `make test-rewatch` command runs Vitest-based integration tests located in `tests/rewatch_tests/`. These tests use a sandbox copy of `tests/rewatch_tests/fixture/` to verify rewatch's behavior across different scenarios (build, watch, clean, format, etc.).
405
391
406
392
#### Debugging
407
393
@@ -410,6 +396,26 @@ This is useful for iterating on a specific test without running the full suite.
410
396
-**Dependencies**: Inspect module dependency graph in `deps.rs`
411
397
-**File Watching**: Monitor file change events in `watcher.rs`
412
398
399
+
#### OpenTelemetry Tracing
400
+
401
+
Rewatch supports OpenTelemetry (OTEL) tracing for build, watch, and LSP commands. Any OTLP-compatible viewer (Jaeger, Grafana, etc.) will work. For a lightweight option tailored to rewatch development, see `rewatch/otel-viewer/` — it requires only `uv` (no Docker) and includes features like LLM export.
402
+
403
+
```bash
404
+
# Start the viewer (see rewatch/otel-viewer/README.md for setup)
405
+
cd rewatch/otel-viewer
406
+
uv run python server.py
407
+
```
408
+
409
+
Then run rewatch with the OTLP endpoint set:
410
+
411
+
```bash
412
+
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4707 cargo run --manifest-path rewatch/Cargo.toml -- build
413
+
```
414
+
415
+
Open http://localhost:4707 to browse traces.
416
+
417
+
Note: Use `tracing::debug!` (not `log::debug!`) for events you want to appear in OTEL traces — they use separate logging systems.
418
+
413
419
#### Running Rewatch Directly
414
420
415
421
When running the rewatch binary directly (via `cargo run` or the compiled binary) during development, you need to set environment variables to point to the local compiler and runtime. Otherwise, rewatch will try to use the installed versions:
@@ -493,5 +499,3 @@ When clippy suggests refactoring that could impact performance, consider the tra
493
499
## CI Gotchas
494
500
495
501
-**`sleep` is fragile** — Prefer polling (e.g., `wait_for_file`) over fixed sleeps. CI runners are slower than local machines.
496
-
-**`exit_watcher` is async** — It only signals the watcher to stop (removes the lock file), it doesn't wait for the process to exit. Avoid triggering config-change events before exiting, as the watcher may start a concurrent rebuild.
497
-
-**`sed -i` differs across platforms** — macOS requires `sed -i '' ...`, Linux does not. Use the `replace` / `normalize_paths` helpers from `rewatch/tests/utils.sh` instead of raw `sed`.
0 commit comments