Monitoring Your Timescale Cloud Services With Datadog
Our hosted database platform Timescale Cloud 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 Cloud 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 Cloud 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 Cloud 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.
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 Cloud. Exporting data is a free feature on Timescale Cloud, which is also fully available for trial users. You can start a free trial here.
Timescale Cloud and Datadog: Under the Hood
Before jumping into the tutorial, let’s take a quick look at how this integration works in Timescale Cloud. This will help you make sense of the steps you’ll perform later:
- Timescale Cloud has an internal metrics collector service that silently watches all your Timescale Cloud 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 Cloud.
- 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.
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 Cloud to authenticate against it.
You should follow these steps:
- Go to your “Organization Settings” page in Datadog.
- Under “API Keys,” click on “New Key” in the top right.
- Give your key a descriptive name (e.g., “Timescale Cloud”) and click on “Create key.”
You’ll need this key later, so keep it secure.
Exporting Metrics From Timescale Cloud
Now, let’s jump to the Timescale Cloud user interface.
As we saw earlier, you first need to create an exporter to configure your Datadog destination in Timescale Cloud. Exporters in Timescale Cloud 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 Cloud:
- Navigate to the Integrations page in the left menu.
- 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 Cloud 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.”
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.”
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 Cloud metrics, create the following query:
- Select “Metrics.”
- Choose any metric starting with timescale.cloud.*
P.S. In Datadog, your Timescale Cloud 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
Setting Up Alerts in Datadog
Now that your Timescale Cloud 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.
- 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!
You can now integrate Timescale Cloud 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 Cloud 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 Cloud for free; no credit card required.
But there’s more: you will soon be able to use Datadog to monitor performance metrics in Timescale Cloud. Stay tuned and happy monitoring!