Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
bf2d5f2
Introduce OpenTelemetry in rewatch
jfrolich Apr 19, 2026
2fcad19
Improve rewatch span propagation
jfrolich Apr 19, 2026
d2a7396
Fix compile_file spans not nested under compile_wave in OTEL traces
jfrolich Apr 19, 2026
ece9e1b
Add changelog entry for OpenTelemetry support
jfrolich Apr 19, 2026
55993c2
Rewatch: don't suppress logs when OTEL telemetry is enabled
jfrolich Apr 19, 2026
4b2c86d
Rewatch: gate compile_file span attrs behind tracing::enabled!
jfrolich Apr 19, 2026
efb8486
Rewatch: report all package-spec suffixes/module_systems on compile_f…
jfrolich Apr 19, 2026
937046b
Rewatch telemetry: honor OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES
jfrolich Apr 19, 2026
4b972a0
Rewatch telemetry: let SDK resolve the OTLP endpoint
jfrolich Apr 19, 2026
6ea8c65
Rewatch: replace TelemetryGuard ref with a plain bool in run_main
jfrolich Apr 19, 2026
34794c5
Rewatch: explain why the telemetry guard must be dropped before exit
jfrolich Apr 19, 2026
7dc20ee
Rewatch telemetry: standardize span names to dotted style
jfrolich Apr 19, 2026
f870077
Rewatch telemetry: encapsulate otel_enabled behind an accessor
jfrolich Apr 19, 2026
e064ffe
Rewatch telemetry: use Path::file_name for PPX span attribute
jfrolich Apr 19, 2026
94c8741
Rewatch telemetry: gate dirty-module count in build.parse span
jfrolich Apr 19, 2026
d9613ca
Rewatch telemetry: add unit tests for init paths
jfrolich Apr 19, 2026
e67e1f0
Rewatch telemetry: document honored OTEL environment variables
jfrolich Apr 19, 2026
925f13a
Rewatch telemetry: move CLI-command spans onto their real functions
jfrolich Apr 19, 2026
a042952
Rewatch: impl AsRef<Path> for FolderArg
jfrolich Apr 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,39 @@ This is useful for iterating on a specific test without running the full suite.
- **Dependencies**: Inspect module dependency graph in `deps.rs`
- **File Watching**: Monitor file change events in `watcher.rs`

#### OpenTelemetry Tracing

Rewatch supports OpenTelemetry (OTEL) tracing for build and watch commands. To visualize traces locally, run a Jaeger all-in-one container:

```bash
docker run -d --name jaeger \
-p 4317:4317 -p 4318:4318 -p 16686:16686 \
jaegertracing/all-in-one
```

Then run rewatch with the OTLP endpoint set:

```bash
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 cargo run --manifest-path rewatch/Cargo.toml -- build
```

Open http://localhost:16686 to view traces in the Jaeger UI.

Note: Use `tracing::debug!` (not `log::debug!`) for events you want to appear in OTEL traces — they use separate logging systems.

##### Honored environment variables

Rewatch follows the OTEL spec for configuration — no rewatch-specific knobs exist.

| Variable | Purpose |
|---|---|
| `OTEL_EXPORTER_OTLP_ENDPOINT` | Base endpoint of the collector (e.g. `http://localhost:4318`). `/v1/traces` is appended for the trace exporter. Setting this (or `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`) is what enables telemetry — if neither is set, tracing is a no-op. |
| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | Full trace endpoint used verbatim. Overrides the general endpoint for traces. |
| `OTEL_EXPORTER_OTLP_HEADERS` | Extra headers on exporter requests (e.g. `authorization=Bearer xyz`). |
| `OTEL_SERVICE_NAME` | Service name reported on spans. Defaults to `rewatch`. |
| `OTEL_RESOURCE_ATTRIBUTES` | Comma-separated `key=value` pairs added as resource attributes (e.g. `deployment.environment=ci,host.name=$HOSTNAME`). |
| `RUST_LOG` | Controls which span/event levels are captured (e.g. `RUST_LOG=info`, `RUST_LOG=rewatch=debug`). Defaults to `debug` when telemetry is enabled. |

#### Running Rewatch Directly

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:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#### :nail_care: Polish

- Allow builds while watchers are running. https://github.com/rescript-lang/rescript/pull/8349
- Build system: Add OpenTelemetry tracing support for cli commands.

#### :house: Internal

Expand Down
Loading
Loading