Sentry: trace requests only, MCP calls at a lower rate; KG writes each edge once per pass - #794
Merged
Merged
Conversation
…tes each edge once per pass - tracesSampler: HTTP requests at SENTRY_TRACES_SAMPLE_RATE, MCP routes at SENTRY_MCP_TRACES_SAMPLE_RATE (default a fifth), health probes and root spans with no request (background Prisma/pg work) never. Incoming trace decisions are not inherited: MCP clients send their own sampled traceparent. - The observational KG ingest runs with tracing suppressed: scheduled from an MCP call, its queries were spans of that call's trace. - correlate() counts bumps per edge and writes each distinct edge once, with the same end state (observations, confidence, matchKey, status), instead of a read and an update per shared value.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
At 5 % the cloud backend sent about 700,000 spans a day to Sentry, far past a plan's quota. By volume:
SELECTand anUPDATEonkg_edgesfor every shared value, even when many values link the same two nodes;pg-pool.connect,prisma:client:*, bare SQL), each sampled as a transaction of its own.Changes
common/sentry-sampler.ts: only HTTP requests are traced. MCP routes useSENTRY_MCP_TRACES_SAMPLE_RATE, default a fifth ofSENTRY_TRACES_SAMPLE_RATE./healthis never traced. Incoming sampling decisions are not inherited, because MCP clients send their own sampledtraceparent.KgObservationalService.ingestOrganizationruns underSentry.suppressTracing. Errors are still reported.correlate()counts bumps per distinct edge and writes each edge once. The end state is the same as the sequential writes: observations, confidence, the lastmatchKeyset, and status (a rejected or manual edge keeps its own). Thereferencesconfirmation runs once per node pair.Tests
sentry-sampler.spec.ts.hdbdriver that isn't installed here.