@@ -2435,6 +2435,39 @@ shardingStatistics
2435
2435
.. code-block:: javascript
2436
2436
2437
2437
"shardingStatistics" : {
2438
+ "numHostsTargeted": {
2439
+ "find" : {
2440
+ "allShards": NumberLong(<num>),
2441
+ "manyShards": NumberLong(<num>),
2442
+ "oneShard": NumberLong(<num>),
2443
+ "unsharded": NumberLong(<num>)
2444
+ },
2445
+ "insert": {
2446
+ "allShards": NumberLong(<num>),
2447
+ "manyShards": NumberLong(<num>),
2448
+ "oneShard": NumberLong(<num>),
2449
+ "unsharded": NumberLong(<num>)
2450
+ },
2451
+ "update": {
2452
+ "allShards": NumberLong(<num>),
2453
+ "manyShards": NumberLong(<num>),
2454
+ "oneShard": NumberLong(<num>),
2455
+ "unsharded": NumberLong(<num>)
2456
+ },
2457
+ "delete": {
2458
+ "allShards": NumberLong(<num>),
2459
+ "manyShards": NumberLong(<num>),
2460
+ "oneShard": NumberLong(<num>),
2461
+ "unsharded": NumberLong(<num>)
2462
+ },
2463
+ "aggregate": {
2464
+ "allShards": NumberLong(<num>),
2465
+ "manyShards": NumberLong(<num>),
2466
+ "oneShard": NumberLong(<num>),
2467
+ "unsharded": NumberLong(<num>)
2468
+ }
2469
+ }
2470
+ },
2438
2471
"catalogCache" : {
2439
2472
"numDatabaseEntries" : NumberLong(<num>),
2440
2473
"numCollectionEntries" : NumberLong(<num>),
@@ -2709,8 +2742,29 @@ shardingStatistics
2709
2742
Only present when run on a :binary:`~bin.mongos`.
2710
2743
2711
2744
.. versionadded:: 4.2.7
2712
-
2713
- .. _server-status-sharded-index-consistency:
2745
+
2746
+ .. serverstatus:: shardingStatistics.numHostsTargeted
2747
+
2748
+ Indicates the number of shards targeted for ``CRUD`` operations and
2749
+ aggregation commands. When a ``CRUD`` operation or aggregation
2750
+ command is run, the following metrics will be incremented.
2751
+
2752
+ .. include:: /includes/fact-server-status-num-hosts-targeted.rst
2753
+
2754
+ .. note::
2755
+
2756
+ Running the :dbcommand:`serverStatus` command on :binary:`mongos`
2757
+ will provide insight into the CRUD and aggregation operations that
2758
+ run on a sharded cluster.
2759
+
2760
+ Multi-shard operations can either be
2761
+ :ref:`scatter-gather<sharding-query-patterns>`
2762
+ or shard specific. Multi-shard scatter-gather operations can
2763
+ :ref:`consume more resources<sharding-troubleshooting-scatter-gather>`.
2764
+ By using the
2765
+ :serverstatus:`shardingStatistics.numHostsTargeted`
2766
+ metrics you can tune the aggregation queries that run on a
2767
+ sharded cluster.
2714
2768
2715
2769
shardedIndexConsistency
2716
2770
~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments