Skip to main content
The Mongoid gem relies on the Mongo Ruby Driver. AppSignal activates Mongo Ruby Driver instrumentation automatically if it is detected in the project. AppSignal’s MongoDB instrumentation supports the Mongo Ruby Driver gem and the Mongoid gem out-of-the-box; no manual setup is required. When AppSignal detects MongoDB metrics, it will create an Intelligence dashboard, allowing you to monitor core metrics visually. To disable this integration, set the instrument_mongo config option to false.

Performance monitoring

Once AppSignal begins reporting MongoDB metrics, AppSignal will give you performance insights via:

Trace timeline

Queries run through the driver are recorded as query.mongodb spans, titled after the command that ran. The trace timeline on the trace page gives you deep insights into MongoDB query performance, allowing you to see exactly what queries are run, when, and what impact they’re having on your application’s responsiveness. Trace timeline showing MongoDB query spans in a web request

Trace breakdown

The trace breakdown on a trace page shows how a request’s time and allocations were split across span groups, such as action_controller and mongodb, so you can spot slow MongoDB queries at a glance. Trace breakdown showing time and allocations per span group, with mongodb taking most of the time

Slow queries

AppSignal has a whole suite of tools aimed at helping you improve your application’s performance. Slow queries is a simple and informative overview of your application’s slow queries and the impact they’re having on your application’s performance, allowing you to quickly and confidently decide on the steps needed to optimize them. The Slow queries page listing MongoDB queries by impact

Intelligence dashboard

When AppSignal receives MongoDB metrics, it will create a MongoDB Intelligence dashboard, available from the dashboard section of the AppSignal app. The MongoDB Intelligence dashboard will have the following graphs: Tags give you a contextual breakdown of MongoDB performance information. AppSignal reports the following tag for MongoDB metrics: Each tag will be represented with a colored line on the graph: Example MongoDB dashboard

Throughput graph

The Throughput graph shows the amount of queries executed on each MongoDB database. You can use this graph to understand how many queries your app’s databases are handling, spot inefficient queries, and potential n+1 and scaling problems.

Query duration graph

The Query duration graph shows the 95th percentile and average duration of the queries executed on each MongoDB database. You can use this graph to understand the performance of database queries, pinpoint performance issues, and fine-tune slow queries.

Span attributes

Collector mode only: this applies when AppSignal for Ruby runs in collector mode. It has no effect otherwise.
The query’s span carries:
  • db.operation.name — the command that ran, such as find.
  • db.collection.name — the collection the command ran against.
  • db.namespace — the database the command ran against.
  • server.address and server.port — the server the command was sent to.
  • db.response.status_code — the result the server returned.