On this page本页内容
db.collection.
latencyStats
(options)¶mongo
Shell Method
This page documents the 本页记录了mongo
shell method, and does not refer to the MongoDB Node.js driver (or any other driver) method. mongo
shell方法,未提及MongoDB Node.js驱动程序(或任何其他驱动程序)方法。For corresponding MongoDB driver API, refer to your specific MongoDB driver documentation instead.有关相应的MongoDB驱动程序API,请参阅特定的MongoDB驱动程序文档。
db.collection.latencyStats()
returns latency statistics for a given collection. It is a wrapper around $collStats
.
This method has the form:
The histograms
argument is an optional boolean. If histograms: true
then latencyStats()
adds latency histograms to the return document.
See also参阅
latencyStats()
returns a document containing a field latencyStats
, containing the following fields:
Field Name | |
---|---|
reads |
Latency statistics for read requests. |
writes |
Latency statistics for write requests. |
commands |
Latency statistics for database commands. |
Each of these fields contains an embedded document bearing the following fields:
Field Name | |||||||
---|---|---|---|---|---|---|---|
latency |
A 64-bit integer giving the total combined latency in microseconds. | ||||||
ops |
A 64-bit integer giving the total number of operations performed on the collection since startup. | ||||||
histogram |
An array of embedded documents, each representing a latency range. Each document covers twice the previous document’s range. For upper values between 2048 microseconds and roughly 1 second, the histogram includes half-steps. This field only exists given the Each document bears the following fields:
For example, if This indicates that there were:
|
You can run latencyStats()
in a mongo
shell as follows:
latencyStats()
returns a document such as the following: