Skip to content

Commit

Permalink
feat: add commas to large numbers to make them easier to read
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Nov 27, 2024
1 parent 1bb12a1 commit cc9798b
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 55 deletions.
8 changes: 4 additions & 4 deletions go/summarize/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ func renderHotQueries(md *markdown.MarkDown, queries []keys.QueryAnalysisResult,
avgQueryTime := query.QueryTime / float64(query.UsageCount)
rows = append(rows, []string{
queryID,
strconv.Itoa(query.UsageCount),
humanize.Comma(int64(query.UsageCount)),
fmt.Sprintf("%.2f", query.QueryTime),
fmt.Sprintf("%.2f", avgQueryTime),
strconv.Itoa(query.RowsExamined),
humanize.Comma(int64(query.RowsExamined)),
})
}

Expand Down Expand Up @@ -112,8 +112,8 @@ func renderTableOverview(md *markdown.MarkDown, tableSummaries []*TableSummary,
for _, summary := range tableSummaries {
thisRow := []string{
summary.Table,
strconv.Itoa(summary.ReadQueryCount),
strconv.Itoa(summary.WriteQueryCount),
humanize.Comma(int64(summary.ReadQueryCount)),
humanize.Comma(int64(summary.WriteQueryCount)),
}
if includeRowCount {
thisRow = append(thisRow, humanize.Comma(int64(summary.RowCount)))
Expand Down
20 changes: 10 additions & 10 deletions go/testdata/bigger_slow_log_avg-rows-examined.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
## Top Queries
|Query ID|Usage Count|Total Query Time (ms)|Avg Query Time (ms)|Total Rows Examined|
|---|---|---|---|---|
|Q1|2|0.40|0.20|20000|
|Q2|3|0.61|0.20|30000|
|Q3|1|0.22|0.22|8000|
|Q4|2|0.37|0.19|16000|
|Q5|2|0.37|0.19|16000|
|Q6|2|0.49|0.25|16000|
|Q7|2|0.31|0.16|15000|
|Q8|1|0.20|0.20|6500|
|Q9|3|0.58|0.19|17000|
|Q10|2|0.34|0.17|8500|
|Q1|2|0.40|0.20|20,000|
|Q2|3|0.61|0.20|30,000|
|Q3|1|0.22|0.22|8,000|
|Q4|2|0.37|0.19|16,000|
|Q5|2|0.37|0.19|16,000|
|Q6|2|0.49|0.25|16,000|
|Q7|2|0.31|0.16|15,000|
|Q8|1|0.20|0.20|6,500|
|Q9|3|0.58|0.19|17,000|
|Q10|2|0.34|0.17|8,500|

### Query Details
#### Q1
Expand Down
20 changes: 10 additions & 10 deletions go/testdata/bigger_slow_log_avg-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
## Top Queries
|Query ID|Usage Count|Total Query Time (ms)|Avg Query Time (ms)|Total Rows Examined|
|---|---|---|---|---|
|Q1|2|0.49|0.25|16000|
|Q2|1|0.22|0.22|8000|
|Q3|3|0.61|0.20|30000|
|Q4|2|0.40|0.20|20000|
|Q5|1|0.20|0.20|6500|
|Q6|3|0.58|0.19|17000|
|Q7|2|0.37|0.19|16000|
|Q8|2|0.37|0.19|16000|
|Q9|2|0.34|0.17|8500|
|Q10|2|0.33|0.17|6000|
|Q1|2|0.49|0.25|16,000|
|Q2|1|0.22|0.22|8,000|
|Q3|3|0.61|0.20|30,000|
|Q4|2|0.40|0.20|20,000|
|Q5|1|0.20|0.20|6,500|
|Q6|3|0.58|0.19|17,000|
|Q7|2|0.37|0.19|16,000|
|Q8|2|0.37|0.19|16,000|
|Q9|2|0.34|0.17|8,500|
|Q10|2|0.33|0.17|6,000|

### Query Details
#### Q1
Expand Down
20 changes: 10 additions & 10 deletions go/testdata/bigger_slow_log_total-rows-examined.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
## Top Queries
|Query ID|Usage Count|Total Query Time (ms)|Avg Query Time (ms)|Total Rows Examined|
|---|---|---|---|---|
|Q1|3|0.61|0.20|30000|
|Q2|2|0.40|0.20|20000|
|Q3|3|0.58|0.19|17000|
|Q4|2|0.37|0.19|16000|
|Q5|2|0.37|0.19|16000|
|Q6|2|0.49|0.25|16000|
|Q7|2|0.31|0.16|15000|
|Q8|2|0.34|0.17|8500|
|Q9|1|0.22|0.22|8000|
|Q10|1|0.20|0.20|6500|
|Q1|3|0.61|0.20|30,000|
|Q2|2|0.40|0.20|20,000|
|Q3|3|0.58|0.19|17,000|
|Q4|2|0.37|0.19|16,000|
|Q5|2|0.37|0.19|16,000|
|Q6|2|0.49|0.25|16,000|
|Q7|2|0.31|0.16|15,000|
|Q8|2|0.34|0.17|8,500|
|Q9|1|0.22|0.22|8,000|
|Q10|1|0.20|0.20|6,500|

### Query Details
#### Q1
Expand Down
20 changes: 10 additions & 10 deletions go/testdata/bigger_slow_log_total-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
## Top Queries
|Query ID|Usage Count|Total Query Time (ms)|Avg Query Time (ms)|Total Rows Examined|
|---|---|---|---|---|
|Q1|3|0.61|0.20|30000|
|Q2|3|0.58|0.19|17000|
|Q3|2|0.49|0.25|16000|
|Q4|2|0.40|0.20|20000|
|Q5|2|0.37|0.19|16000|
|Q6|2|0.37|0.19|16000|
|Q7|2|0.34|0.17|8500|
|Q8|2|0.33|0.17|6000|
|Q9|2|0.31|0.16|15000|
|Q10|1|0.22|0.22|8000|
|Q1|3|0.61|0.20|30,000|
|Q2|3|0.58|0.19|17,000|
|Q3|2|0.49|0.25|16,000|
|Q4|2|0.40|0.20|20,000|
|Q5|2|0.37|0.19|16,000|
|Q6|2|0.37|0.19|16,000|
|Q7|2|0.34|0.17|8,500|
|Q8|2|0.33|0.17|6,000|
|Q9|2|0.31|0.16|15,000|
|Q10|1|0.22|0.22|8,000|

### Query Details
#### Q1
Expand Down
20 changes: 10 additions & 10 deletions go/testdata/bigger_slow_log_usage-count.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
## Top Queries
|Query ID|Usage Count|Total Query Time (ms)|Avg Query Time (ms)|Total Rows Examined|
|---|---|---|---|---|
|Q1|3|0.58|0.19|17000|
|Q2|3|0.61|0.20|30000|
|Q3|2|0.21|0.11|3000|
|Q4|2|0.37|0.19|16000|
|Q5|2|0.31|0.16|15000|
|Q6|2|0.40|0.20|20000|
|Q7|2|0.34|0.17|8500|
|Q8|2|0.33|0.17|6000|
|Q9|2|0.37|0.19|16000|
|Q10|2|0.49|0.25|16000|
|Q1|3|0.58|0.19|17,000|
|Q2|3|0.61|0.20|30,000|
|Q3|2|0.21|0.11|3,000|
|Q4|2|0.37|0.19|16,000|
|Q5|2|0.31|0.16|15,000|
|Q6|2|0.40|0.20|20,000|
|Q7|2|0.34|0.17|8,500|
|Q8|2|0.33|0.17|6,000|
|Q9|2|0.37|0.19|16,000|
|Q10|2|0.49|0.25|16,000|

### Query Details
#### Q1
Expand Down
3 changes: 2 additions & 1 deletion go/testdata/transactions-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

## Transaction Patterns

Pattern 1 (Observed 2 times)
### Pattern 1 (Observed 2 times)


Tables Involved: tblA, tblB
### Query Patterns
Expand Down

0 comments on commit cc9798b

Please sign in to comment.