Skip to content

Commit

Permalink
Introduce new named struct in stats package (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
apstndb authored Nov 29, 2024
1 parent 5bf7e16 commit c5dd001
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
62 changes: 33 additions & 29 deletions stats/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ import (
"fmt"
)

type ExecutionStatsHistogram struct {
Count string `json:"count"`
Percentage string `json:"percentage"`
LowerBound string `json:"lower_bound"`
UpperBound string `json:"upper_bound"`
}

type ExecutionStatsValue struct {
Unit string `json:"unit"`
Total string `json:"total"`
Mean string `json:"mean"`
StdDeviation string `json:"std_deviation"`
Histogram []struct {
Count string `json:"count"`
Percentage string `json:"percentage"`
LowerBound string `json:"lower_bound"`
UpperBound string `json:"upper_bound"`
} `json:"histogram"`
Unit string `json:"unit"`
Total string `json:"total"`
Mean string `json:"mean"`
StdDeviation string `json:"std_deviation"`
Histogram []ExecutionStatsHistogram `json:"histogram"`
}

func (v ExecutionStatsValue) String() string {
Expand All @@ -26,24 +28,26 @@ func (v ExecutionStatsValue) String() string {
}
}

type ExecutionStatsSummary struct {
NumExecutions string `json:"num_executions"`
CheckpointTime string `json:"checkpoint_time"`
ExecutionEndTimestamp string `json:"execution_end_timestamp"`
ExecutionStartTimestamp string `json:"execution_start_timestamp"`
NumCheckPoints json.Number `json:"num_checkpoints"`
}

type ExecutionStats struct {
DiskUsageKBytes ExecutionStatsValue `json:"Disk Usage (KBytes)"`
DiskWriteLatencyMsecs ExecutionStatsValue `json:"Disk Write Latency (msecs)"`
PeakMemoryUsageKBytes ExecutionStatsValue `json:"Peak Memory Usage (KBytes)"`
RowsSpooled ExecutionStatsValue `json:"Rows Spooled"`
Rows ExecutionStatsValue `json:"rows"`
Latency ExecutionStatsValue `json:"latency"`
CpuTime ExecutionStatsValue `json:"cpu_time"`
DeletedRows ExecutionStatsValue `json:"deleted_rows"`
FilesystemDelaySeconds ExecutionStatsValue `json:"filesystem_delay_seconds"`
FilteredRows ExecutionStatsValue `json:"filtered_rows"`
RemoteCalls ExecutionStatsValue `json:"remote_calls"`
ScannedRows ExecutionStatsValue `json:"scanned_rows"`
ExecutionSummary struct {
NumExecutions string `json:"num_executions"`
CheckpointTime string `json:"checkpoint_time"`
ExecutionEndTimestamp string `json:"execution_end_timestamp"`
ExecutionStartTimestamp string `json:"execution_start_timestamp"`
NumCheckPoints json.Number `json:"num_checkpoints"`
} `json:"execution_summary"`
DiskUsageKBytes ExecutionStatsValue `json:"Disk Usage (KBytes)"`
DiskWriteLatencyMsecs ExecutionStatsValue `json:"Disk Write Latency (msecs)"`
PeakMemoryUsageKBytes ExecutionStatsValue `json:"Peak Memory Usage (KBytes)"`
RowsSpooled ExecutionStatsValue `json:"Rows Spooled"`
Rows ExecutionStatsValue `json:"rows"`
Latency ExecutionStatsValue `json:"latency"`
CpuTime ExecutionStatsValue `json:"cpu_time"`
DeletedRows ExecutionStatsValue `json:"deleted_rows"`
FilesystemDelaySeconds ExecutionStatsValue `json:"filesystem_delay_seconds"`
FilteredRows ExecutionStatsValue `json:"filtered_rows"`
RemoteCalls ExecutionStatsValue `json:"remote_calls"`
ScannedRows ExecutionStatsValue `json:"scanned_rows"`
ExecutionSummary ExecutionStatsSummary `json:"execution_summary"`
}
1 change: 1 addition & 0 deletions visualize/visualize.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func RenderImage(ctx context.Context, rowType *sppb.StructType, queryStats *sppb
log.Print(err)
}
}()
graph.SetFontName("Times New Roman:style=Bold")

err = buildGraphFromQueryPlan(graph, rowType, queryStats, param)
if err != nil {
Expand Down

0 comments on commit c5dd001

Please sign in to comment.