Skip to content

Instantly share code, notes, and snippets.

@pwillis-els
Created September 30, 2019 21:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwillis-els/fa3c55c41b5a8e83ac9b7a0415b81f98 to your computer and use it in GitHub Desktop.
Save pwillis-els/fa3c55c41b5a8e83ac9b7a0415b81f98 to your computer and use it in GitHub Desktop.
A collection of random NewRelic NRQL queries, mostly from https://discuss.newrelic.com/t/shared-dashboards-contest-add-your-queries-here/60634/119

SELECT (1-filter(uniqueCount(uuid), WHERE category='Crash') / uniqueCount(uuid)) * 100 as Crash Free FROM MobileSession, MobileCrash WHERE crashFingerprint NOT IN () where appName like 'PROD%' SINCE 1 week AGO LIMIT 1000

SELECT average(cpuPercent) AS '' FROM SystemSample FACET entityId SINCE 1 hour ago

SELECT average(databaseCallCount) FROM Transaction SINCE last month until this month COMPARE WITH 1 month ago WITH TIMEZONE 'Europe/London'

SELECT average(databaseDuration) FROM Transaction SINCE last month until this month COMPARE WITH 1 month ago WITH TIMEZONE 'Europe/London'

SELECT average(duration+backendDuration) AS 'Total', average(duration) AS 'Frontend', average(backendDuration) AS 'Backend' FROM PageView WHERE countryCode = 'NZ' AND appName = 'appname' SINCE 1 day ago

SELECT average(duration+backendDuration) AS 'Total' FROM PageView WHERE countryCode = 'NZ' AND appName = 'appname' SINCE 1 day ago COMPARE WITH 1 week ago

SELECT average(duration + (databaseDuration OR 0) + queueDuration) as 'Duration (s)' FROM Transaction SINCE last month until this month COMPARE WITH 1 month ago WITH TIMEZONE 'Europe/London'

SELECT average(duration) FROM PageView WHERE countryCode = 'NZ' AND appName = 'appname' SINCE yesterday COMPARE WITH 1 week ago TIMESERIES

SELECT average(duration) where appName LIKE 'app_name' facet appName since 1 day ago LIMIT 100

SELECT average(loadAverageFiveMinute) AS ' ' FROM SystemSample FACET entityId SINCE 1 hour ago

SELECT average(memoryUsedBytes/memoryTotalBytes*100) AS '' FROM SystemSample FACET entityId SINCE 1 hour ago

SELECT count(*) as ‘Errors’ FROM TransactionError facet error.message WHERE error.message NOT LIKE ‘%Test%’ SINCE 1 day ago LIMIT 10

SELECT count(*) as ‘ESB Errors’ from TransactionError where appName NOT LIKE ‘%SSP%’ SINCE 1 day ago FACET appName

SELECT count(*) AS ‘’ FROM SyntheticCheck SINCE 30 minutes ago FACET result WHERE monitorName = ‘pr_nameofthecheck’

SELECT count(*) as 'Slowness count' from SyntheticCheck FACET monitorName, locationLabel WHERE monitorName like '%WWW_S_%' and monitorName like '%_S_%' and duration/1000 > 10 SINCE 7 days ago LIMIT 100

SELECT count(error) FROM Transaction FACET appName, response.status SINCE 1 day ago TIMESERIES

SELECT count(*) FROM JavaScriptError FACET userAgentOS,errorMessage

SELECT count(*) FROM JavaScriptError SINCE 3 days ago COMPARE WITH 3 days ago TIMESERIES

SELECT count(*) FROM TransactionError WHERE error.message LIKE ‘%An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full%’ and host LIKE ‘%DSS%’ TIMESERIES 1 minute SINCE 7 days ago

SELECT count(*) FROM Transaction facet

SELECT count(*) FROM Transaction SINCE last month until this month COMPARE WITH 1 month ago WITH TIMEZONE 'Europe/London'

SELECT count(*) FROM Transaction WHERE appName in (‘credit production’,‘Consumption Production’,‘Customer Production’,‘address production’,‘billing production’,‘consumer production’,‘contact production’,‘credit production’) FACET httpResponseCode SINCE 60 MINUTES AGO TIMESERIES

SELECT Count(*) FROM Transaction WHERE appName LIKE ‘Prod_%’ AND appName NOT LIKE ‘Prod_EU%’ AND errorMessage LIKE ‘%index was%’ SINCE 7 days ago

SELECT count(*) FROM Transaction WHERE appName LIKE ‘Prod_%’ AND appName NOT LIKE ‘Prod_EU%’ AND errorMessage LIKE ‘%Timeout%’ SINCE 7 days ago

SELECT Count(*) from Transaction WHERE appName like ‘%prod%’ and appName not like ‘%prodstg%’ AND errorMessage LIKE ‘Could not load file or assembly%’ SINCE 7 days ago

SELECT Count(*) from Transaction WHERE appName like ‘%prod%’ and appName not like ‘%prodstg%’ AND errorType like ‘%EndpointNot%’ SINCE 7 days ago

SELECT count(*) FROM Transaction WHERE UserName != ‘XYZ’ AND appName LIKE ‘Prod_%’ and appName NOT LIKE ‘Prod_EU_%’ AND errorMessage LIKE ‘%A network-related or instance-specific error occurred while establishing a connection to SQL Server%’ SINCE 7 days ago

SELECT count(*) FROM Transaction WHERE UserName !‘XYZ’ AND appName LIKE ‘Prod_EU_%’ AND errorMessage LIKE ‘%A connection attempt failed%’ SINCE 7 days ago

SELECT funnel(sessionId, WHERE target like '%Feedback: Did Prompt' as 'Prompted for Feedback', WHERE target like '%Feedback: Satisfied Yes' as 'Tapped Satisfied', WHERE target like '%Feedback: Write Review Yes' as 'Tapped Write Review') FROM TapEvent SINCE 1 week ago

SELECT histogram(databaseDuration) FROM Transaction FACET name SINCE 1 day ago LIMIT 20

SELECT histogram(duration,10,18) from PageView SINCE 1 day ago FACET appName limit 20

SELECT max(messages) AS 'Total Messages', (sum(deadLetterMessages)/sum(messages))*100 as 'Dead Letter %', (sum(activeMessages)/sum(messages))*100 as 'Active %' facet name LIMIT 1000 where resourceGroupName = 'resource_group'

SELECT max(timestamp) FROM IntegrationDataFreshnessReport FACET providerAccountName, dataType, awsRegion SINCE 15 minutes ago

SELECT percentage(count(*), WHERE result='SUCCESS') as 'Availability (%)', average(duration)/1000 as 'Response Time (s)', percentage(count(*), where (monitorName like '%OMM%' and duration/1000 < 150) or (monitorName not like '%OMM%' and duration/1000 < 90)) as 'Satisfied (%)' from SyntheticCheck FACET cases (where monitorName like '%OMM%' as 'HSP1-OMM', Where monitorName like '%SRT%' as 'HSP2-SRT', where monitorName like '%ESMT%' as 'HSP3-ESMT', where monitorName like '%ORCH%' as 'HSP4-Orchestra', where monitorName like '%DY%' as 'HSP7-DynWF') where monitorName like '%_A_%' and monitorName not like '%_UAT_%' since 7 day ago

SELECT percentage(count(*), WHERE result='SUCCESS') as Availability FROM SyntheticCheck FACET cases(where monitorName like 'WSE-W%' as 'WSE-W', where monitorName like 'WSE-X%' as 'WSE-X') Where monitorName LIKE 'WSE%' and monitorName not like '%A_UAT%' SINCE 7 DAY AGO LIMIT 100

SELECT percentage(count(*), WHERE result = 'SUCCESS') FROM SyntheticCheck

```SELECT percentile(duration, 50, 90) FROM Transaction WHERE request.uri LIKE '/scheduleTypeA/%' SINCE 7 days ago FACET `request.uri````

SELECT sum(databaseCallCount) FROM Transaction SINCE last month until this month COMPARE WITH 1 month ago WITH TIMEZONE 'Europe/London'

SELECT sum(databaseDuration) as ‘Time’, count(*) as ‘Count’, percentile(databaseDuration, 99, 80, 50) as ‘DB’ FROM Transaction FACET name SINCE 1 day ago LIMIT 15

SELECT sum(databaseDuration) FROM Transaction FACET name SINCE 1 day ago LIMIT 20

SELECT sum(databaseDuration OR 0) FROM Transaction SINCE last month until this month COMPARE WITH 1 month ago WITH TIMEZONE 'Europe/London'

SELECT sum(duration) as ‘App’, count(*) as ‘Count..." /

SELECT sum(duration) as ‘App’, count(*) as ‘Count’, percentile(duration, 99, 80, 50) as ‘App’ FROM Transaction FACET name SINCE 1 day ago LIMIT 5

SELECT sum(duration) FROM Transaction FACET name SINCE 1 day ago LIMIT 7

SELECT SUM(requestCount), sum(retryCount), sum(throttleException) FROM IntegrationProviderReport FACET providerAccountName, awsRegion, awsServiceName SINCE 1 day ago

SELECT timestamp,appName,host,BuyerPartnerCode,errorMessage,name FROM TransactionError WHERE error.message LIKE ‘%An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full%’ and host LIKE ‘%DSS%’ TIMESERIES 1 minute SINCE 7 days ago

SELECT uniquecount(ec2InstanceId) FROM ComputeSample SINCE 15 minutes AGO

SELECT uniquecount(hostname) FROM ComputeSample FACET operatingSystem SINCE 15 minutes ago

SELECT uniqueCount(name) facet cases(where messages < 1000 as 'Message Count < 1000', where messages >= 1001 and messages <= 9000 as 'Message Count 1001-9000' , where messages > 9001 as 'Message Count > 9000') LIMIT 1000 where resourceGroupName = 'resource_group'

SELECT count(*) / 1000 AS 'Requests thousands', average(duration) * 1000 AS 'Resp. time ms', apdex(duration, 0.5), percentage(count(*), WHERE duration <= 0.5) AS '% Satisfied', percentage(count(*), WHERE duration > 0.5 AND duration <= 2) AS '% Tolerating', percentage(count(*), WHERE duration > 2) AS '% Frustrated' FROM Transaction WHERE appName = 'OurAppName-prod' SINCE 7 days ago

SELECT webjobEmoji FROM WebJobSample AS 'Status', webJobName WHERE webJobName LIKE '%job%'

SELECT max(CollectionSizeGB) FROM CosmosDBSample SINCE 60 minutes ago WHERE Account = 'account' AND Collection = 'collection'

SELECT count(*) FROM Transaction WHERE appName = 'mobile-api' FACET cases(WHERE apdexPerfZone = 'S' AS 'Satisfied', WHERE apdexPerfZone = 'T' AS 'Tolerating', WHERE apdexPerfZone = 'F' AS 'Frustrated') SINCE 1 week ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment