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

Stefan Verkerk

Stefan Verkerk on

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

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

Making Things Easy for Node.js Users

We've ensured that all the basics are in place to monitor errors and performance of Node.js 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:

  • Postgres Query Duration Query duration per namespace (in milliseconds), showing the 90th percentile, the 95th percentile and the mean
  • Postgres Query Throughput Number of queries executed per namespace
  • Postgres Pool Total, idle and waiting connections in the pool

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
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", () => { meter .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
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.js, 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!

Stefan Verkerk

Stefan Verkerk

Stefan often shares stories about his Mosaic script-kiddie years. Has been scaling startups since the 90s. Today, he does management and growth things at AppSignal. Has amazing Excel to SQL chops on his customized MacBook.

All articles by Stefan Verkerk

Become our next author!

Find out more

AppSignal monitors your apps

AppSignal provides insights for Ruby, Rails, Elixir, Phoenix, Node.js, Express and many other frameworks and libraries. We are located in beautiful Amsterdam. We love stroopwafels. If you do too, let us know. We might send you some!

Discover AppSignal
AppSignal monitors your apps