Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/olive-turkeys-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---

refactor: Add ChartContainer component with toolbar
136 changes: 69 additions & 67 deletions packages/app/src/ClickhousePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ function InfrastructureTab({
return (
<Grid mt="md">
<Grid.Col span={6}>
<ChartBox style={{ minHeight: 400 }}>
<Text size="sm" mb="sm">
CPU Usage (Cores)
</Text>
<ChartBox style={{ height: 400 }}>
<DBTimeChart
title="CPU Usage (Cores)"
config={{
select: [
{
Expand All @@ -80,17 +78,16 @@ function InfrastructureTab({
connection,
dateRange: searchedTimeRange,
timestampValueExpression: 'event_time',
displayType: DisplayType.Line,
}}
onTimeRangeSelect={onTimeRangeSelect}
/>
</ChartBox>
</Grid.Col>
<Grid.Col span={6}>
<ChartBox style={{ minHeight: 400 }}>
<Text size="sm" mb="sm">
Memory Usage
</Text>
<ChartBox style={{ height: 400 }}>
<DBTimeChart
title="Memory Usage"
config={{
select: [
{
Expand All @@ -106,17 +103,16 @@ function InfrastructureTab({
connection,
dateRange: searchedTimeRange,
timestampValueExpression: 'event_time',
displayType: DisplayType.Line,
}}
onTimeRangeSelect={onTimeRangeSelect}
/>
</ChartBox>
</Grid.Col>
<Grid.Col span={6}>
<ChartBox style={{ minHeight: 400 }}>
<Text size="sm" mb="sm">
Disk
</Text>
<ChartBox style={{ height: 400 }}>
<DBTimeChart
title="Disk"
config={{
select: [
{
Expand All @@ -140,17 +136,16 @@ function InfrastructureTab({
connection,
dateRange: searchedTimeRange,
timestampValueExpression: 'event_time',
displayType: DisplayType.Line,
}}
onTimeRangeSelect={onTimeRangeSelect}
/>
</ChartBox>
</Grid.Col>
<Grid.Col span={6}>
<ChartBox style={{ minHeight: 400 }}>
<Text size="sm" mb="sm">
S3 Requests
</Text>
<ChartBox style={{ height: 400 }}>
<DBTimeChart
title="S3 Requests"
config={{
select: [
{
Expand Down Expand Up @@ -192,20 +187,25 @@ function InfrastructureTab({
where: '',
dateRange: searchedTimeRange,
timestampValueExpression: 'event_time',
displayType: DisplayType.Line,
}}
onTimeRangeSelect={onTimeRangeSelect}
/>
</ChartBox>
</Grid.Col>
<Grid.Col span={6}>
<ChartBox style={{ minHeight: 400 }}>
<Text size="sm" mb="xs">
Network
</Text>
<Text size="xs" mb="sm">
Network activity for the entire machine, not only Clickhouse.
</Text>
<ChartBox style={{ height: 400 }}>
<DBTimeChart
title={
<>
<Text size="sm" mb="xs">
Network
</Text>
<Text size="xs" mb="sm">
Network activity for the entire machine, not only Clickhouse.
</Text>
</>
}
config={{
select: [
{
Expand All @@ -223,6 +223,7 @@ function InfrastructureTab({
connection,
dateRange: searchedTimeRange,
timestampValueExpression: 'event_time',
displayType: DisplayType.Line,
}}
onTimeRangeSelect={onTimeRangeSelect}
/>
Expand All @@ -248,32 +249,34 @@ function InsertsTab({
return (
<Grid mt="md">
<Grid.Col span={12}>
<ChartBox style={{ minHeight: 400 }}>
<Group justify="space-between" align="center" mb="sm">
<Text size="sm">
Insert{' '}
{insertsBy === 'queries'
? 'Queries'
: insertsBy === 'rows'
? 'Rows'
: 'Bytes'}{' '}
Per Table
</Text>
<SegmentedControl
size="xs"
value={insertsBy ?? 'queries'}
onChange={value => {
// @ts-ignore
setInsertsBy(value);
}}
data={[
{ label: 'Queries', value: 'queries' },
{ label: 'Rows', value: 'rows' },
{ label: 'Bytes', value: 'bytes' },
]}
/>
</Group>
<ChartBox style={{ height: 400 }}>
<DBTimeChart
title={
<Text size="sm">
Insert{' '}
{insertsBy === 'queries'
? 'Queries'
: insertsBy === 'rows'
? 'Rows'
: 'Bytes'}{' '}
Per Table
</Text>
}
toolbarPrefix={[
<SegmentedControl
size="xs"
value={insertsBy ?? 'queries'}
onChange={value => {
// @ts-ignore
setInsertsBy(value);
}}
data={[
{ label: 'Queries', value: 'queries' },
{ label: 'Rows', value: 'rows' },
{ label: 'Bytes', value: 'bytes' },
]}
/>,
]}
config={{
select:
insertsBy === 'queries'
Expand Down Expand Up @@ -306,6 +309,7 @@ function InsertsTab({
where: '',
timestampValueExpression: 'event_time',
dateRange: searchedTimeRange,
displayType: DisplayType.Line,
filters: [
{
type: 'sql_ast',
Expand All @@ -322,11 +326,9 @@ function InsertsTab({
</ChartBox>
</Grid.Col>
<Grid.Col span={12}>
<ChartBox style={{ minHeight: 200, height: 200 }}>
<Group justify="space-between" align="center" mb="sm">
<Text size="sm">Max Active Parts per Partition</Text>
</Group>
<ChartBox style={{ height: 200 }}>
<DBTimeChart
title="Max Active Parts per Partition"
config={{
select: [
{
Expand Down Expand Up @@ -354,15 +356,19 @@ function InsertsTab({
</Grid.Col>
<Grid.Col span={12}>
<ChartBox style={{ height: 400 }}>
<Text size="sm" mb="sm">
Active Parts Per Partition
</Text>
<Text size="xs" mb="md">
Recommended to stay under 300, ClickHouse will automatically
throttle inserts after 1,000 parts per partition and stop inserts at
3,000 parts per partition.
</Text>
<DBTableChart
title={
<>
<Text size="sm" mb="sm">
Active Parts Per Partition
</Text>
<Text size="xs" mb="md">
Recommended to stay under 300, ClickHouse will automatically
throttle inserts after 1,000 parts per partition and stop
inserts at 3,000 parts per partition.
</Text>
</>
}
config={{
dateRange: searchedTimeRange,
select: [
Expand Down Expand Up @@ -656,11 +662,8 @@ function ClickhousePage() {
</Grid.Col>
<Grid.Col span={12}>
<ChartBox style={{ height: 400 }}>
<Text size="sm" mb="md">
Query Count by Table
</Text>

<DBTimeChart
title="Query Count by Table"
config={{
select: [
{
Expand Down Expand Up @@ -688,6 +691,7 @@ function ClickhousePage() {
)`,
filters,
limit: { limit: 1000 }, // TODO: Cut off more intelligently
displayType: DisplayType.Line,
}}
onTimeRangeSelect={(start, end) => {
onTimeRangeSelect(start, end);
Expand All @@ -697,10 +701,8 @@ function ClickhousePage() {
</Grid.Col>
<Grid.Col span={12}>
<ChartBox style={{ height: 400 }}>
<Text size="sm" mb="md">
Most Time Consuming Query Patterns
</Text>
<DBTableChart
title="Most Time Consuming Query Patterns"
config={{
select: [
{
Expand Down
Loading
Loading