Document enabling query metrics for self-hosted MongoDB 8.0 - #39441
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
Add a Query Metrics section to the self-hosted MongoDB DBM setup page explaining that query stats collection is disabled by default and must be enabled via the internalQueryStatsSampleRate server parameter, with config file, command line, and runtime setParameter examples.
lu-zhengda
force-pushed
the
zhengda.lu/mongo-querystats-docs
branch
from
August 24, 2026 21:18
7170c04 to
697ede8
Compare
lu-zhengda
marked this pull request as ready for review
August 24, 2026 21:23
dalextorres
approved these changes
Aug 24, 2026
Contributor
There was a problem hiding this comment.
The command-line example configures only mongod. A sharded deployment also needs the parameter on each mongos process.
🤖 Datadog Autotest · Commit 697ede8 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
| Or pass it on the command line: | ||
|
|
||
| {{< code-block lang="shell" >}} | ||
| mongod --setParameter internalQueryStatsSampleRate=1.0 |
Contributor
There was a problem hiding this comment.
Add the mongos command-line form
Users can leave query statistics off on mongos and miss query metrics for router traffic.
Assertion details
- Input: A user enables query metrics from the command line for a
mongosprocess in a sharded cluster. - Expected:
The command-line option must show both server types or use a binary placeholder. - Actual: The command example starts
mongodonly. It gives no command formongos.
Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
drichards-87
approved these changes
Aug 24, 2026
Contributor
Preview links (active after the
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do? What is the motivation?
Adds a Query Metrics section to the self-hosted MongoDB DBM setup page explaining that query metrics for self-hosted MongoDB require MongoDB 8.0+ and that query stats collection is disabled by default on the server.
The mongo DBM integration's query metrics feature reads via the
$queryStatsaggregation pipeline, but the integration cannot enable collection itself — users must set theinternalQueryStatsSampleRateserver parameter on eachmongod/mongos. Without this section, self-hosted MongoDB 8.0 users would not know they need to enable a server parameter to get query metrics.The section shows the three ways to set the parameter (config file, command line, and runtime
setParameter), notes that the runtime form is not persistent, and links to the MongoDB Query Stats server-parameters documentation.Merge instructions
Merge readiness:
AI assistance
Used Claude Code for research (MongoDB
$queryStatsserver parameter behavior) and initial draft of the doc section; manually reviewed and adjusted.Additional notes
The
internalQueryStatsSampleRate=1.0value (100% sampling) matches what was validated in the DBM agent integration environment. Users can lower the value to reduce overhead.