RienSQL
TASK #165 · Hard · Dynatrace

CPU Sample with Daily Server Baselines

Your brief
To let a Dynatrace operator quickly spot a CPU sample that deviates from its server's normal load that day, we want to show every individual sample alongside the daily aggregates of the same server.

Write a query that returns every row from server_metrics with the columns metric_id, server_id, sample_time, cpu_pct, plus three extra columns: day_avg_cpu (rounded to two decimals), day_max_cpu, day_min_cpu — aggregates over the same server_id and the same calendar day.

Sort by server_id, then by sample_time.
Expected columnsmetric_id server_id sample_time cpu_pct day_avg_cpu day_max_cpu day_min_cpuDynatrace APM
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
applicationsapplication_id, name
logslog_id, application_id, response_time_ms, recorded_at
server_metricsmetric_id, server_id, sample_time, cpu_pct, mem_pct, disk_gb, net_mb