Getting Started with Database Monitoring
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter
Datadog Database Monitoring helps you to better understand the health and performance of your databases, and quickly determine the root cause of any problems.
In one place, you can view:
- Host-level metrics
- Explain plans
- Historical query performance metrics
Work through this guide to set up Datadog Database Monitoring on an example PostgreSQL database. Next, identify an expensive query, troubleshoot a slow query, and create a dashboard to view changes in query volume.
Before getting started, you need a Datadog account.
To run the example application, you need a machine with GNU Make and Docker. Have your Datadog API key available.
Install the example application
The example application starts up the Datadog Agent and a PostgreSQL database in a Docker container. While the application runs, the Agent sends database metrics to Datadog. You can view the data from the application in Datadog Database Monitoring.
Follow these instructions to install the example application on MacOS or Linux.
- Clone the repository containing the example application:
git clone https://github.com/DataDog/dd-database-monitoring-example
- Change to the
- Set the environment variable
DD_API_KEY to your Datadog API key:
- Start the application:
The command continues to run until you stop it by pressing Ctrl + C.
Identify an expensive query
Which query consumes the most database time? To find out, use the Query Metrics view.
Navigate to Database Monitoring by clicking APM > Databases in the UI. It opens to the Query Metrics view.
Sort the Normalized Query table by Percent time to see the query that the database spends the most time executing.
The query that consumes the most database time appears on the first line.
Troubleshoot a slow query
In addition to identifying slow queries, Datadog Database Monitoring can help you diagnose them. A query’s Explain Plan describes the steps that the database takes to resolve the query. View an Explain Plan by clicking on a sample in the Query Samples view.
Navigate to the Query Samples view within Database Monitoring by clicking APM > Databases, and selecting the Query Samples tab in the UI.
Sort the Normalized Query table by Duration.
Find a query in the table with data in the Explain Plan column, and click on it to open the Sample Details page. This Explain Plan at the bottom of Sample Details shows that the query requires an Index Scan.
Visualize database health and performance
To understand the health and performance of your databases at a glance, add Datadog Database Monitoring metrics to a dashboard.
View changes in query volume
For example, you can see the absolute change in query volume in the past hour by adding a Change widget to track a query count metric.
Select Dashboards > New Dashboard in the UI.
Enter a name for your dashboard. Click the New Dashboard button to go to your new dashboard.
To add content to your dashboard, click Add Widgets.
In the widget carousel, select the Change widget.
postgresql.queries.count in the Metric dropdown. This metric counts the number of queries sent to a PostgreSQL database.
host in the Break it down by dropdown so the widget aggregates queries by host.
- Click the Save button. The dashboard shows your new widget.
View default dashboards
Observe current database activity, resource utilization, and more on out-of-the-box dashboards provided by Datadog Database Monitoring.
To access the dashboards:
Click APM > Databases in the UI to go to Database Monitoring.
Select the Dashboards tab and choose the dashboard you want to see.
You can clone and modify out-of-the-box dashboards to suit your needs.
Documentation, liens et articles supplémentaires utiles: