Skip to content

HDDS-14827. Sync chart labels with sorted filesize data - insightsFilePlot#9912

Open
arunsarin85 wants to merge 2 commits intoapache:masterfrom
arunsarin85:HDDS-14827
Open

HDDS-14827. Sync chart labels with sorted filesize data - insightsFilePlot#9912
arunsarin85 wants to merge 2 commits intoapache:masterfrom
arunsarin85:HDDS-14827

Conversation

@arunsarin85
Copy link
Contributor

@arunsarin85 arunsarin85 commented Mar 13, 2026

What changes were proposed in this pull request?

HDDS-14827. Sync chart labels with sorted filesize data - insightsFilePlot

Please describe your PR in detail:
The bug is a label-value misalignment in the frontend chart rendering, introduced when the sorting step was added to the v2 insightsFilePlot.tsx component.

In updatePlotData(), the code did three things in this order:

  1. Build fileCountMap from API data (insertion order = API response order)
  2. Compute fileCountValues (x-axis labels) from the unsorted map
  3. Sort fileCountMap by file size and store it in state

ECharts then wired:

  1. x-axis labels → fileCountValues (derived from unsorted map)
  2. bar heights → fileCountMap.values() (derived from sorted map)

These two arrays are in different orders, so each label gets the wrong bar height. When the API starts returning 100 GiB entries before smaller entries (which happens around 2500+ files, as the large bucket becomes dominant in the RocksDB iterator scan), the "64 GiB – 128 GiB" label ends up at index 0 while ECharts renders the small-file count at index 0 - and the tall bar for 100 GiB files gets the "512 KiB – 1 MiB" label.

Fix
In both insightsFilePlot.tsx (v2) and insights.tsx (legacy), the map is now sorted first, and only then are the x-axis labels computed - ensuring labels and bar values are always derived from the same ordered sequence.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14827

How was this patch tested?

Locally:
Pre-requisites : Added the dummy data in db.json

Volume Bucket fileSize (upper bound) Count Expected label
voltpb buck1pb 137,438,953,472 (2³⁷) 2857 64 GiB – 128 GiB
voltpb buck2pb 137,438,953,472 (2³⁷) 143 64 GiB – 128 GiB
vol1 bucket1–6 1024 – 131072 various 0 B – 128 KiB range
vol2 bucket7 1,048,576 (2²⁰) 410 512 KiB – 1 MiB
vol2 bucket8 16,777,216 (2²⁴) 94 8 MiB – 16 MiB
vol3 bucket9 134,217,728 (2²⁷) 38 64 MiB – 128 MiB
vol3 bucket10 1024 217 0 B – 1 KiB
  1. Navigate to Insights → File Size Distribution
  2. Select voltpb from the Volumes dropdown — the tall bar (3000 files) should be labelled "64 GiB – 128 GiB", not "512 KiB – 1 MiB"
  3. Select "All volumes" — bars should appear in ascending size order left-to-right with correct labels throughout
image image

@adoroszlai adoroszlai added the UI label Mar 13, 2026
@adoroszlai adoroszlai requested a review from spacemonkd March 13, 2026 06:10
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.

2 participants