The correction is integrated into the TP (See the green boxes)
What you will learn in this TP
- Choose the right NRQL function for each question
- Compare two periods
- Build a dashboard with a variable
- Export a dashboard
All steps and instructions are shown. Recommended for this lab: semi-guided
Introduction #
Context. The product manager wants a single dashboard to follow the shop, and figures to answer their questions: which orders are slow, how many fail, is it worse than yesterday?
Prerequisites: a free New Relic account (license key), a machine with Docker, curl and jq · Estimated time: 45 min
Five NRQL analysis queries and a four-widget "Boutique" dashboard, exported as JSON.Setup #
Guided steps, with their solution.
1. Measure perceived latency
Why? The average hides slow orders; percentiles show them.
Compare average, median, p95 and p99 ofdurationforboutique-tp, then show the distribution.See the correction
SELECT average(duration), median(duration), percentile(duration, 95, 99) FROM Transaction WHERE appName = 'boutique-tp' SINCE 1 hour ago SELECT histogram(duration, 2, 20) FROM Transaction WHERE appName = 'boutique-tp' SINCE 1 hour ago2. Compute an error rate
Why? A percentage compares across periods, a raw count depends on traffic.
Compute the error rate in a single query, as a chart, and compare it with the day before.See the correction
SELECT percentage(count(*), WHERE error IS true) AS 'Erreurs %' FROM Transaction WHERE appName = 'boutique-tp' SINCE 3 hours ago COMPARE WITH 1 day ago TIMESERIES3. Categorize orders
Why? Readable categories speak to product better than milliseconds.
Split transactions into fast (< 0.5 s), ok (< 2 s) and slow, then count 2xx and 5xx in the same query withfilter().See the correction
SELECT count(*) FROM Transaction WHERE appName = 'boutique-tp' FACET CASES(WHERE duration < 0.5 AS 'fast', WHERE duration < 2 AS 'ok', WHERE duration >= 2 AS 'slow') SINCE 1 hour ago SELECT filter(count(*), WHERE http.statusCode < 300) AS '2xx', filter(count(*), WHERE http.statusCode >= 500) AS '5xx' FROM Transaction WHERE appName = 'boutique-tp' TIMESERIES4. Link traces and logs
Why? Logs in context carry the trace ID: you find the lines of a failed request.
Find thetrace.idof a failed transaction, then the logs carrying that same ID.See the correction
SELECT traceId, name, duration FROM Transaction WHERE appName = 'boutique-tp' AND error IS true SINCE 1 hour ago LIMIT 5 SELECT timestamp, level, message FROM Log WHERE trace.id = '<traceId copié>' SINCE 1 hour ago5. Build the dashboard
Why? A shared board saves everyone from rewriting the same queries and gives a common view during an incident.
Create the Boutique dashboard with anappvariable (query onappName) and four widgets: Apdex (billboard with thresholds), throughput and errors (line), p95 per transaction (bar, facet linking on), distribution (histogram). Then export the JSON (Copy JSON to clipboard).See the correction
-- Variable app : SELECT uniques(appName) FROM Transaction SINCE 1 day ago SELECT apdex(duration, t: 0.5) FROM Transaction WHERE appName IN ({{app}}) SELECT rate(count(*), 1 minute) AS 'req/min', filter(count(*), WHERE error IS true) AS 'erreurs' FROM Transaction WHERE appName IN ({{app}}) TIMESERIES SELECT percentile(duration, 95) FROM Transaction WHERE appName IN ({{app}}) FACET name SELECT histogram(duration, 2, 20) FROM Transaction WHERE appName IN ({{app}})
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
NRQL: querying all your New Relic data
Mastering NRQL, New Relic's query language: SELECT … FROM structure, filters, aggregation functio...
New Relic dashboards: building, sharing and analysing
Building useful dashboards in New Relic: NRQL widgets, chart choice, template variables, facet li...
Alerts, service levels and incidents in New Relic
Setting up useful alerting in New Relic: policies and NRQL conditions, static and anomaly thresho...
Creating dashboards in Zabbix: dashboards, widgets and pages
Build useful Zabbix dashboards: pages, widgets (Graph, Problems, Top hosts, Honeycomb, Gauge...),...
Using Faro data: queries, dashboards, alerts and GDPR
Query Faro data in Loki (Web Vitals, errors, events), build dashboards and alerts, and comply wit...
Visualizing and automating Zabbix: dashboards, Grafana and API
Build dashboards and maps in Zabbix, use Grafana's Zabbix plugin, and automate configuration with...
Visualizing in Kibana: Lens, dashboards and saved objects
Build visualizations with Lens, assemble interactive dashboards (filters, controls, links), and m...
Grafana cross-dashboard variables: share variables across dashboards
Create your Grafana variables once and reuse them everywhere: global or folder scope, enabling, a...
Datadog dashboards and notebooks: widgets, template variables and best practices
Design useful Datadog dashboards: widget types, template variables, groups, Powerpacks, formulas,...