feat(hub): optional New Relic APM via key-gated entrypoint (closes #3) - #266
Merged
Conversation
Boot the hub under the New Relic Node agent only when NEW_RELIC_LICENSE_KEY is set in the operator's .env — the key is never committed, never baked into the image, and verified not to leak into logs. Without the key the entrypoint execs plain `node hub/dist/server.js` with zero agent code loaded. - hub/docker-entrypoint.sh: key-gated exec; ESM app needs both `--import newrelic/esm-loader.mjs` and `-r newrelic`; path-based specifiers because newrelic lives in hub/node_modules (pnpm layout) and cwd must stay /app for relative data-path defaults - Env-only agent config (NEW_RELIC_NO_CONFIG_FILE=true, log to stdout); APM entity defaults to poutine-hub-<POUTINE_INSTANCE_ID> so federated hubs report as separate entities - @newrelic/native-metrics + @newrelic/fn-inspect allowed in pnpm.onlyBuiltDependencies for event-loop/GC/CPU metrics - Docs: README operator section, hub-internals env rows + Observability section, example.env monitoring block Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3.
Adds optional New Relic APM monitoring to the hub, activated only when the operator sets
NEW_RELIC_LICENSE_KEYin.env. The key is never committed, never baked into the image, and verified not to appear in logs.How it works
hub/docker-entrypoint.shis the container CMD. With the key set, it boots the hub under the agent (node --import newrelic/esm-loader.mjs -r newrelic— the ESM app needs both hooks). Without the key it execs plainnode hub/dist/server.js; zero agent code loads.newreliclives inhub/node_modulesunder the pnpm workspace layout, and cwd must stay/appso relative data-path defaults (e.g.POUTINE_PASSWORD_KEY_PATH) keep resolving.NEW_RELIC_NO_CONFIG_FILE=true, agent log to stdout). APM entity defaults topoutine-hub-<POUTINE_INSTANCE_ID>so federated hubs reporting to one account show as separate entities.@newrelic/native-metrics+@newrelic/fn-inspectadded to rootpnpm.onlyBuiltDependenciesfor event-loop/GC/CPU metrics.Verification
pnpm verifygreen,pnpm lintzero output.NEW_RELIC_APP_NAME.Docs: README operator section,
docs/hub-internals.md(env rows + Observability section),example.envmonitoring block.🤖 Generated with Claude Code