( 01 / 03 )Multi-Service DB Profiler

Explain profiling for teams who run multiple services

TraceMole correlates query explain plans across Next.js, Node, and Python to catch slow COLLSCANs before MongoDB warning emails reach your inbox.

$

Open Source SDK

Auditable OpenTelemetry wrappers for Next.js, Node, and Python. See exactly what telemetry leaves your stack.

Query Origin Tracing

Pinpoint the exact microservice and filename line number causing a COLLSCAN database degradation.

Slack & Discord Webhooks

Instant alerts with index suggestions pushed to your communication channels when scan ratios exceed 1,000.

( 02 / 03 )Product Capabilities
Open Source SDKs

100% transparent telemetry built on OpenTelemetry

Audit every query telemetry attribute before it ships. We use open-source wrappers built directly on top of standard OpenTelemetry client APIs to ensure performance profiles are fully transparent and auditable.

// @tracemole/nextjs-mongodb-explain // Audit the SDK. See exactly what leaves your servers. import { withTraceMole } from "@tracemole/nextjs-mongodb-explain"; export default withTraceMole({ instrumentations: [ new MongoDBInstrumentation({ // We only extract explain metrics and query structures // Your raw data payloads never leave your database captureAttributes: ["db.mongodb.query.explain"] }) ] });
Explain Engine

Catch COLLSCANs and 1000+ Scan-to-Return ratios

Identify unindexed tables and high scan rates in real time. We profile incoming queries and cross-reference them with database statistics to flag COLLSCAN pipelines before they degrade customer APIs.

mongodb://cluster0.x9j2.mongodb.net
Live Ingesting
findusers
IXSCAN12ms
db.users.find({ email: "faisal@example.com" })
stage: IXSCAN (index: email_1)
aggregateorders
COLLSCAN482ms
db.orders.aggregate([ { $match: { status: "pending" } }, { $group: { _id: "$userId", total: { $sum: "$amount" } } } ])
Missing compound index on 'status' & 'userId'
findtraces
COLLSCAN284ms
db.traces.find({ projectId: "pr_98a3b", timestamp: { $gte: ISODate("...") } })
Missing index on 'projectId' + 'timestamp'
updateManysessions
IXSCAN95ms
db.sessions.updateMany({ expiresAt: { $lt: new Date() } }, { $set: { active: false } })
stage: IXSCAN (index: expiresAt_1)
findorganizations
IXSCAN4ms
db.organizations.find({ slug: "tracemole-org" })
stage: IXSCAN (index: slug_1)
aggregatetraces
COLLSCAN712ms
db.traces.aggregate([ { $match: { duration: { $gt: 500 } } }, { $sort: { timestamp: -1 } } ])
Slow: N+1 query pattern detected
findusers
IXSCAN12ms
db.users.find({ email: "faisal@example.com" })
stage: IXSCAN (index: email_1)
aggregateorders
COLLSCAN482ms
db.orders.aggregate([ { $match: { status: "pending" } }, { $group: { _id: "$userId", total: { $sum: "$amount" } } } ])
Missing compound index on 'status' & 'userId'
findtraces
COLLSCAN284ms
db.traces.find({ projectId: "pr_98a3b", timestamp: { $gte: ISODate("...") } })
Missing index on 'projectId' + 'timestamp'
updateManysessions
IXSCAN95ms
db.sessions.updateMany({ expiresAt: { $lt: new Date() } }, { $set: { active: false } })
stage: IXSCAN (index: expiresAt_1)
findorganizations
IXSCAN4ms
db.organizations.find({ slug: "tracemole-org" })
stage: IXSCAN (index: slug_1)
aggregatetraces
COLLSCAN712ms
db.traces.aggregate([ { $match: { duration: { $gt: 500 } } }, { $sort: { timestamp: -1 } } ])
Slow: N+1 query pattern detected
findusers
IXSCAN12ms
db.users.find({ email: "faisal@example.com" })
stage: IXSCAN (index: email_1)
aggregateorders
COLLSCAN482ms
db.orders.aggregate([ { $match: { status: "pending" } }, { $group: { _id: "$userId", total: { $sum: "$amount" } } } ])
Missing compound index on 'status' & 'userId'
findtraces
COLLSCAN284ms
db.traces.find({ projectId: "pr_98a3b", timestamp: { $gte: ISODate("...") } })
Missing index on 'projectId' + 'timestamp'
updateManysessions
IXSCAN95ms
db.sessions.updateMany({ expiresAt: { $lt: new Date() } }, { $set: { active: false } })
stage: IXSCAN (index: expiresAt_1)
findorganizations
IXSCAN4ms
db.organizations.find({ slug: "tracemole-org" })
stage: IXSCAN (index: slug_1)
aggregatetraces
COLLSCAN712ms
db.traces.aggregate([ { $match: { duration: { $gt: 500 } } }, { $sort: { timestamp: -1 } } ])
Slow: N+1 query pattern detected
All Connected Services

Trace queries from all services using your database

Monitor query performance across your entire stack. TraceMole aggregates explain plan telemetry from Next.js APIs, Python background workers, and any other services querying your database, so you know exactly who runs unindexed COLLSCANs.

// Query origin traces mapped across all your services [Trace ID: 89a3f2b8] ── Next.js API (Gateway) -> Status: 200 (242ms) └─ [Span: db_query] MongoDB find() on "users" -> IXSCAN (3ms) [Trace ID: 74f109ae] ── Python background-worker (Job) -> Status: Active └─ [Span: db_query] MongoDB aggregate() on "orders" -> COLLSCAN (482ms) ⚠ ALERT: Scan/Returned Ratio is 1,240,954 : 14 (Critical) ⚠ SOURCE: python-ingest-service/tasks.py:L142
Slack & Discord Alerts

Proactive alerting before database latency cascades

Stay notified as performance anomalies emerge. Setup Discord and Slack webhooks to push formatted alerts with the exact compound index setup statements needed to fix issues immediately.

GET /api/checkout/process748ms
└─ middleware.verifySession32ms
└─ db.users.findOne (email)✓ IXSCAN (4ms)
└─ db.orders.aggregate (COLLSCAN)processing... (712ms)
Status: Profiling normal
tracemole-hq
Channels
# general
# engineering-alerts
# logs
Webhook Active
# engineering-alertsTraceMole Feed
Waiting for Slack Webhook payload...
Message #engineering-alertsSend
Interactive View: TRACE
[Trace Waterfall][Slack Alert]
( 03 / 03 )Operational Pipeline

Three steps to optimized indexing

( 01 / INTEGRATE )

Install Open Source SDK

Install SDKs built on OpenTelemetry. Auditable source code ensures you know exactly what database attributes leave your application.

( 02 / ANALYZE )

Correlate explain metrics

TraceMole automatically checks the explain patterns of incoming requests. It monitors the scan/return ratios across all client drivers.

( 03 / ALERT )

Receive instant webhooks

Receive Slack or Discord notifications with the exact query string and suggested compound index creation code as soon as a scan ratio exceeds 1000.

INGEST_READY

Get ahead of MongoDB alerts

$ npm i @tracemole/nextjs-mongodb-explain

Open source SDKs. Private cloud ingest dashboard. Connect your first database trace in 2 minutes.