Skip to content

Instantly share code, notes, and snippets.

@gspncr
Last active October 14, 2019 15:29
Show Gist options
  • Save gspncr/ebf8f330721d24871ce80d8ddcd80441 to your computer and use it in GitHub Desktop.
Save gspncr/ebf8f330721d24871ce80d8ddcd80441 to your computer and use it in GitHub Desktop.
Insights Answer Key

Insights Answer Key

Let's build a dashboard:

FROM PageView SELECT count(pageUrl) SINCE last week FACET pageUrl

displayed as a bar chart

Bonus Lab

How many users have accessed your web site in the past 30 minutes?

FROM PageView SELECT count(session) SINCE 30 minutes ago

Which cities have generated the most traffic over the past 24 hours?

FROM PageView SELECT count(session) SINCE 24 hours ago FACET city LIMIT 10

What is the average database query duration in the past hour?

FROM Transaction SELECT average(databaseDuration) as 'DB Duration (ms)' SINCE 1 hour ago

What are the 5 slowest transactions, and how many times has each been executed in the past hour?

SELECT average(duration), count(*) FROM Transaction FACET name SINCE 1 hour ago LIMIT 5

Finished product:

{
"dashboard": {
"id": 1010829,
"title": "GS: insights workshop",
"description": null,
"icon": "bar-chart",
"created_at": "2019-10-14T13:37:16Z",
"updated_at": "2019-10-14T13:37:16Z",
"visibility": "all",
"editable": "editable_by_all",
"ui_url": "https://insights.newrelic.com/accounts/1147177/dashboards/1010829",
"api_url": "https://api.newrelic.com/v2/dashboards/1010829",
"owner_email": "gspencer@newrelic.com",
"metadata": {
"version": 1
},
"widgets": [
{
"visualization": "billboard",
"layout": {
"width": 1,
"height": 1,
"row": 1,
"column": 1
},
"widget_id": 12786769,
"account_id": 1147177,
"data": [
{
"nrql": "from PageView SELECT count(session) since 30 minutes ago"
}
],
"presentation": {
"title": "Page Views in the last 30 minutes",
"notes": null,
"threshold": {}
}
},
{
"visualization": "facet_bar_chart",
"layout": {
"width": 1,
"height": 1,
"row": 1,
"column": 2
},
"widget_id": 12786770,
"account_id": 1147177,
"data": [
{
"nrql": "FROM PageView SELECT count(session) SINCE 24 hours ago FACET city LIMIT 10"
}
],
"presentation": {
"title": "Cities with the most traffic last 24 hours",
"notes": null,
"drilldown_dashboard_id": 1010769
}
},
{
"visualization": "billboard",
"layout": {
"width": 1,
"height": 1,
"row": 1,
"column": 3
},
"widget_id": 12786771,
"account_id": 1147177,
"data": [
{
"nrql": "FROM Transaction SELECT average(databaseDuration) as 'DB Duration (ms)' SINCE 1 hour ago"
}
],
"presentation": {
"title": "Average DB Duration (ms) for last hour",
"notes": null,
"threshold": {
"red": 0.5,
"yellow": 0.05
}
}
},
{
"visualization": "facet_table",
"layout": {
"width": 3,
"height": 1,
"row": 2,
"column": 1
},
"widget_id": 12786772,
"account_id": 1147177,
"data": [
{
"nrql": "SELECT average(duration), count(*) FROM Transaction FACET name SINCE 1 hour ago LIMIT 5"
}
],
"presentation": {
"title": "Five slowest transactions for the last hour",
"notes": null,
"drilldown_dashboard_id": null
}
}
],
"filter": {
"event_types": [
"PageView"
],
"attributes": [
"city"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment