When you are part of a development, operations, or devops team, database issues need to be investigated quickly. To resolve performance problems and errors with a slow or failing app, you need to be able to analyze whether the underlying cause is related to database performance, one or more hosts or services, or both.
Using New Relic APM's transaction traces, slow query traces, and service maps, you can examine the specific query, database instance (host and port), and database name for the problem. New Relic APM's instance-level metrics can help you drill down to the specific instance or instances that are involved. This helps you quickly assess the impact and resolve the issue.
Access to this feature depends on your subscription level.
Compatibility and requirements
New Relic collects instance details for a variety of databases and database drivers. The ability to view specific instances and the types of database information in New Relic APM depends on your database driver and New Relic agent version.
Requires Go agent version 1.4 or higher.
Supports all database drivers.
Requires Java agent version 3.33.0 or higher.
- Any compatible JDBC driver
- DataStax Cassandra driver 2.1.2, 3.0 to 3.1
- Jedis Redis driver 1.4 to 2.9
- Mongo 2.12.0 to 2.13.3, 3.1 to 3.3
- Spymemcached (2.11 to 2.12)
Exception: Instance-level information is not reported for calls to the
For .NET agent version 220.127.116.11 or higher, this datastore instance information is collected:
- Microsoft SQL Server
This information appears in transaction traces and slow query traces. The .NET agent captures datastore instance details by default.
Requires Node.js agent version 1.31.0 or higher.
Minimum module version Minimum agent version PostgreSQL pg 0.14.0 1.31.0 Redis redis 0.8.3 1.31.0 MongoDB mongodb 2.0.43 1.32.0 MySQL mysql 2.4.1 1.32.0 Memcached memcached 0.2.7 1.33.0
Requires PHP agent version 6.8 or higher.
Database Extension Minimum agent version MongoDB mongodb 7.1 MySQL mysql 6.8 MySQL mysqli 6.8 MySQL pdo_mysql 6.8 PostgreSQL pgsql 6.9 PostgreSQL pdo_pgsql 6.9 Redis predis 7.1 Redis redis 7.1
To disable collection of host information, use either of these options:
- Omit the database name with
newrelic.datastore_tracer.database_name_reporting.enabled = false.
Requires Python agent version 18.104.22.168 or higher.
Database Python package name Minimum package version Minimum agent version PostgreSQL psycopg2 2.0.14 22.214.171.124 MySQL MySQLdb 1.2.5 126.96.36.199 Redis redis 2.6.2 188.8.131.52 Memcached python-memcached 1.51 184.108.40.206 Elasticsearch elasticsearch 0.45 220.127.116.11
Requires Ruby agent version 3.17.0 or higher.
Supports these ORM databases:
ORM Database Adapter name Minimum agent version ActiveRecord 5+ PostgreSQL pg 3.17.0 MySQL mysql2 3.17.0 ActiveRecord 2.1 - 4 PostgreSQL pg 3.17.0 MySQL mysql 3.17.0 MySQL mysql2 3.17.0
Also supports these
Database Gem name Minimum gem version Minimum agent version Memcached Dalli 2.6.4 3.17.1 Mongo DB mongo 2.1.0 3.17.1 Redis redis-rb 3.0.0 3.17.1
To request instance-level information from datastores currently not listed for your New Relic agent, get support at support.newrelic.com.
Use datastore instance details to monitor and troubleshoot your app
Use these examples as starting points to monitor and troubleshoot the performance of connections between your applications and associated datastore instances. The examples describe the New Relic capabilities that can help you determine whether the underlying cause behind app performance problems relates to your applications, a database instance configuration problem (such as a missing index), your organizations resources, or a combination.
- Slow query trace details example
Your Apdex is falling, and you want to determine what is affecting your end users' experience with your app. On the New Relic APM Database page, you notice some slow queries, and you want to investigate further with your database vendor tools.
To do this, you need to know the database name and the instance where the slow query occurred, since the issue may be specific to the instance. For example, the problem may be a missing index. Use New Relic APM's slow query traces to review query performance, locate the database name and instance, and identify any poorly written or inefficient queries.
- Transaction trace details example
Your app has a performance issue, and you have used the New Relic APM Transactions page to identify a suspect transaction. When you select a transaction trace for the slow transaction, you notice that the database time is the key contributor to the transaction performance.
From the selected transaction trace Details, you select the Database [database icon] icon to review the Database query information. This shows both the query details and the specific instance where the query was executed. From here you can use your database vendor tools to further diagnose the issue.
- Service map details example
Your environment has performance issues, and you want to troubleshoot and assess the impact of a performance problem between a calling application and a specific database instance.
Use the APM Service maps page for a quick overview of your app's connections and dependencies, including databases and external services. Each datastore type has its own node on the map. From the selected service map details, you can:
- Review the color-coded health status of the connections between your applications or external services and datastore instances. (New Relic uses a simple baseline technique to compare the performance over the past 15 minutes with the average over the past week.)
- Select particular apps or instance types from their timeseries chart on the service map, then review their Response time or Requests per minute (throughput) for unexpected spikes in performance. (This can help you more easily identify outliers or "noisy neighbors" affecting resources or throughput time with other services.)
- By selecting a datastore node, you can filter the chart by enabling or disabling individual instances (you can manually filter up to 100 instances). Your selections are saved when you save the map.
- Identify outliers that may be causing unexpected impact on performance.
Once you identify the databases or instances with problems with New Relic's service maps, you can use New Relic’s transaction traces and slow query traces as well as your database vendor tools to further diagnose the issue.
- Insights dashboards and widgets example
If you are using a New Relic APM agent that supports database instance details, you can use New Relic Insights to report on timeslice metrics, such as response time and throughput. You can also create and share custom dashboards and metric widgets that visualize performance problems or trends.
- Alerting on custom metrics for instance performance example
To be notified about a performance issue between your app and a database instance before it adversely impacts your customers' experience, use New Relic Alerts. You can create alert policies that automatically notify appropriate personnel via PagerDuty, webhooks, etc. when problems escalate to the Critical thresholds you define.
As part of the alert policy configuration, create a condition with custom metrics for a specific instance, using this format:
For more help
Additional documentation resources include: