HTML Report for Dagger
|
Thomas SharedInbox
6fac57ae5a
Add receiver and report tests with real trace spans
receiver_test.go: sends actual OTLP HTTP posts to the receiver and verifies spans are captured end-to-end (name, timestamps, cached flag). report_test.go: generates HTML from real span+sample data and checks that span names appear, cached color is present, HTML structure is valid, and the command string is properly escaped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| cmd/dagger-report | Add dagger-report: HTML report generator for Dagger pipelines | |
| internal | Add receiver and report tests with real trace spans | |
| .gitignore | gitignore | |
| go.mod | Add dagger-report: HTML report generator for Dagger pipelines | |
| LICENSE | Initial commit | |
| README.md | Add dagger-report: HTML report generator for Dagger pipelines | |
html-report-for-dagger
A CLI tool that wraps any command, captures its OpenTelemetry (OTLP) traces and system resource usage, then produces a self-contained HTML report with:
- Gantt chart — span timeline showing parallelism and cached steps
- CPU / Memory / Network charts — sampled every second during the run
- Sortable span table — all spans ranked by duration
Works best with Dagger pipelines, but wraps any command that emits OTLP traces.
Install
go install github.com/guettli/html-report-for-dagger/cmd/dagger-report@latest
Or build from source:
git clone https://codeberg.org/guettli/html-report-for-dagger
cd html-report-for-dagger
go build -o dagger-report ./cmd/dagger-report
Usage
dagger-report [flags] -- <command> [args...]
| Flag | Default | Description |
|---|---|---|
-o <file> |
dagger-report-TIMESTAMP.html |
Output HTML path |
-interval <duration> |
1s |
Resource sampling interval |
With Dagger
dagger-report -- dagger run go test ./...
dagger-report -o ci-report.html -- dagger run ./ci/build
With any OTLP-instrumented command
dagger-report -- my-tool --some-flag
The tool sets these environment variables for the wrapped command:
OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:<random-port>
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
If the wrapped command doesn't emit OTLP traces, the report still shows the
resource charts. If the command exits non-zero, dagger-report propagates that
exit code after writing the report.
How it works
- Starts an embedded OTLP HTTP receiver on a random local port
- Starts a resource sampler reading
/proc/stat,/proc/meminfo,/proc/net/dev - Runs the wrapped command with the OTEL env vars injected
- After the command exits, waits 500ms for any last trace flushes
- Generates a single self-contained HTML file (no external dependencies)
Development
go test ./...
go build ./cmd/dagger-report
No external Go dependencies — only the standard library.
Requirements
- Go 1.22+
- Linux (resource sampling reads
/proc; other platforms produce the report with zero resource samples)