Skip to content

chore(api,services): remove Sentry integration - #1726

Merged
carsonfarmer merged 2 commits into
mainfrom
chore/remove-sentry-api-services
Aug 12, 2026
Merged

chore(api,services): remove Sentry integration#1726
carsonfarmer merged 2 commits into
mainfrom
chore/remove-sentry-api-services

Conversation

@carsonfarmer

Copy link
Copy Markdown
Member

Summary

Removes the Sentry integration from the API server and the services package (part of winding down Sentry since we no longer actively monitor it). Companion PRs: comps removal (#1725) and load-test removal (to follow).

Changes — apps/api

  • Remove Sentry init from src/index.ts (startup init, profiling option, expressErrorHandler middleware — the custom errorHandler remains)
  • Delete lib/sentry.ts, lib/sentry-config.ts (tiered trace sampling: 10% trade/admin, 1% default, 0% health checks), types/sentry.ts
  • Delete database/sentry-wrapper.ts (opt-in Drizzle query-span wrapper behind ENABLE_SENTRY_DB_MONITORING) and unwrap db/dbRead in database/db.ts
  • Delete lib/performance/drizzle-query-interceptor.ts — its doc comment says it's shared with a performance profiler, but the Sentry wrapper was its only consumer in the tree, so it becomes dead code
  • Drop @sentry/node + @sentry/profiling-node deps; remove Sentry env vars from apps/api/turbo.json and .env.example
  • Remove API-scoped Sentry vars from root turbo.json (ENABLE_SENTRY_PROFILING, SENTRY_PROFILE_SAMPLE_RATE, SENTRY_DATABASE_SAMPLE_RATE, ENABLE_SENTRY_DB_MONITORING). Vars still read by comps/load-test code on main are intentionally left; the load-test PR does the final sweep.

Changes — packages/services

  • Remove all 35 Sentry call sites (breadcrumbs, captureException, captureMessage) across the four price providers (rpc-spot, alchemy-rpc, hyperliquid-perps, symphony-perps)
  • No loss of log visibility: every removed capture already had an adjacent structured this.logger call with the same context; the processingTime field that only the Sentry captures carried was folded into those logger calls
  • The 1% raw-data sampling in the perps providers is kept — it populates rawData for database storage, which is independent of Sentry (only the "also send a sample to Sentry" part was removed)
  • Circuit-breaker open events are still logged via logger.warn (only the extra Sentry message was dropped)
  • Remove the @sentry/node mocks from the three provider test files; drop the @sentry/node dep

Docs / agent guidance

  • AGENTS.md: drop the "Sentry is configured…" bullet
  • .cursor/rules/api-specific-config.mdc: remove the Error Tracking & APM (Sentry) section — it explicitly instructed AI agents to add Sentry.addBreadcrumb()/captureException() when integrating external APIs, which would have caused Sentry usage to creep back in

Trade-off to be aware of

API errors are no longer aggregated in Sentry — visibility is via structured pino logs and the existing Prometheus metrics on port 3003 (alerting is already handled externally per AGENTS.md, so the alerting path is unchanged).

Verification

  • pnpm turbo build --filter=api --filter=@recallnet/services
  • pnpm --filter api lint && pnpm --filter @recallnet/services lint
  • pnpm --filter @recallnet/services test — 108 files, 2,147 tests passed ✅
  • Full pre-push hook (monorepo pnpm lint && pnpm format:check && pnpm build) ✅

The API already boots without Sentry env vars (it logged "Sentry DSN not configured, skipping initialization"), so this PR is safe to deploy in any order relative to the env cleanup below.

⚠️ Required human actions (not performed by this PR)

This PR intentionally touches code only:

  1. API deployment environment (wherever the API runs — infra/IaC, not Vercel): remove these env vars: SENTRY_DSN, SENTRY_ENVIRONMENT, ENABLE_SENTRY_DB_MONITORING, ENABLE_SENTRY_PROFILING, SENTRY_TRACES_SAMPLE_RATE, SENTRY_CRITICAL_SAMPLE_RATE, SENTRY_API_SAMPLE_RATE, SENTRY_DATABASE_SAMPLE_RATE, SENTRY_PROFILE_SAMPLE_RATE.
  2. Sentry (recallnet org): archive or delete the API project once this is deployed.
  3. Alerting check: confirm no alert rules, Slack integrations, or on-call runbooks reference the API Sentry project before deleting it (AGENTS.md says alerting is Prometheus-based, but worth a scan).
  4. After this and the companion PRs (chore(comps): remove Sentry integration #1725 + load-test) are merged and their projects deleted, cancel the Sentry subscription for the recallnet org.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comps Ready Ready Preview Aug 12, 2026 5:15pm

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📊 Test Coverage Report

Package Lines Statements Functions Branches
apps/api 2.24% (-0.21%) 2.24% (-0.21%) 42.96% (-1.15%) 52.08% (+0.1%)
apps/comps 0.27% 0.27% 37.52% 39.61%
packages/conversions 100.00% 100.00% 100.00% 100.00%
packages/db 4.30% 4.30% 20.86% 37.11%
packages/rewards 100.00% 100.00% 100.00% 100.00%
packages/services 52.80% (+0.02%) 52.80% (+0.02%) 66.76% (-0.15%) 79.39% (+0.06%)
packages/staking-contracts 100.00% 100.00% 100.00% 100.00%

carsonfarmer and others added 2 commits August 12, 2026 10:06
Sentry is no longer actively monitored. Remove initialization, the
Express error handler, tiered trace sampling config, the optional
Drizzle query-span wrapper (and the now-unused DrizzleQueryInterceptor
base class whose only consumer it was), and all capture/breadcrumb
call sites in the price providers. Every removed capture site already
had an adjacent structured logger call, so error visibility in logs is
unchanged; processingTime context from removed captures was folded into
the logger calls. The 1% raw-data sampling in the perps providers is
kept - it feeds database storage, not Sentry. Also updates AGENTS.md
and .cursor rules so agents no longer add Sentry instrumentation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Regenerated against main after the comps Sentry removal (#1725)
merged: the lockfile diff drops the @sentry/profiling-node tree
(@sentry/node itself remains for load-test until #1727), and the root
turbo.json globalEnv keeps only SENTRY_DSN and
SENTRY_TRACES_SAMPLE_RATE - the other Sentry vars lost their last
readers with #1725 plus this PR. Verified with a frozen-lockfile
install.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@carsonfarmer
carsonfarmer enabled auto-merge (squash) August 12, 2026 17:09
@carsonfarmer
carsonfarmer force-pushed the chore/remove-sentry-api-services branch from 8eba52d to d3872eb Compare August 12, 2026 17:09
@carsonfarmer
carsonfarmer merged commit 2ebbe25 into main Aug 12, 2026
11 checks passed
@carsonfarmer
carsonfarmer deleted the chore/remove-sentry-api-services branch August 12, 2026 17:21
carsonfarmer added a commit that referenced this pull request Aug 12, 2026
Regenerated the lockfile against main after #1725 and #1726 merged:
with load-test's @sentry/node and @sentry/tracing gone, the entire
remaining @sentry tree prunes (718 deletions, no churn). The only
Sentry string left in the lockfile is @sentry/core@9.46.0, a
transitive dependency of hardhat's own crash reporting - not our
integration. Also removes SENTRY_DSN and SENTRY_TRACES_SAMPLE_RATE
from root turbo.json globalEnv; this PR deletes their last readers.
Verified with a frozen-lockfile install.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
carsonfarmer added a commit that referenced this pull request Aug 12, 2026
## Summary

Removes the Sentry integration from the load-testing package and its CI
workflow. This is the last of the Sentry removal PRs — companions: comps
(#1725) and api/services (#1726).

### Changes

- Delete `src/agent-trading/utils/sentry-metrics.ts` (init, span
metrics, flush, traces-link helper)
- `processors/agent-trading-processor.ts`:
- Remove module-load `initializeSentry()` and the Sentry-only Artillery
hooks: `cleanupSentry`, `trackScenarioExecution`, `startTradeFlow`,
`finishTradeFlow`
- Keep `trackLoadTestMetrics` as the `afterResponse` hook — it still
logs failing requests (status, agent, request/response bodies) to the
console, which is what actually shows up in CI logs; only the Sentry
span/message emission was removed
- All 19 remaining exports verified present and loadable; every function
referenced by the YAML configs exists
- All four Artillery configs (`daily`, `resilience`, `stress`, `tge`):
remove references to the deleted hooks (including the `after:` blocks
that only flushed Sentry); all four verified to still parse as valid
YAML
- `cli.ts`: remove `--traces-sample-rate` / `--request-sample-rate`
flags, Sentry env plumbing, and the post-run "View results in Sentry"
traces link
- `report-analyzer.ts`: reword recommendations that pointed at Sentry
dashboards to point at application logs
- Drop `@sentry/node` and `@sentry/tracing` deps (`@sentry/tracing` was
declared but **never imported anywhere** — pure dead weight)
- Remove the 5 `SENTRY_*` env declarations from
`packages/load-test/turbo.json` and the `.env.example` block; update
README and AGENTS.md
- `.github/workflows/load-testing.yml`: stop injecting
`secrets.SENTRY_DSN` into the test env

### Verification

- `pnpm --filter @recallnet/load-test lint` ✅
- All four Artillery YAML configs parse ✅
- `npx tsx src/cli.ts --help` runs; processor module loads with all
YAML-referenced functions present ✅
- Full pre-push hook (monorepo `pnpm lint && pnpm format:check && pnpm
build`) ✅

### Note on merge order

Recommended merge order for the three Sentry PRs: #1725#1726 → this
one, rebasing each after the previous merges (`pnpm-lock.yaml` conflicts
resolve with `pnpm install`). Order isn't strictly required — each PR is
self-contained — but this order keeps rebases trivial.

## ⚠️ Required human actions (not performed by this PR)

This PR intentionally touches **code only**:

1. **GitHub repository settings**: delete the `SENTRY_DSN` Actions
secret (Settings → Secrets and variables → Actions). It's unreferenced
after this merges.
2. **Sentry (recallnet org)**: archive/delete the load-testing project
(the one `SENTRY_PROJECT_ID` pointed at).
3. **Final repo tidy-up (after all three Sentry PRs merge)**: a handful
of `SENTRY_*` entries remain in the root `turbo.json` `globalEnv` list
(each PR could only remove the vars whose last code reader it deleted,
or lint would fail on the still-present code from the other PRs). Once
all three are merged, the leftovers (`SENTRY_DSN`, `SENTRY_ENVIRONMENT`,
`SENTRY_TRACES_SAMPLE_RATE`, `SENTRY_CRITICAL_SAMPLE_RATE`,
`SENTRY_API_SAMPLE_RATE`) are unreferenced and can be deleted in a
one-line follow-up. They're inert in the meantime.
4. **Cancel the Sentry subscription** for the `recallnet` org once all
three PRs are deployed and the projects are archived. Consider
exporting/archiving any issue history first if anyone wants it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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