Monitoring Your Timescale Services With Datadog

Monitoring Your Timescale Services With Datadog

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!

Prerequisites

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.

Timescale and Datadog: Under the Hood

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:

  • Timescale has an internal metrics collector service that silently watches all your Timescale services created in a particular region (e.g., us-east-1).
  • If you want to expose the metrics for a specific service and send them to an observability tool like Datadog, you will first create an “exporter” in Timescale.
  • Once you have created an exporter (linked to a specific region and a specific observability tool), you will attach the exporter to the service you want to monitor. This under-the-hood exporter is OpenTelemetry—it will give your metrics the correct format.
  • Once your service is attached to the exporter, your service metrics will be sent automatically to CloudWatch.
Architecture diagram showcasing the basic integration elements between Timescale Cloud and Datadog
Architecture diagram showcasing the basic integration elements between Timescale and Datadog

Configuring Datadog

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:

  • Go to your “Organization Settings” page in Datadog.
The Datadog user interface: the Organization Settings page
  • Under  “API Keys,” click on “New Key” in the top right.
Naming the API keys in the Datadog UI
  • Give your key a descriptive name (e.g., “Timescale”) and click on “Create key.”

You’ll need this key later, so keep it secure.

Exporting Metrics From Timescale

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:

  • Navigate to the Integrations page in the left menu.
The Integrations page of the Timescale Cloud user interface
  • On the Integrations page, click on “Add exporter.”
  • You’ll be taken to the configuration page for your exporter. Here, select the tool you want to integrate your service with (in this case, Datadog), the Timescale region for this exporter (remember that this needs to be the same region as the service you want to export metrics from), and the Datadog site you want to send metrics to. Also, paste the Datadog API key you obtained previously. Once you’re done, click on “Create exporter.”
Creating an exporter in Timescale Cloud

Your exporter is now running!

Now, it’s time to connect it to your service.

  • To do so, navigate to the Operations page of your service, and click on “Integrations.” Select the exporter you previously created in the drop-down menu, and click on “Attach exporter.”
Attaching the exporter in the Timescale Cloud user interface to allow the integration with Datadog


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:

  • Select “Metrics.”
  • Choose any metric starting with timescale.cloud.*
The Metrics Explorer page

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.

Setting Up Alerts in Datadog

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:

  • In the Datadog user interface, go to Monitors > New monitor > Metric.
Defining alerts in the Datadog UI
  • On this screen, you can configure your alert. Select the metric you’d like to monitor, the thresholds, notification types, etc. Once you’re done, click on create.
  • Don’t forget to test your alert to see if everything works as expected!
Editor's Note: If you’re interested in monitoring your storage, consider enabling storage autoscaling in Timescale. This will prevent you from ever running out of disk space —while operating within an autoscaling limit set by you for cost control.

Wrapping Up

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!

Ingest and query in milliseconds, even at terabyte scale.
This post was written by
5 min read
Cloud
Contributors

Related posts