To instrument the MongoDB Client Java API, inject the AppMon Agent and make sure the MongoDB Sensor is placed and active. In new System Profiles, this Sensor is placed and active by default.


Transaction Flow

MongoDB calls are generally treated and visualized like database calls. In the Transaction Flow dashlet, every MongoDB instance is rendered as a node.

In the following figures, the time consumed for fetching data from MongoDB is displayed in the MongoDB node to the right.


In the Database dashlet, MongoDB calls are displayed in a way very similar to its client (JavaScript) shell. Each connection pool corresponds to a MongoDB instance that groups all calls that were issued against it. This grouping allows analysis if the load is equally distributed among your MongoDB instances in a replica set scenario.

The Row Count and Round Trips columns display further detail, as shown in the first figure. The second figure shows bind values displayed. See Configuration for more information.

The Database Hotspots dashlet shows where your MongoDB calls are being made.


You can view MongoDB calls in the PurePaths dashlet similar to other database calls. The find() call is treated as a special case, because it does not actually send or retrieve anything from the MongoDB instance. Sending and receiving only happen after the application code accesses the result set — when the call() method is executed (the actual database fetch) and retrieves a part of the result set from the database.

One find() call can result in multiple call() calls (multiple fetches/round trips). Each find() is assigned a number, starting from 1, in the Argument column. The call() node's Argument column features the number that corresponds to the find(). You can use this number to identify which calls belong to which find().

The time consumed by one find() operation can be determined by adding all execution times, for example, of find/call nodes annotated with number assigned to the find, and subtracting the suspension time. The result is the database time. This is exactly the time that is displayed in the Database dashlet. All other MongoDB operations are simple method invocations and are displayed as such, with a database icon.

Error detection

To be able to detect all errors, make sure the Java Exception Sensor is placed and active. Errors are visualized in all the previously described dashlets. You can drill down to the Errors dashlet from each location.

The following figures demonstrate a drilldown from the Transaction Flow and Database dashlets to the Errors dashlet.


To edit the System Profile specific settings, right click you System Profile, and select Edit System Profile > Agent Group/tier > Sensor Configuration and then select the MongoDB item in the Sensor Configuration list.

  • Enable extended capturing: Enables capturing of detailed information about JSON query strings or document IDs.
  • Capture only document id(s): Capture document IDs where available.
  • Capture full JSON objects(s) (queries and documents): Capture all JSON objects as serialized strings.
  • Maximum string length: Limits the maximum length of the captured JSON strings. Exceeding symbols are cut.

In either case, you can view the details of a node in the Details popup windows of the PurePaths and Database dashlets. To display the details in the Database dashlet, you have to enable bind values grouping in the appropriate Sensor. The captured data may also be called Bind Values.

The following figures show a simple findOne() operation in different configurations.

In the second figure, notice that the result's document ID displays.

In the second figure, notice that the bind values are part of the statement string.

If full JSON objects are captured, the JSON query strings become part of the database statement strings, as described in the table.

Statement string Description
find() No query is specified (find all: limited/document ID capturing).
find({ }) No query is specified (find all: extended/JSON string capturing).
find({ ? }) A query is specified: limited/document ID capturing.
find({ mykey: ?, ... }) A query is specified: extended/JSON string capturing.

Values are replaced with ? to avoid explosion of statement strings. The actual query string (for example, find({ mykey: "myvalue", ... })) can be found in the bind values.

Supported versions

  • Supported server versions: 2.0.x, 2.2.x, and 2.4.x.
  • Supported Java driver versions: 2.3 through to 2.11.3.