Skip to content

DOCS-8257: client metadata capture #2760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions source/includes/fact-client-appname.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. versionadded:: 3.4

The identifier of the client application which ran the operation.
If the operation was run in :doc:`the MongoDB shell</mongo>`,
the appName is always ``"MongoDB Shell"``. If the operation
originated from a :ecosystem:`driver</drivers>`, ``appName`` may
be set to a custom string.
5 changes: 5 additions & 0 deletions source/reference/database-profiler.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ example document reflects a find operation:
},
"ts" : ISODate("2015-09-03T15:26:14.948Z"),
"client" : "127.0.0.1",
"appName" : "MongoDB Shell",
"allUsers" : [ ],
"user" : ""
}
Expand Down Expand Up @@ -481,6 +482,10 @@ operation.
For some operations, such as :method:`db.eval()`, the client is
``0.0.0.0:0`` instead of an actual client.

.. data:: system.profile.appName

.. include:: /includes/fact-client-appname.rst

.. data:: system.profile.allUsers

An array of authenticated user information (user name and database)
Expand Down
60 changes: 60 additions & 0 deletions source/reference/log-messages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,66 @@ the amount of Informational and Debug messages MongoDB outputs.

To set verbosity levels, see :ref:`log-messages-configure-verbosity`.

Client Data
-----------

.. versionadded:: 3.4

Client application debugging and performance monitoring is easier
when you can clearly match server events with particular client
requests. With this in mind, recent MongoDB
`drivers <https://docs.mongodb.com/ecosystem/drivers/>`_ and client
applications (including the :program:`mongo` shell) have the ability
to send identifying information at the time of connection to the
server. After the connection is established, the client does not send
the identifying information again unless the connection is dropped
and reestablished.

The exact fields included vary by client. Below is a sample client
data document:

.. code-block:: javascript

{
application: {
name: "MongoDB Shell"
},
driver: {
name: "MongoDB Internal Client",
version: "3.4.0"
},
os: {
type: "Darwin",
name: "Mac OS X",
architecture: "x86_64",
version: "15.3.0"
}
}

When secondary members of a
:doc:`replica set </core/replica-set-members/>` initiate
a connection to a primary, they send similar data. A typical
connection document is as follows:

.. code-block:: javascript

{
driver: {
name: "NetworkInterfaceASIO-Replication",
version: "3.4.0"
},
os: {
type: "Darwin",
name: "Mac OS X",
architecture: "x86_64",
version: "15.3.0"
}
}

For a complete description of client information and required fields,
see the
`MongoDB Handshake specification <https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.rst>`_.

.. _log-message-components:

Components
Expand Down
5 changes: 5 additions & 0 deletions source/reference/method/db.currentOp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ The following is a prototype of :method:`db.currentOp()` output.
"insert" : <document>,
"planSummary": <string>,
"client" : <string>,
"appName" : <string>,
"msg": <string>,
"progress" : {
"done" : <number>,
Expand Down Expand Up @@ -337,6 +338,10 @@ Output Fields
array has operations from many different clients, use this string
to relate operations to clients.

.. data:: currentOp.appName

.. include:: /includes/fact-client-appname.rst

.. data:: currentOp.locks

.. versionchanged:: 3.0
Expand Down