Query distributed trace data

You can query your distributed tracing data in two ways:

To learn about trace structure, see How distributed tracing works.

Example NRQL queries

Some example NRQL queries:

Datastore time percentile for an app
SELECT percentile(duration, 50, 95) FROM Span WHERE category = 'datastore' 
and appName = 'YOUR_APP_NAME' SINCE 4 hours ago TIMESERIES 1 minute
Datastore query time for an app, faceted by host
SELECT average(duration) FROM Span WHERE appName = 'YOUR_APP_NAME' 
and category = 'datastore' FACET host TIMESERIES 1 minute
Average duration for a method of a service, faceted by host
SELECT average(duration) FROM Span WHERE appName = 'YOUR_APP_NAME'
and name = 'FUNCTION_NAME' FACET host TIMESERIES 1 minute
Histogram of external services called by a service, faceted by external URI
SELECT histogram(duration, 10, 60) FROM Span WHERE category = 'http'
and appName = 'YOUR_APP_NAME' FACET `http.url` SINCE 4 hours ago
Average duration for external calls across all applications
SELECT average(duration) FROM Span WHERE category = 'http'
SINCE 4 hours ago FACET `http.url` TIMESERIES 1 minute

Example NerdGraph queries

You can also use NerdGraph to query your trace data using the API. For more information, see the NerdGraph distributed tracing data query examples.

Can't find data?

Having trouble finding data when querying? See Troubleshooting: missing data.

For more help

Recommendations for learning more: