Skip to content

fix(bench): bind-mount a writable capture dir for the demo collector (PR-N3.1) - #74

Merged
jensholdgaard merged 3 commits into
mainfrom
fix/otel-demo-capture-writable-path
May 31, 2026
Merged

fix(bench): bind-mount a writable capture dir for the demo collector (PR-N3.1)#74
jensholdgaard merged 3 commits into
mainfrom
fix/otel-demo-capture-writable-path

Conversation

@jensholdgaard

@jensholdgaard jensholdgaard commented May 31, 2026

Copy link
Copy Markdown
Owner

What

Fixes the first OTel Demo capture dispatch (run 26714187216), which failed at "Bring up the demo".

Root cause

The fileexporter couldn't open its output path:

error: open /tmp/otel-corpus.jsonl: no such file or directory ... id "file/corpus"
Error: cannot start pipelines: failed to start "file/corpus" exporter ...

The demo's collector is a distroless image (v0.142.0) with no writable /tmp, and the fileexporter does not create a missing parent directory — so it failed at startup and the collector crash-looped (restart: unless-stopped), never reaching a running state. My readiness guard correctly failed the step.

The rest of the demo came up fine on the runner — all ~20 images pulled, the collector process started, the OTLP receiver bound 4317/4318. The output path was the only blocker.

Fix

Bind-mount a runner-side directory into the collector at /capture and point the exporter at /capture/logs.jsonl:

  • New .github/otel-demo-capture-compose-override.yml adds ${OURIOS_CAPTURE_DIR}:/capture to the otel-collector service.
  • Layered onto the demo's base compose via COMPOSE_FILE (colon-separated; base relative to the demo workdir, override absolute so it's project-dir-independent).
  • The workflow mkdirs $OURIOS_CAPTURE_DIR (= ${{ github.workspace }}/captured) before up, so the mount target exists and the collector (root) can create the file in it.
  • Corpus now lands directly on the runner filesystem → the docker cp extract step is replaced by a non-empty verification + teardown (and dumps collector logs if the capture is empty).
  • Exporter path in otel-demo-capture-extras.yml updated /tmp/.../capture/logs.jsonl, with a comment explaining the distroless-/tmp trap.

Verification

  • All three YAML files validate with yaml.safe_load.
  • No Rust changes. The capture workflow is workflow_dispatch-only; the real test is the next dispatch after merge (which I'll run + report the corpus shape from).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Capture workflow now uses a dedicated host directory mounted into the demo environment so the collector writes captured logs directly to the runner filesystem.
    • Collector output path updated to write captured logs to the mounted host location for direct access.
    • Workflow creates and prepares the host directory, verifies captured output in-place (emitting collector logs on failure), then tears down and uploads captured artifacts.

…(PR-N3.1)

First capture dispatch (run 26714187216) failed: the
fileexporter couldn't open /tmp/otel-corpus.jsonl
("no such file or directory") and crash-looped the collector.
The demo's collector is a distroless image with no writable
/tmp, and the fileexporter does not create a missing parent
directory.

Fix: bind-mount a runner-side directory into the collector at
/capture via a compose override layered with COMPOSE_FILE, and
point the exporter at /capture/logs.jsonl. The directory is
mkdir'd on the host before `up` so the mount target exists, and
the corpus now lands straight on the runner filesystem — the
docker cp extract step is replaced by a non-empty verification +
teardown.

The rest of the demo came up fine on the runner (all ~20 images
pulled, collector started, OTLP receiver bound) — this was the
only blocker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a42fdabb-85ba-478e-b6f6-d6cd417bdec8

📥 Commits

Reviewing files that changed from the base of the PR and between 45684d1 and 2a1b5aa.

📒 Files selected for processing (1)
  • .github/otel-demo-capture-compose-override.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/otel-demo-capture-compose-override.yml

📝 Walkthrough

Walkthrough

The PR changes the OTel demo corpus capture to mount a host directory into the otel-collector, update the collector exporter to write to /capture/logs.jsonl, and modify the workflow to create the host directory, verify the captured file, and tear down the stack without using docker compose cp.

Changes

Bind-mounted corpus capture flow

Layer / File(s) Summary
Bind-mount infrastructure setup
.github/otel-demo-capture-compose-override.yml, .github/workflows/capture-otel-demo-corpus.yml
New Compose override mounts ${OURIOS_CAPTURE_DIR} on the host into the otel-collector at /capture. Workflow env vars set OURIOS_CAPTURE_DIR and COMPOSE_FILE, and the bring-up step creates and chmods the host directory before docker compose up.
Collector exporter configuration
.github/otel-demo-capture-extras.yml
Collector overlay updated: comments removed that assumed in-container /tmp, and the file/corpus exporter now writes to /capture/logs.jsonl (the bind-mounted host path).
Workflow capture directory and verification
.github/workflows/capture-otel-demo-corpus.yml
Replaces docker compose cp extraction with a verification step that checks $OURIOS_CAPTURE_DIR/logs.jsonl exists and is non-empty, tails collector logs on failure, and runs docker compose down -v before building the manifest and uploading artifacts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • jensholdgaard/ourios#73: Related OTel demo corpus capture changes that also adjust exporter path and workflow to use the mounted /capture directory.

Poem

🐰 I dug a tunnel, dug with care,
The logs now hop from there to here,
Mounted paths and checks in place,
No more copying out of space —
Capture lands safe on the host, hooray! 🎩

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main fix: bind-mounting a writable directory for the OTel Demo collector, which directly addresses the root cause of the failed capture run.
Description check ✅ Passed The description provides comprehensive context (what/why/fix/verification) and explains the root cause, solution, and validation approach, though it does not follow the template structure with its checklist sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/otel-demo-capture-writable-path

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the workflow-dispatched OTel Demo corpus capture by writing the collector fileexporter output to a bind-mounted host directory instead of an in-container /tmp path, aligning the capture path with the demo collector’s distroless filesystem constraints.

Changes:

  • Adds a Compose override that mounts ${OURIOS_CAPTURE_DIR} into the demo collector at /capture.
  • Updates the collector fileexporter path to /capture/logs.jsonl.
  • Updates the workflow to create the host capture directory, verify the captured file directly, and tear down the demo stack.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
.github/workflows/capture-otel-demo-corpus.yml Adds shared capture/Compose env, creates the bind-mounted directory, and verifies the host-side corpus file.
.github/otel-demo-capture-extras.yml Changes the fileexporter destination from /tmp to /capture/logs.jsonl and documents why.
.github/otel-demo-capture-compose-override.yml Adds the Compose service override that bind-mounts the runner capture directory into the collector.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/capture-otel-demo-corpus.yml (1)

167-167: ⚡ Quick win

Reuse $OURIOS_CAPTURE_DIR instead of re-deriving the path.

This step hardcodes $GITHUB_WORKSPACE/captured, duplicating the OURIOS_CAPTURE_DIR definition. If the capture dir is ever changed in the env: block, this step silently diverges.

-          cd "$GITHUB_WORKSPACE/captured"
+          cd "$OURIOS_CAPTURE_DIR"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/capture-otel-demo-corpus.yml at line 167, The workflow
step currently changes directory with a hardcoded path cd
"$GITHUB_WORKSPACE/captured" which duplicates the OURIOS_CAPTURE_DIR definition;
update that step to use the environment variable instead (cd
"$OURIOS_CAPTURE_DIR") so the step follows the single source of truth for the
capture directory (look for the step containing the cd command and the env var
OURIOS_CAPTURE_DIR).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/otel-demo-capture-compose-override.yml:
- Around line 19-22: The bind-mounted capture directory used by the
otel-collector service (volume entry `${OURIOS_CAPTURE_DIR}:/capture` in the
otel-collector service) must be writable by UID 10001 because the
opentelemetry-collector-contrib image runs as USER 10001:10001; ensure the host
directory referenced by `${OURIOS_CAPTURE_DIR}` is owned by or writable to UID
10001 (e.g., chown -R 10001:10001 ${OURIOS_CAPTURE_DIR} or set permissive mode
like chmod 0777) so the collector's fileexporter can create logs.jsonl without
permission denied errors.

---

Nitpick comments:
In @.github/workflows/capture-otel-demo-corpus.yml:
- Line 167: The workflow step currently changes directory with a hardcoded path
cd "$GITHUB_WORKSPACE/captured" which duplicates the OURIOS_CAPTURE_DIR
definition; update that step to use the environment variable instead (cd
"$OURIOS_CAPTURE_DIR") so the step follows the single source of truth for the
capture directory (look for the step containing the cd command and the env var
OURIOS_CAPTURE_DIR).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0066e438-e256-4140-8f88-77881881b217

📥 Commits

Reviewing files that changed from the base of the PR and between 02f33ad and 6688c62.

📒 Files selected for processing (3)
  • .github/otel-demo-capture-compose-override.yml
  • .github/otel-demo-capture-extras.yml
  • .github/workflows/capture-otel-demo-corpus.yml

Comment thread .github/otel-demo-capture-compose-override.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread .github/otel-demo-capture-compose-override.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@jensholdgaard
jensholdgaard merged commit b08b177 into main May 31, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants