The Neon Datadog integration
newSend metrics and events from Neon Postgres to Datadog
What you will learn:
How to set up the integration
The full list of externally-available metrics
Available for Scale and Business Plan users, the Neon Datadog integration lets you monitor Neon database performance, resource utilization, and system health directly from Datadog's observability platform.
beta
This feature is currently in Beta for Scale and Business plan users. It will remain free of charge for those users during the Beta period.
How it works
The integration leverages a list of metrics that Neon makes available for export to third-party services. By configuring the integration with your Datadog API key, Neon automatically sends metrics from your project to your selected Datadog site. Some of the key metrics include:
- Connection counts — Tracks active and idle database connections.
- Database size — Monitors total size of all databases in bytes.
- Replication delay — Measures replication lag in bytes and seconds.
- Compute metrics — Includes CPU and memory usage statistics for your compute.
note
Metrics are sent for all computes in your Neon project. For example, if you have multiple branches, each with an attached compute, metrics will be collected and sent for each compute.
Prerequisites
Before getting started, ensure the following:
- You have a Neon account and project. If not, see Sign up for a Neon account.
- You have a Datadog account and API key.
- You know the region you selected for your Datadog account. Here's how to check: Find your Datadog region
Steps to integrate Datadog with Neon
- In the Neon Console, navigate to the Integrations page in your Neon project.
- Locate the Datadog card and click Add.
- Enter your Datadog API key. You can generate or retrieve Datadog API Keys from your Datadog organization.
- Select the Datadog site that you used when setting up your Datadog account.
- Click Confirm to complete the integration.
Optionally, you can import the Neon-provided JSON configuration file into Datadog, which creates a pre-built dashboard from Neon metrics, similar to the charts available on our Monitoring page. See Import Neon dashboard
Once set up, Neon will start sending metrics to Datadog, and you can use these metrics to create custom dashboards and alerts in Datadog.
note
Neon computes only send metrics when they are active. If the Scale to Zero feature is enabled and a compute is suspended due to inactivity, no metrics will be sent during the suspension. This may result in gaps in your Datadog metrics. If you notice missing data in Datadog, check if your compute is suspended. You can verify a compute's status as Idle
or Active
on the Branches page in the Neon console, and review Suspend compute events on the System operations tab of the Monitoring page.
Additionally, if you are setting up Neon’s Datadog integration for a project with an inactive compute, you'll need to activate the compute before it can send metrics to Datadog. To activate it, simply run a query from the Neon SQL Editor or any connected client on the branch associated with the compute.
Example usage in Datadog
Once integrated, you can create custom dashboards in Datadog by querying the metrics sent from Neon. Use Datadog's Metrics Explorer to search for metrics like neon_connection_counts
, neon_db_total_size
, and host_cpu_seconds_total
. You can also set alerts based on threshold values for critical metrics.
Import the Neon dashboard
As part of the integration, Neon provides a JSON configuration file that you can import into Datadog to start with a pre-built dashboard based on a subset of Neon metrics.
Here's how you can import the dashboard:
-
In the Neon Console, open your Datadog integration from the Integrations page.
-
Scroll to the bottom of the panel and copy the JSON from there.
OR
You can copy the JSON below instead.
-
Next, create a new dashboard in Datadog.
-
Open Configure, select Import dashboard JSON, then paste the Neon-provided configuration JSON.
If any of the computes in your project are active, you should start seeing data in the resulting charts right away. By default, the charts show metrics for all active endpoints in your project. You can filter results to one or more selected endpoints using the endpoint_id variable dropdown selector.
Dashboard JSON
Copy JSON configuration
Available metrics
Neon makes the following metrics available for export to third parties; for now, availability is limited to the Datadog integration but will soon be expanded to other providers.
All metrics include the following labels:
project_id
endpoint_id
compute_id
job
Here's an example of the metric db_total_size
with all labels:
note
In Datadog, metric labels are referred to as tags.
See Getting Started with Tags in the Datadog Docs.
Name | Job | Description |
---|---|---|
neon_connection_counts | sql-metrics | Total number of database connections. The state label indicates whether the connection is active (executing queries), idle (awaiting queries), or in a variety of other states derived from the pg_stat_activity Postgres view. |
neon_db_total_size | sql-metrics | Total size of all databases in your project, measured in bytes. |
neon_lfc_approximate_working_set_size_windows | sql-metrics | Approximate working set size in pages of 8192 bytes. The metric is tracked over time windows (5m, 15m, 1h) to gauge access patterns. Duration values: duration="5m" , duration="15m" , duration="1h" . |
neon_lfc_cache_size_limit | sql-metrics | The limit on the size of the Local File Cache (LFC), measured in bytes. |
neon_lfc_hits | sql-metrics | The number of times requested data was found in the LFC (cache hit). Higher cache hit rates indicate efficient memory use. |
neon_lfc_misses | sql-metrics | The number of times requested data was not found in the LFC (cache miss), forcing a read from slower storage. High miss rates may indicate insufficient compute size. |
neon_lfc_used | sql-metrics | The amount of space currently used in the LFC, measured in 1MB chunks. It reflects how much of the cache limit is being utilized. |
neon_lfc_writes | sql-metrics | The number of write operations to the LFC. |
neon_max_cluster_size | sql-metrics | The neon.max_cluster_size setting in MB. |
neon_pg_stats_userdb | sql-metrics | Aggregated metrics from the pg_stat_database Postgres view. We collect stats from the oldest non-system databases based on their creation time, but not for all databases. Only the first X databases (sorted by creation time) are included. datname: The name of the database kind: The type of value being reported. One of the following:
|
neon_replication_delay_bytes | sql-metrics | The number of bytes between the last received LSN (Log Sequence Number ) and the last replayed one. Large values indiciate replication lag. |
neon_replication_delay_seconds | sql-metrics | Time since the last LSN was replayed. |
host_cpu_seconds_total | compute-host-metrics | The number of CPU seconds accumulated in different operating modes (user, system, idle, etc.). |
host_load1 | compute-host-metrics | System load averaged over the last 1 minute. Example: for 0.25 vCPU, host_load1 of 0.25 means full utilization, >0.25 indicates waiting processes. |
host_load5 | compute-host-metrics | System load averaged over the last 5 minutes. |
host_load15 | compute-host-metrics | System load averaged over the last 15 minutes. |
host_memory_active_bytes | compute-host-metrics | The number of bytes of active main memory. |
host_memory_available_bytes | compute-host-metrics | The number of bytes of main memory available. |
host_memory_buffers_bytes | compute-host-metrics | The number of bytes of main memory used by buffers. |
host_memory_cached_bytes | compute-host-metrics | The number of bytes of main memory used by cached blocks. |
host_memory_free_bytes | compute-host-metrics | The number of bytes of main memory not used. |
host_memory_shared_bytes | compute-host-metrics | The number of bytes of main memory shared between processes. |
host_memory_swap_free_bytes | compute-host-metrics | The number of free bytes of swap space. |
host_memory_swap_total_bytes | compute-host-metrics | The total number of bytes of swap space. |
host_memory_swap_used_bytes | compute-host-metrics | The number of used bytes of swap space. |
host_memory_swapped_in_bytes_total | compute-host-metrics | The number of bytes that have been swapped into main memory. |
host_memory_swapped_out_bytes_total | compute-host-metrics | The number of bytes that have been swapped out from main memory. |
host_memory_total_bytes | compute-host-metrics | The total number of bytes of main memory. |
host_memory_used_bytes | compute-host-metrics | The number of bytes of main memory used by programs or caches. |
Feedback and future improvements
We’re always looking to improve! If you have feature requests or feedback, please let us know via the Feedback form in the Neon Console or on our Discord channel.
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more details, see Getting Support.