Skip to content

Add blank lines between entries of the "stats usage" text output#1683

Merged
jedisct1 merged 6 commits intomainfrom
fdenis/statsusage
Mar 12, 2026
Merged

Add blank lines between entries of the "stats usage" text output#1683
jedisct1 merged 6 commits intomainfrom
fdenis/statsusage

Conversation

@jedisct1
Copy link
Contributor

@jedisct1 jedisct1 commented Mar 11, 2026

Change summary

Add blank lines between entries in stats usage text output to improve readability and parsability . Right now, entries are difficult to split.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

User Impact

Purely cosmetic. fastly stats usage output is now easier to parse.

Are there any considerations that need to be addressed for release?

None. This is a formatting-only change with no functional impact, on a feature that hasn't been deployed to any version. yet.

@jedisct1 jedisct1 requested a review from a team as a code owner March 11, 2026 12:10
@jedisct1 jedisct1 requested a review from rcaril March 11, 2026 12:10
@jedisct1 jedisct1 added the Skip-Changelog do not add a changelog entry for this change label Mar 11, 2026
Copy link
Contributor

@rcaril rcaril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jedisct1 - please use the PR template.

Does this formatting change impact the existing stats tests? Can you please provide the output of the test as well?

Thanks!

@anthony-gomez-fastly
Copy link
Contributor

Should we introduce a flag or something for all table outputs that allow users to add lines? or an env var that the cli can read from?

@jedisct1
Copy link
Contributor Author

stats usage is a new command, not present in any release yet. So that change should be harmless.

@rcaril rcaril requested a review from kpfleming March 11, 2026 13:33
@rcaril
Copy link
Contributor

rcaril commented Mar 11, 2026

Should we introduce a flag or something for all table outputs that allow users to add lines? or an env var that the cli can read from?

I think this is a solid idea. We should consider a common update or toggle to the codebase instead of having a single command specifically with unique formatting.

@jedisct1
Copy link
Contributor Author

Existing commands already have blank lines between blocks.

For example, fastly stats historical prints:

Start Time:          2026-03-10 00:00:00 +0000 UTC
--------------------------------------------------
Hit Rate:                                   16.89%
Avg Hit Time:                               0.68µs
Avg Miss Time:                         771309.15µs

Request BW:                                  99637
  Headers:                                   99637
  Body:                                          0

Response BW:                           11361667354
  Headers:                                  189145
  Body:                                11361478209

Requests:                                      507
  Hit:                                          77
  Miss:                                        379

The problem with stats usage is that blocks are not separated, so it's difficult to parse:

Region: mexico
Bandwidth:        349374359
Requests:         9
Compute Requests: 154163
Region: southamerica_std
Bandwidth:        3732645888
Requests:         160
Compute Requests: 643733
Region: usa
Bandwidth:        242728695726
Requests:         10019
Compute Requests: 49078800

With a blank line between regions:

Region: mexico
Bandwidth:        349374359
Requests:         9
Compute Requests: 154163

Region: southamerica_std
Bandwidth:        3732645888
Requests:         160
Compute Requests: 643733

Region: usa
Bandwidth:        242728695726
Requests:         10019
Compute Requests: 49078800

@anthony-gomez-fastly
Copy link
Contributor

that command is not currently using the same table outputs that most of our commands are using, would it be worth killing 2 birds with one stone and moving those all into the text package and standardizing them?

@jedisct1
Copy link
Contributor Author

that command is not currently using the same table outputs that most of our commands are using, would it be worth killing 2 birds with one stone and moving those all into the text package and standardizing them?

Yes, consistency is important. Done!

@rcaril
Copy link
Contributor

rcaril commented Mar 11, 2026

Thanks for the updates! It looks like some of the tests are failing now.

@jedisct1
Copy link
Contributor Author

Thanks for the updates! It looks like some of the tests are failing now.

Indeed, the corresponding test needed an update, too. Fixed

@jedisct1 jedisct1 merged commit cd5b9d0 into main Mar 12, 2026
13 checks passed
@jedisct1 jedisct1 deleted the fdenis/statsusage branch March 12, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip-Changelog do not add a changelog entry for this change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants