Correlate database queries with Splunk APM traces
Correlate database queries with Splunk APM traces.
Benefits
Correlating database queries with Splunk APM traces provides end-to-end visibility to:
- Pinpoint latency: Determine whether delays occur in the application, the network, or the database.
- Reduce MTTR: Eliminate manual matching by navigating directly from queries to related spans.
- Optimize performance: Prioritize remediation based on the full query path across services and database internals.
How it works
Propagated span or trace information is available only for query samples.
Database receivers in collect query samples every 10 seconds by default. Only those APM traces that correspond to the queries captured as samples will have correlation data recorded. Other traces won't have this correlation present.
Overhead
In order to correlate database queries with Splunk APM traces, you must configure your application's instrumentation to propagate its full context to the database engine. Different database engines implement this context propagation in different ways:
- Microsoft SQL Server: Runs
SET context_infofor each query, adding one additional round-trip. - Oracle Database: Overwrites the
V$SESSION.ACTIONfield for each query. - PostgreSQL: Runs
SET application_nameonce per session; the value applies to all subsequent queries. This is the lowest overhead.
In all cases, the propagation overhead is light and its impact on database engine performance is minimal.
Compatibility
This correlation is supported between these languages, databases, and agent/collector versions:
| Language | Database engine | Agent/collector versions | Documentation |
|---|---|---|---|
|
.NET |
Microsoft SQL Server |
|
|
|
Java (JDBC) |
Microsoft SQL Server |
|
|
|
Java (JDBC) |
Oracle Database |
|
|
|
Java (JDBC) |
PostgreSQL |
|
Navigate from queries to traces
-
From the Database Monitoring Overview, select a database platform instance to load the navigator for that instance.
-
On the navigator, select . See Query details.
Navigate from traces to queries
In Splunk APM, use either the Trace Analyzer or the service map.