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
17
stars
1
forks
source link
fix(Labels): Fix "Discarded by user" error in the UI #110
This PR fixes an error that can occur when changing the data source or clicking on the main refresh button in the UI:
Additionally, this PR also fixes a potential issue with the query builder, which does not update its API client whenever the data source changes.
📖 Summary of the changes
The error comes from an unwanted interaction between the query builder and LabelsDataSource where the API request made by LabelsDataSource to fetch label names is cancelled by the query builder state machine. This happens because the both share the same instance of the LabelsRepository class, which in turn uses the same API client.
The scenario is the following:
Whenever the user changes the data source:
GroupByVariable gets its options updated via LabelsDataSource
In LabelsDataSource, LabelsRepository sets the API client corresponding to the new data source
the query builder state machine receives new input parameters, which in turn, causes the machine to transition to its idle state
✨ Description
Related issue(s):
-
This PR fixes an error that can occur when changing the data source or clicking on the main refresh button in the UI:
Additionally, this PR also fixes a potential issue with the query builder, which does not update its API client whenever the data source changes.
📖 Summary of the changes
The error comes from an unwanted interaction between the query builder and
LabelsDataSource
where the API request made byLabelsDataSource
to fetch label names is cancelled by the query builder state machine. This happens because the both share the same instance of theLabelsRepository
class, which in turn uses the same API client.The scenario is the following:
Whenever the user changes the data source:
GroupByVariable
gets its options updated viaLabelsDataSource
LabelsDataSource
,LabelsRepository
sets the API client corresponding to the new data sourceLabelsRepository
, this throws an abort error that bubbles up to the "Group by" UIThe solution is to make sure distinct instances of the API client are created by the query builder and by
LabelsDataSource
.See the diff tab for additional specific comments.
🧪 How to test?