Skip to content

DOCS-13884 Log profiler changes #4999

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

Merged
Merged
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
6 changes: 6 additions & 0 deletions source/includes/log-changes-to-database-profiler.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Starting in MongoDB 5.0 (also available starting in 4.4.2, 4.2.12, and
4.0.22), changes made to the :ref:`database profiler
<database-profiler>` ``level``, ``slowms``, ``sampleRate``, or
``filter`` using the :dbcommand:`profile` command or
:method:`db.setProfilingLevel()` wrapper method are recorded in the
:option:`log file <mongod --logpath>`.
6 changes: 4 additions & 2 deletions source/reference/command/profile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Definition

.. dbcommand:: profile

.. versionchanged:: 4.4.2
.. versionchanged:: 5.0

For a :binary:`~bin.mongod` instance, the command enables, disables,
or configures the :doc:`/tutorial/manage-the-database-profiler`. The
Expand All @@ -42,13 +42,15 @@ Definition
:ref:`filter <set-profiling-level-options-filter>` affect
only the diagnostic log.

(*Starting in MongoDB 4.0*): For :binary:`~bin.mongos` instance, the
Starting in MongoDB 4.0, for a :binary:`~bin.mongos` instance, the
command only configures how operations get written to the diagnostic
log. You cannot enable the
:doc:`/tutorial/manage-the-database-profiler` on a
:binary:`~bin.mongos` instance because ``mongos`` does not have any
collections that the profiler can write to.

.. include:: /includes/log-changes-to-database-profiler.rst

On :binary:`~bin.mongos`, you can set ``profile`` level to:

- ``0`` to set the ``slowms``, ``sampleRate``, and ``filter`` for
Expand Down
32 changes: 17 additions & 15 deletions source/reference/method/db.setProfilingLevel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Definition

.. method:: db.setProfilingLevel(level, options)

.. versionchanged:: 4.4.2
.. versionchanged:: 5.0

For a :binary:`~bin.mongod` instance, the method enables, disables,
or configures the :doc:`/tutorial/manage-the-database-profiler`. The
Expand All @@ -28,22 +28,22 @@ Definition
log.

If the :ref:`database profiler level <set-profiling-level-level>` is
``1`` or ``2`` (i.e. the :doc:`database profiler
``1`` or ``2`` (specifically, the :doc:`database profiler
</tutorial/manage-the-database-profiler/>` is enabled), the
:ref:`slowms <set-profiling-level-options-slowms>`,
:ref:`sampleRate <set-profiling-level-options-sampleRate>` affect
the behavior of both the profiler and the :option:`diagnostic log
<mongod --logpath>`.

If the :ref:`database profiler level <set-profiling-level-level>` is
``0`` (i.e. :doc:`database profiler
``0`` (specifically, :doc:`database profiler
</tutorial/manage-the-database-profiler/>` is disabled), the
:ref:`slowms <set-profiling-level-options-slowms>` and
:ref:`sampleRate <set-profiling-level-options-sampleRate>`, affect
only the diagnostic log.

(*Starting in MongoDB 4.0*): For a :binary:`~bin.mongos` instance,
the method sets the ``slowms``, ``sampleRate`` and ``filter``
Starting in MongoDB 4.0, for a :binary:`~bin.mongos` instance, the
method sets the ``slowms``, ``sampleRate`` and ``filter``
configuration settings, which configure how operations get written to
the diagnostic log. You cannot enable the
:doc:`/tutorial/manage-the-database-profiler` on a
Expand All @@ -62,6 +62,8 @@ Definition
:method:`db.setProfilingLevel()` provides a wrapper around the
:dbcommand:`profile` command.

.. include:: /includes/log-changes-to-database-profiler.rst

Syntax
~~~~~~

Expand Down Expand Up @@ -97,7 +99,7 @@ Parameters

.. include:: /includes/database-profiler-levels.rst

Since profiling is not available on :binary:`~bin.mongos`,
Because profiling is not available on :binary:`~bin.mongos`,
:method:`db.setProfilingLevel()` cannot be used to set the profiling
level to a value other than ``0`` on a :binary:`~bin.mongos` instance.

Expand Down Expand Up @@ -128,9 +130,9 @@ Parameters
For :binary:`~bin.mongod` instances, the setting affects both the
diagnostic log and, if enabled, the profiler.

For :binary:`~bin.mongos` instances, the setting affects the
diagnostic log only and not the profiler since profiling is not
available on :binary:`~bin.mongos`.
For :binary:`~bin.mongos` instances, the setting affects
the diagnostic log only and not the profiler because
profiling is not available on :binary:`~bin.mongos`.

.. note::
This argument affects the same setting as the configuration
Expand All @@ -149,9 +151,9 @@ Parameters
For :binary:`~bin.mongod` instances, the setting affects both the
diagnostic log and, if enabled, the profiler.

For :binary:`~bin.mongos` instances, the setting affects the
diagnostic log only and not the profiler since profiling is not
available on :binary:`~bin.mongos`.
For :binary:`~bin.mongos` instances, the setting affects
the diagnostic log only and not the profiler because
profiling is not available on :binary:`~bin.mongos`.

.. note::
This argument affects the same setting as the configuration option
Expand All @@ -170,9 +172,9 @@ Parameters
For :binary:`~bin.mongod` instances, the setting affects both the
diagnostic log and, if enabled, the profiler.

For :binary:`~bin.mongos` instances, the setting affects the
diagnostic log only and not the profiler since profiling is not
available on :binary:`~bin.mongos`.
For :binary:`~bin.mongos` instances, the setting affects
the diagnostic log only and not the profiler because
profiling is not available on :binary:`~bin.mongos`.

For an example of a filter used to control logged
operations, see :ref:`profiler-filter-example`.
Expand Down
5 changes: 5 additions & 0 deletions source/release-notes/5.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ See:
- :method:`db.setProfilingLevel()`
- :dbcommand:`profile`

Log Changes to Database Profiler Settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. include:: /includes/log-changes-to-database-profiler.rst

``serverStatus`` Output Change
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
7 changes: 4 additions & 3 deletions source/tutorial/manage-the-database-profiler.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ When enabled, profiling has an effect on database performance and
disk use. See :ref:`Database Profiler Overhead<database-profiling-overhead>` for more information.

This document outlines a number of key administration options for the
database profiler. For additional related information, consider the
following resources:
database profiler. For additional related information, see:

- :doc:`/reference/database-profiler`
- :doc:`Profile Command </reference/command/profile>`
Expand All @@ -53,7 +52,7 @@ The following profiling levels are available:
Enable and Configure Database Profiling
---------------------------------------

You can enable database profiling for :binary:`~bin.mongod` instances .
You can enable database profiling for :binary:`~bin.mongod` instances.

This section uses the :binary:`~bin.mongo` shell helper
:method:`db.setProfilingLevel()` helper to enable profiling. For
Expand Down Expand Up @@ -86,6 +85,8 @@ The ``"ok" : 1`` key-value pair indicates the operation succeeded:
To verify the new setting, see the
:ref:`database-profiling-view-status` section.

.. include:: /includes/log-changes-to-database-profiler.rst

Global and Per-Database Profiling Settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down