AppSignal's Node.js package now supports monitoring BullMQ jobs.
In this article, we'll demonstrate how easy it is to start monitoring BullMQ performance and what insights you can expect to see for your BullMQ jobs in AppSignal.
Setting Up BullMQ Monitoring
BullMQ is automatically instrumented in versions 3.4.5 and higher of AppSignal's Node.js package.
If you're new to AppSignal, you'll first need to install our Node.js package, whereas existing AppSignal customers just need to ensure their Node.js package is up-to-date.
Installing AppSignal
To start monitoring BullMQ jobs, you'll first need to create an AppSignal account (you can do a 30-day free trial). Then install AppSignal's Node.js package:
Note: Make sure you're using version 3.4.5 or higher.
You'll then need a valid API key to configure, require, and initialize AppSignal. You can obtain your API key from your organization's API key page (found under Administration settings).
We recommend initializing AppSignal with a config file:
Once configured, no further setup for BullMQ is required, as it's automatically instrumented by the AppSignal package.
Updating Your AppSignal Package
If you're already monitoring your Node.js app with AppSignal, update the AppSignal package to version 3.4.5 or higher. We recommend updating your package to the latest version:
Monitoring BullMQ Jobs with AppSignal
Once you've successfully installed and configured AppSignal, you'll automatically receive:
- Error reports from BullMQ workers
- Calls to functions that enqueue BullMQ jobs (like
Queue.add
) - BullMQ worker performance samples
You can use these insights to help ensure BullMQ jobs are being enqueued and processed efficiently and to resolve problems proactively before they break your background jobs.
BullMQ Worker Error Reporting
AppSignal will automatically track and notify you when exceptions occur with your BullMQ workers, helping you find and fix errors before they negatively impact your application. Review errors in the Error issue list:
Here, we can quickly view, sort, and filter issues based on important, contextual information:
- Action name and error type: The name of the route/function where the error occurred and the name of the error type.
- Status: The state (open, in progress, closed) and severity of the issue.
- In deploy: How many times the error has occurred in the current latest deployment.
- Total: The total count of error occurrences.
- Last: How long it has been since the error last occurred.
When inspecting an error, we get a quick overview of the error and the end of its backtrace. From here, we can inspect individual error samples, filter errors based on deployments, inspect a full backtrace, and view trends:
Monitoring BullMQ Job Performance
To help you understand how AppSignal tracks BullMQ job performance, we'll deliberately create a slow BullMQ background job.
In the following function, we'll send a message with BullMQ. To keep things simple, let's use a timeout function, forcing a request to take several seconds to complete.
This slow job will raise a performance issue in AppSignal. We can then review it in the Performance issue list:
Here, we can quickly view, sort, and filter issues based on:
- Action name: The name of the route/function where the performance incident took place.
- Status: The state (open, in progress, closed) and severity of the issue.
- Mean response time: The mean response time of all occurrences of the issue.
- Throughput: The throughput of an issue's occurrences.
- Impact: The impact an issue is having on overall performance.
Each issue gives us a clear overview of information, such as performance trends, performance in the last deploys, and samples. Samples are recorded each time a performance incident occurs:
Each occurrence gives us event-level insights into our performance incident. The Event Timeline makes it easy for us to understand which events in our request are causing performance issues.
Of course, in our case, we've deliberately slowed down our BullMQ job, so it's not a surprise to see that taking up the most time in our Event Timeline:
In a real-life scenario, these insights can help us see which background jobs are underperformant and which processes inside of those requests are the likely root cause, such as a large database query or slow API request.
Ready to Start Monitoring BullMQ with AppSignal?
In this post, we've shown you how to monitor the performance of BullMQ jobs using AppSignal. Read our BullMQ monitoring page and BullMQ docs for more information.
Still have some questions about AppSignal or monitoring your Node.js app? Send us an email. Our team is always on hand to help.