重要
mongosh メソッド
This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.
データベースコマンドについては、 collStatsコマンドによって返されるlatencyStatsフィールドを参照してください。
MongoDB API ドライバーについては、各言語の「MongoDB ドライバーのドキュメント」を参照してください。
定義
db.collection.latencyStats(options)db.collection.latencyStats()returns latency statistics for a given collection. It is a wrapper around$collStats.このメソッドの形式は次のとおりです。
db.collection.latencyStats( { histograms: <boolean> } ) The
histogramsargument is an optional boolean. Ifhistograms: truethenlatencyStats()adds latency histograms to the return document.
Tip
互換性
このメソッドは、次の環境でホストされている配置で使用できます。
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
注意
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
出力
latencyStats() returns a document containing a field latencyStats, containing the following fields:
フィールド名 | 説明 |
|---|---|
| 読み取りリクエストのレイテンシ統計 |
| 書込み (write) リクエストのレイテンシ統計 |
| データベースコマンドのレイテンシ統計 |
| データベース トランザクションのレイテンシ統計です。 |
これらの各フィールドには、次のフィールドを持つ埋め込みドキュメントが含まれています。
フィールド名 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|
| 合計レイテンシ(マイクロ秒単位)。 | |||||||
| のスタートアップ以降にコレクションに対して実行された操作の合計数。 | |||||||
| それぞれがレイテンシ範囲を表す埋め込みドキュメントの配列。 各ドキュメントは、前のドキュメントの範囲の 2 倍をカバーします。 2048マイクロ秒から約1秒の間の低い値の場合、ヒストグラムには半ステップが含まれます。 このフィールドは、 各ドキュメントには、次のフィールドがあります。
たとえば、 This indicates that there were [1]:
|
| [1] |
|
例
You can run latencyStats() in mongosh as follows:
db.data.latencyStats( { histograms: true } ).pretty()
latencyStats() は、次のようなドキュメントを返します。
{ "ns" : "test.data", "localTime" : ISODate("2016-11-01T21:56:28.962Z"), "latencyStats" : { "reads" : { "histogram" : [ { "micros" : Long(16), "count" : Long(6) }, { "micros" : Long(512), "count" : Long(1) } ], "latency" : Long(747), "ops" : Long(7) }, "writes" : { "histogram" : [ { "micros" : Long(64), "count" : Long(1) }, { "micros" : Long(24576), "count" : Long(1) } ], "latency" : Long(26845), "ops" : Long(2) }, "commands" : { "histogram" : [ ], "latency" : Long(0), "ops" : Long(0) } } }