New feature: PostgreSQL Magic Dashboard in AppSignal for Node.js

Stefan Stefan Verkerk on

Today, we’ve added a magic dashboard to the Node integration that shows you the performance and volume of your PostgreSQL queries.

Making Things Easy for Node Users

We’ve ensured that all the basics are in place to monitor errors and performance of Node applications. In the coming months, we will be working on making AppSignal as easy to use as possible. We plan to do so by automatically instrumenting setups and adding dashboards when we recognize a certain framework in your setup.

We started AppSignal to make the tool we’d love to use ourselves: it comes with the power of enterprise solutions, and it’s easy to set up, and very simple to use. Our end goal is to make everything easier for you. Other monitoring tools make stuff look complex, it takes a lot of manual work to set them up, and they aren’t very startup-friendly. We’re the exact opposite of them 😉.

PostgreSQL Magic Dashboard in AppSignal

After adding auto instrumentation for PostgreSQL a few weeks ago, we’ve now added a magic dashboard on top of that. Magic Dashboards are automatically created for you, so you don’t need to waste your time manually configuring the graphs.

This allows you to see when things are about to go wrong and dive into a sample to see what happened. For example, when the 95th percentile of the query duration goes over a certain threshold, this may be a leading indicator that something is about to go wrong.

The Postgres dashboard plots the following data:

The graphs are split out by namespace so you can see the difference between your web and background processes for example. This is what it looks like:

PostgreSQL magic dashboard

To add this magic dashboard, add this code to your app:

const pool = new Pool()

const meter = appsignal.metrics()
const probes = meter.probes()

probes.register("postgres", () => {
    .setGauge('postgres_pool', pool.totalCount, { metric: 'total' })
    .setGauge('postgres_pool', pool.idleCount, { metric: 'idle' })
    .setGauge('postgres_pool', pool.waitingCount, { metric: 'waiting' })

This will add not just the Pool data, but all three graphs.

Whoa, What Happened Here?

The cool thing (well, it’s the sort of thing we find cool) is that once your data is in AppSignal, you can use it in a number of ways.

Whenever you see something weird happening on the graph, you can hover over it and click ‘What happened here?’.

What happened here

This will take you to the overlay where you can see the performance, errors, hosts, and alerts for that snapshot. This will give you an overall view of what else went wrong at the point where the bit hit the fan.

What happened here

Setting a trigger to send out an alert

Another cool thing that becomes easier with the data in graphs is setting triggers for it and sending out alerts when these are triggered.

For example when the 95th percentile of the query duration goes over a threshold, this is something to consider setting a trigger for. Or when there are too many connections in the pool in use, you won’t have any capacity left for when there is a peak. Thus, setting a trigger for when idle <2, with a warmup of 5 minutes, for example, is another trigger you could consider.

We’ve written more on mean versus 90th percentile and edge cases, you might want to give it a read.

Coming up Next

In the next weeks, we’ll cover how to use custom metrics with the minutely probes. In the coming 8 weeks or so, we’ll work on integrations and dashboards for Mongo, Redis, and GraphQL / Apollo.

Try Out AppSignal and Get a Box of Stroopwafels 🍪

If you are using AppSignal for Node, check out the dashboard. If you are not using it yet, see how to get started in the documentation and try it for free. Then, reach out to us to ask for stroopwafels. Enjoy!

10 latest articles

Go back
Javascript sorcery icon

Subscribe to

JavaScript Sorcery

A true sorcerer combines ancient wisdom and new discoveries. We'll provide you with both. Sign up for our JavaScript Sorcery email series and receive deep insights about JavaScript, error tracking and other developments.

We'd like to set cookies, read why.