-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
GiedriusS
merged 4 commits into
thanos-io:main
from
outofrange:feature/7205-blocks-page-size-stats
Mar 26, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8f44102
feat(ui): added BlockSizeStats calculation to blocks page
outofrange 1077574
feat(ui): added aggregated BlockSizeStats to blocks row title
outofrange ce31f00
chore(docs): added UI block size PR to CHANGELOG.md
outofrange ca7ed42
chore(ui): removed comments
outofrange File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ import { Block } from './block'; | |
import styles from './blocks.module.css'; | ||
import moment from 'moment'; | ||
import PathPrefixProps from '../../../types/PathPrefixProps'; | ||
import { Button, Modal, ModalBody, Form, Input, ModalHeader, ModalFooter } from 'reactstrap'; | ||
import { download } from './helpers'; | ||
import { Button, Form, Input, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; | ||
import { download, getBlockSizeStats, humanizeBytes } from './helpers'; | ||
|
||
export interface BlockDetailsProps { | ||
block: Block | undefined; | ||
|
@@ -21,6 +21,8 @@ export const BlockDetails: FC<BlockDetailsProps & PathPrefixProps> = ({ | |
const [modalAction, setModalAction] = useState<string>(''); | ||
const [detailValue, setDetailValue] = useState<string | null>(null); | ||
|
||
const sizeStats = getBlockSizeStats(block); | ||
|
||
const submitMarkBlock = async (action: string, ulid: string, detail: string | null) => { | ||
try { | ||
const body = detail | ||
|
@@ -80,6 +82,39 @@ export const BlockDetails: FC<BlockDetailsProps & PathPrefixProps> = ({ | |
<b>Chunks:</b> <span>{block.stats.numChunks}</span> | ||
</div> | ||
<hr /> | ||
{sizeStats && ( | ||
<> | ||
<div data-testid="total-size"> | ||
<b>Total size:</b> | ||
<span title={sizeStats.totalBytes + ' Bytes'}>{humanizeBytes(sizeStats.totalBytes)}</span> | ||
</div> | ||
<div data-testid="chunk-size"> | ||
<b>Chunks:</b> | ||
<span title={sizeStats.chunkBytes + ' Bytes'}> | ||
{humanizeBytes(sizeStats.chunkBytes)} ({((sizeStats.chunkBytes / sizeStats.totalBytes) * 100).toFixed(2)}%) | ||
</span> | ||
</div> | ||
<div data-testid="index-size"> | ||
<b>Index:</b> | ||
<span title={sizeStats.indexBytes + ' Bytes'}> | ||
{humanizeBytes(sizeStats.indexBytes)} ({((sizeStats.indexBytes / sizeStats.totalBytes) * 100).toFixed(2)}%) | ||
</span> | ||
</div> | ||
<div data-testid="daily-bytes"> | ||
<b>Daily:</b> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
<span | ||
title={ | ||
Math.round(sizeStats.totalBytes / moment.duration(block.maxTime - block.minTime, 'ms').as('day')) + | ||
' Bytes / day' | ||
} | ||
> | ||
{humanizeBytes(sizeStats.totalBytes / moment.duration(block.maxTime - block.minTime, 'ms').as('day'))} / | ||
day | ||
</span> | ||
</div> | ||
<hr /> | ||
</> | ||
)} | ||
<div data-testid="resolution"> | ||
<b>Resolution:</b> <span>{block.thanos.downsample.resolution}</span> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 :(