File tree Expand file tree Collapse file tree 2 files changed +58
-1
lines changed
Expand file tree Collapse file tree 2 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,16 @@ export const zookeeperConfig: QueryConfig = {
4040 [
4141 'zookeeper-requests' ,
4242 {
43- title : 'ZooKeeper Requests/Watch Over Time (Last 7 days)' ,
43+ title : 'ZooKeeper Requests/Watch over last 7 days (req/hour)' ,
44+ interval : 'toStartOfHour' ,
45+ lastHours : 24 * 7 ,
46+ } ,
47+ ] ,
48+ 'break' ,
49+ [
50+ 'zookeeper-wait' ,
51+ {
52+ title : 'ZooKeeper Wait Seconds over last 7 days (AVG/hour)' ,
4453 interval : 'toStartOfHour' ,
4554 lastHours : 24 * 7 ,
4655 } ,
Original file line number Diff line number Diff line change 1+ import { ChartCard } from '@/components/chart-card'
2+ import { fetchData } from '@/lib/clickhouse'
3+ import { BarChart } from '../tremor/bar'
4+ import { type ChartProps } from './chart-props'
5+
6+ export async function ChartZookeeperWait ( {
7+ title = 'ZooKeeper Wait Seconds' ,
8+ interval = 'toStartOfHour' ,
9+ lastHours = 24 * 7 ,
10+ className,
11+ } : ChartProps ) {
12+ const query = `
13+ SELECT
14+ ${ interval } (event_time) AS event_time,
15+ AVG(ProfileEvent_ZooKeeperWaitMicroseconds) / 1000000 AS AVG_ProfileEvent_ZooKeeperWaitSeconds,
16+ formatReadableTimeDelta(AVG_ProfileEvent_ZooKeeperWaitSeconds) AS readable_AVG_ProfileEvent_ZooKeeperWaitSeconds
17+ FROM system.metric_log
18+ WHERE event_time >= now() - INTERVAL ${ lastHours } HOUR
19+ GROUP BY event_time
20+ ORDER BY event_time
21+ `
22+
23+ const data = await fetchData <
24+ {
25+ event_time : string
26+ AVG_ProfileEvent_ZooKeeperWaitSeconds : number
27+ readable_AVG_ProfileEvent_ZooKeeperWaitSeconds : string
28+ } [ ]
29+ > ( {
30+ query,
31+ format : 'JSONEachRow' ,
32+ } )
33+
34+ return (
35+ < ChartCard title = { title } sql = { query } className = { className } >
36+ < BarChart
37+ data = { data }
38+ index = "event_time"
39+ categories = { [ 'AVG_ProfileEvent_ZooKeeperWaitSeconds' ] }
40+ readableColumn = "readable_AVG_ProfileEvent_ZooKeeperWaitSeconds"
41+ className = "h-52"
42+ stack
43+ />
44+ </ ChartCard >
45+ )
46+ }
47+
48+ export default ChartZookeeperWait
You can’t perform that action at this time.
0 commit comments