Skip to content

Commit 7ecb298

Browse files
authored
DOCS-15016 add apiversion to serverStatus (#443) (#513)
* DOCS-15016 add apiversion to serverStatus * add code block to versioned-api.txt * remove quotes * remove reference to 4.7 * Add placeholder comments * Add context * verb tense update * populates -> appears * xuerui comments #1 * command -> metric * monospace appname on versioned-api.txt * a -> for a
1 parent fc08452 commit 7ecb298

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

source/reference/command/serverStatus.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4870,6 +4870,11 @@ metrics
48704870
.. code-block:: javascript
48714871

48724872
"metrics" : {
4873+
"apiVersions": {
4874+
"<appName1>": <string>,
4875+
"<appName2>": <string>,
4876+
"<appName3>": <string>
4877+
},
48734878
"aggStageCounters" : {
48744879
"<aggregation stage>" : NumberLong(<num>)
48754880
},
@@ -5046,6 +5051,36 @@ metrics
50465051

50475052
*New in version 4.4 (4.2.6 and 4.0.19).*
50485053

5054+
.. _server-status-apiVersions:
5055+
5056+
.. serverstatus:: metrics.apiVersions
5057+
5058+
A document with client applications and the version of Stable
5059+
API which they are configured with. Consider the following when
5060+
viewing ``metrics.apiVersions``:
5061+
5062+
- The only possible returned values for each ``appname`` are
5063+
``default`` or ``1``.
5064+
5065+
- API version metrics are retained for 24 hours. If
5066+
no commands are issued with a specific API version from an
5067+
application in the past 24 hours, that ``appname`` and API version
5068+
will be removed from the metrics. This also applies to the
5069+
``default`` API version metric.
5070+
5071+
- Set the ``appname`` when connecting to a MongoDB instance by
5072+
specifying the ``appname`` in the connection URI. ``?appName=ZZZ``
5073+
sets the ``appname`` to ``ZZZZ``.
5074+
5075+
- Drivers accessing the Stable API can set a default ``appname``.
5076+
5077+
- If no ``appname`` is configured, a default value will be
5078+
automatically populated based on the product. For example, for a
5079+
:compass:`MongoDB Compass </>` connection with no ``appname`` in
5080+
the URI, the metric returns: ``'MongoDB Compass': [ 'default' ]``.
5081+
5082+
*New in version 5.0.*
5083+
50495084
.. serverstatus:: metrics.operatorCounters
50505085

50515086
A document with a number that indicates how often

source/reference/stable-api.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,21 @@ By default, clients are *non-strict*. A non-strict client allows you
206206
to run any command, regardless of whether or not it belongs to the
207207
Stable API.
208208

209+
Checking Client API Versions
210+
----------------------------
211+
212+
Use the :dbcommand:`serverStatus` command to check for your
213+
application's configured API version. For each application connected to
214+
your MongoDB instance, an ``appname`` appears in the ``apiVersions``
215+
document.
216+
217+
See :ref:`metrics.apiVersions <server-status-apiVersions>` for more
218+
information.
219+
220+
.. code-block:: javascript
221+
222+
db.runCommand( { serverStatus: 1 } ).metrics.apiVersions
223+
209224
Create a Strict Client
210225
----------------------
211226

source/release-notes/5.0.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,9 @@ Aggregation Metrics
988988
- :serverstatus:`metrics.dotsAndDollarsFields`
989989
- :serverstatus:`metrics.operatorCounters`
990990

991+
API Version Metrics
992+
- :serverstatus:`metrics.apiVersions`
993+
991994
Replication Metrics
992995
- :serverstatus:`metrics.repl.reconfig.numAutoReconfigsForRemovalOfNewlyAddedFields`
993996

0 commit comments

Comments
 (0)