renderGitHubRateLimitDiffPrettySection renders the GitHub API rate limit diff as a pretty console sub-section
(run1ID, run2ID int64, diff *GitHubRateLimitDiff)
| 608 | |
| 609 | // renderGitHubRateLimitDiffPrettySection renders the GitHub API rate limit diff as a pretty console sub-section |
| 610 | func renderGitHubRateLimitDiffPrettySection(run1ID, run2ID int64, diff *GitHubRateLimitDiff) { |
| 611 | fmt.Fprintln(os.Stderr, console.FormatSectionHeader("🐙 GitHub API Usage")) |
| 612 | fmt.Fprintln(os.Stderr) |
| 613 | |
| 614 | config := console.TableConfig{ |
| 615 | Headers: []string{"Metric", fmt.Sprintf("Run #%d", run1ID), fmt.Sprintf("Run #%d", run2ID), "Change"}, |
| 616 | Rows: make([][]string, 0), |
| 617 | } |
| 618 | |
| 619 | if diff.Run1TotalAPICalls > 0 || diff.Run2TotalAPICalls > 0 { |
| 620 | config.Rows = append(config.Rows, []string{ |
| 621 | "Total API calls", |
| 622 | strconv.Itoa(diff.Run1TotalAPICalls), |
| 623 | strconv.Itoa(diff.Run2TotalAPICalls), |
| 624 | diff.APICallsChange, |
| 625 | }) |
| 626 | } |
| 627 | if diff.Run1CoreConsumed > 0 || diff.Run2CoreConsumed > 0 { |
| 628 | config.Rows = append(config.Rows, []string{ |
| 629 | "Core quota consumed", |
| 630 | strconv.Itoa(diff.Run1CoreConsumed), |
| 631 | strconv.Itoa(diff.Run2CoreConsumed), |
| 632 | diff.CoreConsumedChange, |
| 633 | }) |
| 634 | } |
| 635 | if diff.Run1CoreRemaining > 0 || diff.Run2CoreRemaining > 0 { |
| 636 | config.Rows = append(config.Rows, []string{ |
| 637 | "Core remaining", |
| 638 | strconv.Itoa(diff.Run1CoreRemaining), |
| 639 | strconv.Itoa(diff.Run2CoreRemaining), |
| 640 | "—", |
| 641 | }) |
| 642 | } |
| 643 | if diff.Run1CoreLimit > 0 || diff.Run2CoreLimit > 0 { |
| 644 | config.Rows = append(config.Rows, []string{ |
| 645 | "Core limit", |
| 646 | strconv.Itoa(diff.Run1CoreLimit), |
| 647 | strconv.Itoa(diff.Run2CoreLimit), |
| 648 | "—", |
| 649 | }) |
| 650 | } |
| 651 | |
| 652 | if len(config.Rows) > 0 { |
| 653 | fmt.Fprint(os.Stderr, console.RenderTable(config)) |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | // renderToolCallsDiffPrettySection renders the engine-level tool calls diff as a pretty console sub-section. |
| 658 | // It shows a high-level table of all tool types and a dedicated bash commands breakdown. |
no test coverage detected