Nov 20, 2024
Posted by
Lukas Bernert
Our hosted database platform Timescale makes it substantially easier to run TimescaleDB databases in production. For these mission-critical applications, keeping an eye on your main service metrics is crucial to ensure enough resources so your database can operate uninterruptedly. What resources are these? Memory, CPU, and storage are vital metrics in a quickly scaling cloud-native database.
Integrating Timescale with cloud-native observability tools can help you do this. Using tools like Datadog or CloudWatch, you can set up alerts on your service metrics to get notified every time your memory surpasses a certain threshold or once your storage starts to get full.
In this blog post, we’ll walk you through integrating Datadog with Timescale to monitor your TimescaleDB databases in production. To be more precise, we'll show you how to send resource usage data on CPU, RAM, and storage to Datadog. In our next blog post, we’ll teach you how to do the same with Amazon CloudWatch. If you are not using Timescale yet, you can create an account here. The platform is completely free for 30 days, and you don’t need a credit card to sign up.
Are videos more of your thing? We got you covered—this video by Mathis Van Eetvelde (developer advocate at Timescale) will walk you through the same steps outlined in this blog post.
Happy observing!
To get started, you’ll need an active Datadog account. If this is something you’re still exploring, you can sign up for a free Datadog trial on their website.
Additionally, you must have a service running on Timescale. Exporting data is a free feature on Timescale, which is also fully available for trial users. You can start a free trial here.
Before jumping into the tutorial, let’s take a quick look at how this integration works in Timescale. This will help you make sense of the steps you’ll perform later:
Now let’s get started.
First, let’s prepare everything from the Datadog side. The first step is to obtain an API key from your Datadog organization. This allows Timescale to authenticate against it.
You should follow these steps:
You’ll need this key later, so keep it secure.
Now, let’s jump to the Timescale user interface.
As we saw earlier, you first need to create an exporter to configure your Datadog destination in Timescale. Exporters in Timescale are linked to a particular third-party tool (e.g., Datadog) and associated with an AWS region. If you want to monitor different services across multiple regions (for example, one service in eu-west-1 and another in us-east-1), you’ll need to create two exporters, one per region. You can attach multiple services to only one exporter if the regions match.
Similarly, exporters are associated with a Datadog site (e.g., EU1, US1, US3). You'll need separate exporters if you want to send metrics to different Datadog sites.
Let’s create an exporter in Timescale:
Your exporter is now running!
Now, it’s time to connect it to your service.
After a few seconds, your service’s telemetry data will be sent to your Datadog organization.
You can visit Datadog and the metrics explorer to check if everything works. To display your Timescale metrics, create the following query:
P.S. In Datadog, your Timescale services are identified by a service_id. You can see the service_id of a specific service by looking at the first part of the hostname. For example, your hostname may be mnyr5wrz8u.ye21f71f94.dev.metronome-cloud.com
—your service_id is mnyr5wrz8u
.
Now that your Timescale service metrics are accessible via Datadog, you can set up alerts on them, which is especially useful for mission-critical services.
Defining alerts in Datadog is very straightforward—their docs are excellent, and we recommend you follow the instructions. But in you want a quick guide, follow these steps:
You can now integrate Timescale with Datadog in a few simple steps, allowing you to set up alerts over your main service usage metrics: memory, CPU, and storage.
If you have a time-series application, Timescale is the most convenient way to run your database fleet. You’ll get all the power of TimescaleDB for your time-series data—with automatic time partitioning, native compression, continuous aggregation, and SQL hyperfunctions for time-series analysis—plus all the advantages of PostgreSQL for your relational data. You can try Timescale for free; no credit card required.
But there’s more: you will soon be able to use Datadog to monitor performance metrics in Timescale. Stay tuned and happy monitoring!