Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Showing Block Size Stats #7233

Merged

Conversation

outofrange
Copy link
Contributor

@outofrange outofrange commented Mar 25, 2024

This PR adds details about block sizes to the blocks UI page.

Each source block row shows an aggregated sum of all chunks and indices of all blocks in this row, respecting the currently selected compaction level.

When selecting a block, the details view shows the following:

  • total size
  • index size & percentage of total
  • chunk size & percentage of total
  • size per day, based on block total size and duration

All sizes are humanized up to Pebibytes, and display the raw bytes value on mouse over via their title text.

As I wasn't sure about all compatibility, block stats are only calculated and taken into account if

  • block has .thanos.files array set
  • individual files have their size_bytes set

At the moment, only chunks and index are counted - meta.json might be present as well, but often hasn't a size assigned to it.
Other rel_path than index and chunks/* are ignored as well.

blocksizestats

Fixes #7205

  • I added CHANGELOG entry for this change.

Changes

  • displaying size stats (if applicable) for selected block in details view
  • displaying aggregated block size per source row

Verification

  • added new tests
  • ran existing React tests
  • manual testing proxying a production Thanos instance of 1-2 TiB (~ 2-4 weeks) from about 10 sources

{sizeStats && (
<>
<div data-testid="total-size">
<b>Total size:</b>&nbsp;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those non breaking spaces are mostly because Prettier (?) trims my trailing spaces at the end of the line :(

@outofrange outofrange marked this pull request as ready for review March 25, 2024 21:39
A block can have a list of contained files set in `.thanos.files`.
If the `files` array is set, all referenced files with `size_bytes` set are counted:
- sum of all `chunk/*` file sizes
- size of index file
- total size (sum of both)

Shows statistics about the selected block in the block details view:
- Total size of block
- Size of index (and percentage of total)
- Size of all chunks (and percentage of total)
- Daily growth, based on total size and block duration

Output is humanized up to Pebibytes and fixed to two decimal places;
raw bytes are accessible through mouse over / title text.

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>
Added total size of all blocks from a source to the row title, beneath the source name.

The shown total size is humanized up to pebibytes and fixed to two decimal places;
raw bytes value is accessible through mouse over / title text.

The shown value will refresh with selected compaction levels, but doesn't take block filter into account.

I thought about showing daily growth as well, but just summing all milliseconds of all blocks doesn't work with overlapping blocks / multiple resolutions.

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>
Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>
@outofrange outofrange force-pushed the feature/7205-blocks-page-size-stats branch from cc14368 to ce31f00 Compare March 25, 2024 22:05
</span>
</div>
<div data-testid="daily-bytes">
<b>Daily:</b>&nbsp;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not too happy about Daily as label, but it's shorter than something like Total per day.

Automatic code formatting duplicated some comments near import statements.

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

I love this change. Great work.

Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

Very nice! Thank you 🙇

@GiedriusS GiedriusS merged commit 6c613fc into thanos-io:main Mar 26, 2024
20 checks passed
@outofrange
Copy link
Contributor Author

That was fast, thank you to both of you too! :)

@douglascamata
Copy link
Contributor

douglascamata commented Mar 26, 2024

@outofrange this is awesome stuff, as others said... thank you!

If you want another idea for a contribution, here's one: each block stream (indexed from 1 to n) has a set of external labels. Currently we have to click on any block inside a stream to see them and this is annoying when you are looking for an specific stream. It would be super helpful to be able to see the external labels there together with the block stream's index and size (that you just added), so that you could just use your browser "find text" feature to find the block stream you want. 💡

@outofrange
Copy link
Contributor Author

@outofrange this is awesome stuff, as others said... thank you!

If you want another idea for a contribution, here's one: each block stream (indexed from 1 to n) has a set of external labels. Currently we have to click on any block inside a stream to see them and this is annoying when you are looking for an specific stream. It would be super helpful to be able to see the external labels there together with the block stream's index and size (that you just added), so that you could just use your browser "find text" feature to find the block stream you want. 💡

I created this ticket for further discussions about this: #7237

jnyi pushed a commit to jnyi/thanos that referenced this pull request Apr 4, 2024
* feat(ui): added BlockSizeStats calculation to blocks page

A block can have a list of contained files set in `.thanos.files`.
If the `files` array is set, all referenced files with `size_bytes` set are counted:
- sum of all `chunk/*` file sizes
- size of index file
- total size (sum of both)

Shows statistics about the selected block in the block details view:
- Total size of block
- Size of index (and percentage of total)
- Size of all chunks (and percentage of total)
- Daily growth, based on total size and block duration

Output is humanized up to Pebibytes and fixed to two decimal places;
raw bytes are accessible through mouse over / title text.

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>

* feat(ui): added aggregated BlockSizeStats to blocks row title

Added total size of all blocks from a source to the row title, beneath the source name.

The shown total size is humanized up to pebibytes and fixed to two decimal places;
raw bytes value is accessible through mouse over / title text.

The shown value will refresh with selected compaction levels, but doesn't take block filter into account.

I thought about showing daily growth as well, but just summing all milliseconds of all blocks doesn't work with overlapping blocks / multiple resolutions.

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>

* chore(docs): added UI block size PR to CHANGELOG.md

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>

* chore(ui): removed comments

Automatic code formatting duplicated some comments near import statements.

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>

---------

Signed-off-by: Markus Möslinger <markus.moeslinger@socra.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bucketweb: Show block size in details pane
4 participants