A guide to tracing MongoDB queries in .NET applications using MongoDB's built-in OpenTelemetry instrumentation and Sentry's OTLP ingestion. The setup uses the Sentry.OpenTelemetry.Exporter package to wire OpenTelemetry spans directly to Sentry, avoiding a bespoke SDK integration. Key topics include enabling OTLP mode to prevent duplicate spans, capturing query command context, handling PII in query data via custom ActivityProcessor scrubbers or Sentry's Relay parameterization, and correlating MongoDB spans with errors and replays through propagation context bridging.

6m read timeFrom blog.sentry.io
Post cover image
Table of contents
Why this approachQuick refresher: MongoDB + Activity in .NETPrerequisitesWiring it upCapturing useful MongoDB query dataWhat about PII in query data?Correlating traces with Sentry errors and replaysViewing the data in SentryClosing thoughts
578 Impressions