diff --git a/dashboards/slow-nrql-queries/slow-nrql-queries.json b/dashboards/slow-nrql-queries/slow-nrql-queries.json new file mode 100644 index 0000000000..a272a7ef27 --- /dev/null +++ b/dashboards/slow-nrql-queries/slow-nrql-queries.json @@ -0,0 +1,823 @@ +{ + "name": "Procore - NRQL Slow Queris and Timeouts", + "description": null, + "pages": [ + { + "name": "Overview", + "description": null, + "widgets": [ + { + "title": "Timeouts by Event Type", + "layout": { + "column": 1, + "row": 1, + "width": 5, + "height": 4 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.bar" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT count(*) FROM NrdbQuery WHERE status = 'timedout' FACET query.eventType limit 100" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Long Running (> 30 secs) By Event Type", + "layout": { + "column": 6, + "row": 1, + "width": 7, + "height": 4 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [ + { + "name": "Avg Duration in Secs", + "precision": 2, + "type": "decimal" + } + ], + "facet": { + "showOtherSeries": false + }, + "initialSorting": { + "direction": "desc", + "name": "Avg Duration in Secs" + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT average(durationMs) / 1000 as 'Avg Duration in Secs' where durationMs > 30000 and status != 'timedout' FACET query.eventType LIMIT MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + }, + "thresholds": [ + { + "columnName": "Avg Duration in Secs", + "from": 30, + "severity": "warning", + "to": 39.999 + }, + { + "columnName": "Avg Duration in Secs", + "from": 40, + "severity": "severe", + "to": 49.999 + }, + { + "columnName": "Avg Duration in Secs", + "from": 50, + "severity": "critical", + "to": 80 + } + ] + } + }, + { + "title": "Long Running (> 30 secs) By Event Type & Time Window", + "layout": { + "column": 1, + "row": 5, + "width": 12, + "height": 4 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [ + { + "name": "Avg Duration in Secs", + "precision": 2, + "type": "decimal" + } + ], + "facet": { + "showOtherSeries": false + }, + "initialSorting": { + "direction": "desc", + "name": "Avg Duration in Secs" + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery \n WITH timeWindowMinutes/86400 AS timeWindowDays\nSELECT average(durationMs) / 1000 as 'Avg Duration in Secs' where durationMs > 30000 WHERE status != 'timedout' FACET query.eventType, timeWindowMinutes, timeWindowDays LIMIT MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + }, + "thresholds": [ + { + "columnName": "Avg Duration in Secs", + "from": 30, + "severity": "warning", + "to": 39.999 + }, + { + "columnName": "Avg Duration in Secs", + "from": 40, + "severity": "severe", + "to": 49.999 + }, + { + "columnName": "Avg Duration in Secs", + "from": 50, + "severity": "critical", + "to": 80 + } + ] + } + }, + { + "title": "Long Running (> 30 secs) Queries Stats", + "layout": { + "column": 1, + "row": 9, + "width": 12, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [ + { + "name": "Avg Duration in Secs", + "precision": 2, + "type": "decimal" + } + ], + "facet": { + "showOtherSeries": false + }, + "initialSorting": { + "direction": "desc", + "name": "Avg Duration in Secs" + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT average(durationMs) / 1000 as 'Avg Duration in Secs' where durationMs > 30000 and status != 'timedout' FACET query LIMIT MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + }, + "thresholds": [ + { + "columnName": "Avg Duration in Secs", + "from": 30, + "severity": "warning", + "to": 39.999 + }, + { + "columnName": "Avg Duration in Secs", + "from": 40, + "severity": "severe", + "to": 49.999 + }, + { + "columnName": "Avg Duration in Secs", + "from": 50, + "severity": "critical", + "to": 80 + } + ] + } + }, + { + "title": "", + "layout": { + "column": 1, + "row": 14, + "width": 2, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.markdown" + }, + "rawConfiguration": { + "text": "# Reference\n## Source Types:\n- apm: Application performance monitoring\n- dashboard: Dashboards displayed on the New Relic platform\n- Distributed tracing: Distributed tracing\n- nerdgraph: NerdGraph, our GraphQL API\n- New Relic user interface: A New Relic curated UI\n- query-api: Insights query API\n- query-builder: Query builder\n [more](https://docs.newrelic.com/attribute-dictionary/?event=NrdbQuery&attribute=source.name)\n---\n### Data Types —[data types](https://docs.newrelic.com/attribute-dictionary/).\nlet me know if you have question: srohatgi@newrelic.com" + } + }, + { + "title": "Queries That Timed Out Stats", + "layout": { + "column": 3, + "row": 14, + "width": 10, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.bar" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT count(*) where status = 'timedout' FACET nr.source, query LIMIT MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Successful Execuations", + "layout": { + "column": 1, + "row": 19, + "width": 6, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.line" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT ((count(query) - filter(count(query), WHERE status !='successful' AND status !='error')) / count(query)) * 100 AS '% Successful' FACET cases(WHERE query LIKE '%bytecountestimate()%' AS 'bytecountestimate()', WHERE query NOT LIKE '%bytecountestimate()%' AS 'Normal') TIMESERIES 30 minutes EXTRAPOLATE " + } + ], + "nullValues": { + "nullValue": "remove" + }, + "platformOptions": { + "ignoreTimeRange": false + }, + "thresholds": { + "isLabelVisible": true + }, + "yAxisLeft": { + "zero": false + }, + "yAxisRight": { + "zero": true + } + } + }, + { + "title": "Timedout", + "layout": { + "column": 7, + "row": 19, + "width": 6, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.line" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT filter(count(query), WHERE query LIKE '%bytecountestimate()%') AS bytecountestimate, filter(count(query), WHERE query NOT LIKE '%bytecountestimate()%' ) as 'Normal' FROM NrdbQuery WHERE status = 'timedout' TIMESERIES 30 minutes FACET status " + } + ], + "platformOptions": { + "ignoreTimeRange": false + }, + "thresholds": { + "isLabelVisible": true + }, + "yAxisLeft": { + "zero": true + }, + "yAxisRight": { + "zero": true + } + } + }, + { + "title": "Errors", + "layout": { + "column": 1, + "row": 22, + "width": 6, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.stacked-bar" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT filter(count(query), WHERE query LIKE '%bytecountestimate()%') AS bytecountestimate, filter(count(query), WHERE query NOT LIKE '%bytecountestimate()%' ) as 'Normal' FROM NrdbQuery WHERE status = 'error' TIMESERIES 30 minutes FACET status " + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "NRDB query API requests per minute", + "layout": { + "column": 7, + "row": 22, + "width": 6, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.line" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM Metric SELECT sum(newrelic.resourceConsumption.currentValue) AS 'Usage' WHERE limitName = 'NRDB query API requests per minute' TIMESERIES AUTO " + } + ], + "platformOptions": { + "ignoreTimeRange": false + }, + "thresholds": { + "isLabelVisible": true + }, + "yAxisLeft": { + "zero": true + }, + "yAxisRight": { + "zero": true + } + } + } + ] + }, + { + "name": "Detail Stats", + "description": null, + "widgets": [ + { + "title": "Log Query Performance MoM (Time Window >= 1 day)", + "layout": { + "column": 1, + "row": 1, + "width": 6, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT FILTER(COUNT(*), WHERE timeWindowMinutes >= 1440 AND query.eventType LIKE '%') AS queries, FILTER(COUNT(*), WHERE status = 'timedout' AND timeWindowMinutes >= 1440 AND query.eventType LIKE '%') AS query_timedout, FILTER(COUNT(*), WHERE status = 'error' AND timeWindowMinutes >= 1440 AND query.eventType LIKE '%') AS query_error, FILTER(MEDIAN(durationMs) / 1000, WHERE timeWindowMinutes >= 1440 AND query.eventType LIKE '%') AS median_duration_sec, FILTER(MEDIAN(timeWindowMinutes) / 60, WHERE timeWindowMinutes >= 1440 AND query.eventType LIKE '%') AS median_window_hours, FILTER(MEDIAN(inspectedCount), WHERE timeWindowMinutes >= 1440 AND query.eventType LIKE '%') AS inspectedCounts, FILTER(MEDIAN((inspectedCount / 1000000) / (durationMs / 1000)), WHERE timeWindowMinutes >= 1440 AND query.eventType LIKE '%') AS meps FROM NrdbQuery LIMIT MAX since 1 month ago compare with 1 month ago" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Log Query Performance MoM (Time Window < 1 day)", + "layout": { + "column": 7, + "row": 1, + "width": 6, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT FILTER(COUNT(*), WHERE timeWindowMinutes < 1440 AND query.eventType LIKE '%') AS queries, FILTER(COUNT(*), WHERE status = 'timedout' AND timeWindowMinutes < 1440 AND query.eventType LIKE '%') AS query_timedout, FILTER(COUNT(*), WHERE status = 'error' AND timeWindowMinutes < 1440 AND query.eventType LIKE '%') AS query_error, FILTER(MEDIAN(durationMs) / 1000, WHERE timeWindowMinutes < 1440 AND query.eventType LIKE '%') AS median_duration_sec, FILTER(MEDIAN(timeWindowMinutes) / 60, WHERE timeWindowMinutes < 1440 AND query.eventType LIKE '%') AS median_window_hours, FILTER(MEDIAN(inspectedCount), WHERE timeWindowMinutes < 1440 AND query.eventType LIKE '%') AS inspectedCounts, FILTER(MEDIAN((inspectedCount / 1000000) / (durationMs / 1000)), WHERE timeWindowMinutes < 1440 AND query.eventType LIKE '%') AS meps FROM NrdbQuery LIMIT MAX since 1 month ago compare with 1 month ago UNTIL now" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Timedout Queries (TimeWindow >= 1 day) Past 7 Days", + "layout": { + "column": 1, + "row": 6, + "width": 6, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.stacked-bar" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT count(*) FROM NrdbQuery WHERE status = 'timedout' AND timeWindowMinutes >= 1440 TIMESERIES auto FACET productCapability since 7 days ago" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Timedout Queries (TimeWindow < 1 day) Past 7 Days", + "layout": { + "column": 7, + "row": 6, + "width": 6, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.stacked-bar" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT count(*) FROM NrdbQuery WHERE status = 'timedout' AND timeWindowMinutes < 1440 TIMESERIES auto FACET productCapability since 7 days ago" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Long Running (> 10 secs) Log Queries Stats", + "layout": { + "column": 1, + "row": 9, + "width": 12, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [ + { + "name": "Avg Duration in Secs", + "precision": 2, + "type": "decimal" + } + ], + "facet": { + "showOtherSeries": false + }, + "initialSorting": { + "direction": "desc", + "name": "Executions" + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT average(durationMs) / 1000 as 'Avg Duration in Secs', average(inspectedCount) as 'Inspected Count', count(*) as 'Executions', average(timeWindowMinutes)/60/24 as 'Time Window (days)' where durationMs > 10000 and status != 'timedout' FACET query LIMIT MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + }, + "thresholds": [ + { + "columnName": "Avg Duration in Secs", + "from": 20, + "severity": "warning", + "to": 40 + }, + { + "columnName": "Avg Duration in Secs", + "from": 40, + "severity": "severe", + "to": 70 + }, + { + "columnName": "Avg Duration in Secs", + "from": 70, + "severity": "critical", + "to": 60000 + } + ] + } + }, + { + "title": "", + "layout": { + "column": 1, + "row": 14, + "width": 2, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.markdown" + }, + "rawConfiguration": { + "text": "# Reference\n## Source Types:\n- apm: Application performance monitoring\n- dashboard: Dashboards displayed on the New Relic platform\n- Distributed tracing: Distributed tracing\n- nerdgraph: NerdGraph, our GraphQL API\n- New Relic user interface: A New Relic curated UI\n- query-api: Insights query API\n- query-builder: Query builder\n [more](https://docs.newrelic.com/attribute-dictionary/?event=NrdbQuery&attribute=source.name)\n---\n### Data Types —[data types](https://docs.newrelic.com/attribute-dictionary/).\nlet me know if you have question: srohatgi@newrelic.com" + } + }, + { + "title": "Queries That Timed Out Stats", + "layout": { + "column": 3, + "row": 14, + "width": 10, + "height": 5 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.bar" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT count(*) where status = 'timedout' FACET nr.source, query LIMIT MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Users with Slow Queries [Duration 20+ seconds & Time window 1+ days]", + "layout": { + "column": 1, + "row": 19, + "width": 12, + "height": 8 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.pie" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT average(timeWindowMinutes)/60/24 as 'Time Window (days)' where durationMs > 20000 and status != 'timedout' and query LIKE '%from log%' and timeWindowMinutes > 1440 FACET user LIMIT 10" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + } + ] + }, + { + "name": "Scanned Events", + "description": null, + "widgets": [ + { + "title": "Executed Queries Scanning Over 100 Million Events", + "layout": { + "column": 1, + "row": 1, + "width": 12, + "height": 8 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [ + { + "name": "Duration in Secs", + "precision": 2, + "type": "decimal" + }, + { + "name": "Events Scanned", + "type": "humanized" + } + ], + "facet": { + "showOtherSeries": true + }, + "initialSorting": { + "direction": "desc", + "name": "Events Scanned" + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT status, user, query.eventType as 'Schema(s) Scanned', source.name as 'Executor', durationMs / 1000 as 'Duration in Secs', inspectedCount as 'Events Scanned', query from NrdbQuery where inspectedCount > 1e8 limit MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Executed Queries Sorted by Avg Duration (excluding Nerd Graph and Byte Count Estimate Queries)", + "layout": { + "column": 1, + "row": 9, + "width": 12, + "height": 9 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [ + { + "name": "Avg Duration in Secs", + "precision": 2, + "type": "decimal" + }, + { + "name": "Avg scannedEvents", + "type": "decimal" + } + ], + "facet": { + "showOtherSeries": false + }, + "initialSorting": { + "direction": "desc", + "name": "Timeouts" + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT average(inspectedCount) as 'Avg Events Scanned', average(durationMs) / 1000 as 'Avg Duration in Secs', filter(count(query), WHERE status = 'timedout') AS 'Timeouts', filter(count(query), WHERE status = 'successful') AS 'Successful', count(query) AS 'Total', ((count(query) - filter(count(query), WHERE status = 'timedout')) / count(query)) * 100 AS '% Successful' LIMIT MAX WHERE nr.source NOT LIKE 'NerdGraph' AND query NOT LIKE '%bytecountestimate()%' FACET query, user as 'User', source.name as 'Query Executor', source.dashboardId as 'Dashboard ID', query.eventType as 'Schema(s)' ORDER BY 'Avg Duration in Secs'" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + }, + { + "title": "Executed Queries Scanning Over 100 Million Events", + "layout": { + "column": 1, + "row": 18, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [ + { + "name": "Duration in Secs", + "precision": 2, + "type": "decimal" + }, + { + "name": "Events Scanned", + "type": "humanized" + } + ], + "facet": { + "showOtherSeries": true + }, + "initialSorting": { + "direction": "desc", + "name": "Events Scanned" + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "SELECT status, user, query.eventType as 'Schema(s) Scanned', source.name as 'Executor', durationMs / 1000 as 'Duration in Secs', inspectedCount as 'Events Scanned', query from NrdbQuery where inspectedCount > 1e8 limit MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + } + ] + }, + { + "name": "Dashboard Usage (unsucsessful)", + "description": null, + "widgets": [ + { + "title": "Unsuccesful Dashboard Access", + "layout": { + "column": 1, + "row": 1, + "width": 12, + "height": 6 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountIds": [], + "query": "FROM NrdbQuery SELECT count(*) WHERE source.dashboardId IS NOT NULL and status != 'successful' FACET user, status, source.url, source.dashboardId, source.name, query, query.eventType LIMIT MAX" + } + ], + "platformOptions": { + "ignoreTimeRange": false + } + } + } + ] + } + ], + "variables": [] +} \ No newline at end of file diff --git a/dashboards/slow-nrql-queries/slow-nrql-queries.png b/dashboards/slow-nrql-queries/slow-nrql-queries.png new file mode 100644 index 0000000000..1d94bdc886 Binary files /dev/null and b/dashboards/slow-nrql-queries/slow-nrql-queries.png differ diff --git a/quickstarts/slow-query-analytics/config.yml b/quickstarts/slow-nrql-query-analytics/config.yml similarity index 96% rename from quickstarts/slow-query-analytics/config.yml rename to quickstarts/slow-nrql-query-analytics/config.yml index 56bee99973..6f32c7bb72 100644 --- a/quickstarts/slow-query-analytics/config.yml +++ b/quickstarts/slow-nrql-query-analytics/config.yml @@ -1,4 +1,4 @@ -slug: slow-query-analytics +slug: slow-nrql-query-analytics title: Slow Query Analytics description: | This quickstart provides resources to better understand your NRQL query performance. diff --git a/quickstarts/slow-query-analytics/logo.svg b/quickstarts/slow-nrql-query-analytics/logo.svg similarity index 100% rename from quickstarts/slow-query-analytics/logo.svg rename to quickstarts/slow-nrql-query-analytics/logo.svg