Skip to content

Commit c75079b

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-33233-query-analyzer-metrics (#5541) (#5554)
* DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics * DOCSP-33233-query-analyzer-metrics --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent e18fbd2 commit c75079b

4 files changed

+23
-11
lines changed

source/includes/analyzeShardKey-command-fields.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
Defaults to ``true``.
4343

44+
.. include:: /includes/analyzeShardKey-read-and-write-distribution-metrics.rst
45+
4446
* - ``sampleRate``
4547
- double
4648
- Optional
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To return read and write distribution metrics for a collection using
2+
:dbcommand:`analyzeShardKey`, you must configure the query
3+
analyzer to sample the queries run on the collection. Otherwise,
4+
``analyzeShardKey`` returns the read and write distribution metrics as
5+
``0`` values. To configure the query analyzer, see
6+
:ref:`configureQueryAnalyzer`.

source/includes/analyzeShardKey-readWriteDistribution-structure.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ returned when ``readWriteDistribution`` is set to ``true``:
4141
}
4242
}
4343
44+
.. include:: /includes/analyzeShardKey-read-and-write-distribution-metrics.rst
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
1-
``readWriteDistribution`` consists of the metrics about the query
1+
``readWriteDistribution`` contains metrics about the query
22
routing patterns and the :ref:`hotness
33
<sharding-troubleshooting-monotonicity>` of shard key ranges. These
4-
metrics are based on sampled queries. You can configure query sampling
5-
for a collection with ``configureQueryAnalyzer``. These
6-
metrics are only returned when ``readWriteDistribution`` is true. The
7-
metrics are calculated when |analyzeShardKey| is run based on sampled
8-
read and write queries and are not be returned if there are no sampled
9-
queries.
4+
metrics are based on sampled queries.
5+
6+
To configure query sampling for a collection, use the
7+
``configureQueryAnalyzer`` command. The read and write distribution
8+
metrics are only returned if ``readWriteDistribution`` is ``true``. The
9+
metrics are calculated when |analyzeShardKey| is run and the metrics use
10+
the sampled read and write queries. If there are no sampled queries,
11+
read and write distribution metrics aren't returned.
1012

1113
- If there are no sampled read queries, the command returns
1214
``writeDistribution`` but omits ``readDistribution``.
1315

1416
- If there are no sampled write queries, the command returns
1517
``readDistribution`` but omits ``writeDistribution``.
1618

19+
.. include:: /includes/analyzeShardKey-read-and-write-distribution-metrics.rst
1720

1821
.. list-table::
1922
:header-rows: 1
2023

2124
* - ``keyCharacteristics`` Value
2225
- ``readWriteDistribution`` Value
23-
- Behaviors
26+
- Results Returned
2427

2528
* - ``true``
2629
- ``false``
@@ -30,8 +33,8 @@ queries.
3033
omits :ref:`readWriteDistribution <read-write-distribution-output>`
3134
metrics.
3235

33-
- If the shard key does not have a |suppindx|,
34-
|analyzeShardKey| raises an
36+
- If the shard key doesn't have a |suppindx|,
37+
|analyzeShardKey| returns an
3538
``IllegalOperation`` error.
3639

3740
* - ``false``
@@ -45,6 +48,6 @@ queries.
4548
- |analyzeShardKey| returns both ``readWriteDistribution``
4649
metrics and ``keyCharacteristics`` metrics.
4750

48-
- If the shard key does not have a supporting index,
51+
- If the shard key doesn't have a supporting index,
4952
|analyzeShardKey| returns ``readWriteDistribution`` metrics
5053
and omits ``keyCharacteristics`` metrics.

0 commit comments

Comments
 (0)