Skip to content

Enable Sentry tracing, profiling, sessions and runtime metrics - #69

Merged
NinjaLikesCheez merged 2 commits into
mainfrom
cursor/sentry-setup-510c
Oct 8, 2026
Merged

NinjaLikesCheez merged 2 commits into
mainfrom
cursor/sentry-setup-510c

Conversation

@NinjaLikesCheez

@NinjaLikesCheez NinjaLikesCheez commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Turn Pixel’s Sentry setup from “errors and logs only” into something useful for a long-running Node Discord bot.

Enabled (when SENTRY_DSN is set):

  • Error sampling: sampleRate 1 (always keep errors; this was already the SDK default, now explicit)
  • Tracing: tracesSampleRate 1 by default — a command span per slash command / autocomplete, plus outbound HTTP (SpaceAPI, Home Assistant, Discord REST)
  • Profiling: @sentry/profiling-node (pinned to 11.2.0 to match @sentry/node) with profileLifecycle: "trace" so sampled command spans get a CPU profile. Native install script is allowed in pnpm-workspace.yaml (@sentry/node-cpu-profiler); prebuilt binaries cover Node 24 on glibc (the Docker image).
  • Sessions: process sessions stay on (SDK default) for crash-free rate of the bot process. Incoming HTTP request sessions are off, so /healthz and /readyz probes do not count as sessions
  • Metrics: Node runtime metrics (CPU, memory, event-loop delay, uptime) every 30s; pixel.command count on each command
  • Logs / feedback / cron heartbeat: unchanged

Health probes are not traced. Missing DSN still leaves Sentry off. Secrets (SENTRY_DSN, tokens) are still not logged. Auth, identity and the dispatcher’s access checks are untouched.

New env vars:

  • SENTRY_TRACES_SAMPLE_RATE (0–1, default 1)
  • SENTRY_PROFILE_SESSION_SAMPLE_RATE (0–1, default 1; 0 leaves the profiler unwired)

Documented in config.ts, .env.example, the architecture config table, and the runbook.

Does not touch core/access*, core/identity*, core/dispatcher*, core/registry* or services/access-config*.

Why a new dependency: Sentry’s Node CPU profiler is a separate native package. It is the only way to get profiles on command traces. The version is pinned to 11.2.0 so it stays on the same SDK line as @sentry/node.

Open in Web Open in Cursor 

Turn traces on at sample rate 1 (SENTRY_TRACES_SAMPLE_RATE) so a long-running
Discord bot gets command spans, outbound HTTP traces, process sessions and
Node runtime metrics. Health probes stay off the trace and session counts.
Errors remain unsampled. Missing DSN still leaves Sentry off.
@sentry/profiling-node (pinned to 11.2.0 with @sentry/node) profiles
command spans in trace lifecycle. Default session sample rate is 1;
SENTRY_PROFILE_SESSION_SAMPLE_RATE=0 leaves the native integration off.
@cursor cursor Bot changed the title Enable Sentry tracing, sessions and runtime metrics Enable Sentry tracing, profiling, sessions and runtime metrics Oct 8, 2026
@NinjaLikesCheez
NinjaLikesCheez marked this pull request as ready for review October 8, 2026 19:15
@NinjaLikesCheez
NinjaLikesCheez merged commit 2c5a019 into main Oct 8, 2026
4 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.

1 participant