Skip to content

Commit f7c8253

Browse files
(DOCSP-33099): queryStats serverStatus metrics (#4811)
* (DOCSP-26200): queryStats aggregation stage * WIP * WIP * WIP * Remove accidental file * add TODO * add missing ref * formatting * WIP * WIP * WIP * wording * WIP * edits * add examples * try to fix table format * add transformed example * remove TODO * more table formatting * add atlas data collection * table formatting * clarity * add more context for data collection * table formatting * wording tweaks * address review comments * formatting * use simplified examples * add input/output * edits * add link to transformed example * spacing * edits * (DOCSP-33099): queryStats serverStatus metrics * (DOCSP-33099): serverStatus metrics for queryStats * formatting * clarity * address review comments * fix incomplete sentence * rework transformation section * edits * remove notion of a 'cache' * remove extra queryStats heading * minimalism * fix collation link formatting * move virtual collection details to the queryStats page * change wording for output fields * (DOCSP-26200): queryStats aggregation stage * WIP * WIP * WIP * Remove accidental file * add TODO * add missing ref * formatting * WIP * WIP * WIP * wording * WIP * edits * add examples * try to fix table format * add transformed example * remove TODO * more table formatting * add atlas data collection * table formatting * clarity * add more context for data collection * table formatting * wording tweaks * address review comments * formatting * use simplified examples * add input/output * edits * add link to transformed example * spacing * edits * address review comments * fix incomplete sentence * rework transformation section * edits * fix collation link formatting * change wording for output fields * edit glossary * more edits * remove glossary entry * formatting * edits * Address review feedback * wording * review edit * address review comments * edit * wording * WIP review edits * remove Atlas data collection info * (DOCSP-33347): Re-add Atlas data collection info * typo * minimalism * typo * clarity * remove Atlas data collection info * edits * (DOCSP-33347): Re-add Atlas data collection info * add find queryShape properties * change case * formatting * abstracted > normalized consistency * clarify privilege * address review comments * review edits
1 parent 7be30ee commit f7c8253

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

source/reference/command/serverStatus.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3883,6 +3883,55 @@ planCache
38833883
Number of slot-based execution engine query plans which were not found
38843884
in the query cache and went through the query planning phase.
38853885

3886+
.. _server-status-queryStats:
3887+
3888+
queryStats
3889+
~~~~~~~~~~
3890+
3891+
.. versionadded:: 7.1
3892+
3893+
.. code-block:: javascript
3894+
3895+
queryStats: {
3896+
numEvicted: Long("<num>"),
3897+
numRateLimitedRequests: Long("<num>"),
3898+
queryStatsStoreSizeEstimateBytes: Long("<num>"),
3899+
numQueryStatsStoreWriteErrors: Long("<num>"),
3900+
numHmacApplicationErrors: Long("<num>")
3901+
},
3902+
3903+
.. serverstatus:: queryStats
3904+
3905+
A document that contains metrics for the :pipeline:`$queryStats`
3906+
aggregation stage.
3907+
3908+
.. serverstatus:: queryStats.numEvicted
3909+
3910+
Number of queries that the ``$queryStats`` virtual collection has
3911+
evicted due to space contraints.
3912+
3913+
.. serverstatus:: queryStats.numRateLimitedRequests
3914+
3915+
Number of times that query stats were not recorded for a query due to
3916+
rate limiting.
3917+
3918+
.. serverstatus:: queryStats.queryStatsStoreSizeEstimateBytes
3919+
3920+
Current estimated size of objects in the ``$queryStats`` virtual
3921+
collection.
3922+
3923+
.. serverstatus:: queryStats.numQueryStatsStoreWriteErrors
3924+
3925+
Number of times this MongoDB process failed to store a new query
3926+
stats key. Generally, these failures happen when the
3927+
``$queryStats`` virtual collection runs out of space.
3928+
3929+
.. serverstatus:: queryStats.numHmacApplicationErrors
3930+
3931+
Number of times this MongoDB process failed to compute a one-way
3932+
tokenized query stats key when ``$queryStats`` was called with the
3933+
``transformIdentifiers`` option.
3934+
38863935
.. _server-status-queryAnalyzers:
38873936

38883937
queryAnalyzers

source/reference/operator/aggregation/queryStats.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ Behavior
126126
The following sections describe behavioral details of the
127127
``$queryStats`` stage.
128128

129+
How $queryStats Tracks Query Statistics
130+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131+
132+
Statistics for the ``$queryStats`` stage are tracked in a virtual
133+
collection that is stored in-memory. The memory limit for the virtual
134+
collection is 1% of the system's total memory.
135+
129136
How $queryStats Groups Returned Documents
130137
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131138

source/release-notes/7.1.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ serverStatus Output Change
9898
output:
9999

100100
Change Stream Metrics
101-
- :serverstatus:`metrics.changeStreams.showExpandedEvents`
101+
:serverstatus:`metrics.changeStreams.showExpandedEvents`
102+
103+
Query Stats Metrics
104+
:serverstatus:`queryStats`
102105

103106
.. toctree::
104107
:titlesonly:

0 commit comments

Comments
 (0)