Skip to content

chore: import instrumentation module in api container entrypoint#1167

Merged
adityachoudhari26 merged 1 commit into
mainfrom
import-instrumentation
Jun 8, 2026
Merged

chore: import instrumentation module in api container entrypoint#1167
adityachoudhari26 merged 1 commit into
mainfrom
import-instrumentation

Conversation

@adityachoudhari26

@adityachoudhari26 adityachoudhari26 commented Jun 8, 2026

Copy link
Copy Markdown
Member

The API is instrumented with OpenTelemetry but none of its telemetry reaches Datadog, because the SDK only initializes via Node's --import flag and the Dockerfile runs node index.js without it (only the npm scripts pass it), so sdk.start() never runs in prod. Adding the flag to the CMD fixes it — the collector→Datadog path already works, so once this ships the API will start reporting traces/metrics/logs and we can finally monitor it.

Copilot AI review requested due to automatic review settings June 8, 2026 20:15
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00a4d0cf-e1f8-4112-9fc8-962bb3433f4d

📥 Commits

Reviewing files that changed from the base of the PR and between 04d5cdd and 5cadad8.

📒 Files selected for processing (1)
  • apps/api/Dockerfile

📝 Walkthrough

Walkthrough

The API container startup command is updated to load an instrumentation module at Node process startup using the --import flag. This ensures instrumentation hooks are registered before the main application code runs.

Changes

API Instrumentation Startup

Layer / File(s) Summary
Node startup instrumentation hook
apps/api/Dockerfile
The Docker CMD is updated from node index.js to node --import ./instrumentation.js index.js, enabling the instrumentation module to load at process startup.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • ctrlplanedev/ctrlplane#483: Similar instrumentation module loading at Node startup for the event-worker container (using -r ./dist/instrumentation-node.js).

Poem

🐰 A hook at startup, clean and bright,
Instrumentation loads just right,
Before the code begins to run,
The tracing journey has begun!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding instrumentation module import to the API container startup command via Node's import hook.
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 import-instrumentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Updates the API container entrypoint to preload the OpenTelemetry instrumentation module at startup, aligning the Docker runtime behavior with the app’s existing start script.

Changes:

  • Modify the API Docker image CMD to run Node with --import ./instrumentation.js before index.js.

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

Comment thread apps/api/Dockerfile
Comment on lines 67 to +69
WORKDIR /app/apps/api/dist/src/

CMD ["node", "index.js"]
CMD ["node", "--import", "./instrumentation.js", "index.js"]
@adityachoudhari26 adityachoudhari26 merged commit 935332f into main Jun 8, 2026
11 checks passed
@adityachoudhari26 adityachoudhari26 deleted the import-instrumentation branch June 8, 2026 20:22
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.

3 participants