grafana / explore-profiles

Explore Profiles is a native Grafana application designed to integrate seamlessly with Pyroscope, the open-source continuous profiling platform, providing a smooth, query-less experience for browsing and analyzing profiling data.
GNU Affero General Public License v3.0
18 stars 1 forks source link

perf(LabelsDataSource): Limit the maximum number of concurrent requests when fetching label values #165

Closed grafakus closed 1 month ago

grafakus commented 1 month ago

✨ Description

Related issue(s): -

This PR tries to mitigate a performance issue that arises on the "Labels" view when many labels have high cardinality.

Indeed, prior to this PR, we would just naively fetch all the label values with Promise.all().

We now rely on p-limit to control the maximum number of concurrent requests made to the backend API.

This is just some mitigation, we will revisit this in the future to ensure the best user experience.

📖 Summary of the changes

See diff tab.

🧪 How to test?

Empirically, by checking the browser's "Network" tab and seeing that the number of concurrent requests is limited to 20 (this number can be tweaked with experience, if needed).

github-actions[bot] commented 1 month ago

Unit test coverage

Lines Statements Branches Functions
Coverage: 10%
10.66% (478/4484) 8.21% (136/1656) 7.98% (109/1365)