-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: updated the logic for variable update queue (#6586) #6788
Conversation
* feat: updated the logic for variable update queue * feat: added API limiting to reduce unnecessary api call for dashboard variables (#6609) * feat: added API limiting to reduce unneccesary api call for dashboard variables * feat: fixed dropdown open triggering the api calls for single-select and misc * feat: add jest test cases for new logic's utils, functions and processors - dashboardVariables (#6621) * feat: added API limiting to reduce unneccesary api call for dashboard variables * feat: fixed dropdown open triggering the api calls for single-select and misc * feat: add jest test cases for new logic's utils, functions and processors - dashboardVariables * feat: added test for checkAPIInvocation * feat: refactor code * feat: added more test on graph utilities * feat: resolved comments and removed mount related handlings * feat: fixed test cases and added multiple variable formats --------- Co-authored-by: Srikanth Chekuri <[email protected]>
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
❌ Changes requested. Reviewed everything up to bc43433 in 2 minutes and 1 seconds
More details
- Looked at
1111
lines of code in6
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx:143
- Draft comment:
EnsureupdatedVariables
is correctly filtered to avoid duplicates when merging withprev
. - Reason this comment was not posted:
Confidence changes required:50%
ThesetVariablesToGetUpdated
function is called with a new array that includes the current state and the updated variables. However, this can lead to duplicate entries ifupdatedVariables
already contains elements fromprev
. Using aSet
is a good approach to ensure uniqueness, but it's important to ensure thatupdatedVariables
is correctly filtered before merging.
2. frontend/src/container/NewDashboard/DashboardVariablesSelection/VariableItem.tsx:194
- Draft comment:
Optimize theenabled
condition inuseQuery
to avoid unnecessary checks whenvariableData.type
is not 'QUERY'. - Reason this comment was not posted:
Confidence changes required:50%
TheuseQuery
hook'senabled
condition checks ifvariableData
is defined and if its type is 'QUERY'. However, it also checkscheckAPIInvocation
, which might not be necessary ifvariableData
is not of type 'QUERY'. This could be optimized by restructuring the conditions to avoid unnecessary checks.
Workflow ID: wflow_OSrRgxqa7YZ44T4s
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx
Show resolved
Hide resolved
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Incremental review on f56d0dd in 1 minute and 3 seconds
More details
- Looked at
128
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. frontend/src/container/NewDashboard/DashboardVariablesSelection/util.ts:42
- Draft comment:
Consider usingArray.prototype.filter
instead ofArray.prototype.map
to directly filter variables based on the condition, which would eliminate the need for the subsequentfilter
call to remove null values. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The suggestion is technically valid - using filter() could be more concise. However, the current implementation is clear and follows a common pattern. The map+filter pattern allows for clearer separation between transformation and filtering logic. The performance difference would be negligible.
The current code may actually be more readable by separating the transformation from filtering. The suggested change could make the code more dense and harder to follow.
While filter() could work, the current implementation is perfectly valid and may even be more maintainable by clearly separating the transformation and filtering steps.
This comment suggests a minor optimization that doesn't clearly improve code quality and could potentially reduce readability. The current implementation is fine as is.
2. frontend/src/container/NewDashboard/DashboardVariablesSelection/util.ts:76
- Draft comment:
Consider initializing thegraph
with only 'QUERY' type variables to avoid confusion or errors related to non-QUERY variables having dependencies. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The current implementation initializes empty arrays for all named variables, but only QUERY types can have dependencies. However, non-QUERY variables can still be referenced by QUERY variables, so they need to be in the graph. The comment's suggestion could actually break functionality by excluding valid dependency targets.
Maybe there's a performance benefit to only tracking QUERY variables? Or maybe having non-QUERY variables in the graph could cause issues I haven't considered?
The performance impact would be negligible, and having non-QUERY variables in the graph is actually necessary since they can be dependency targets. The current implementation is correct.
The comment should be deleted as it suggests a change that would break functionality by preventing non-QUERY variables from being dependency targets.
3. frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx:78
- Draft comment:
Avoid using inline styles in React components. Consider using external stylesheets, CSS classes, or styled components instead. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
Workflow ID: wflow_tuwO3ZNRGqkOvQnA
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
frontend/src/container/NewDashboard/DashboardVariablesSelection/DashboardVariableSelection.tsx
Show resolved
Hide resolved
Failing Checks - commitLint failing because of the length of one of the PR commit titles - "feat: add jest test cases for new logic's utils, functions and processors - dashboardVariables" Jest Failing due to lower % |
Summary
Under this change I have introduced the following things -
For more info refer to the
Technical Analysis and new approach
block of this notion doc - https://www.notion.so/signoz/Dashboard-Variables-8783d02224c0483b9e8a4b8218cb5ddc?pvs=4#2c0617c157a141f5a09ba261d9d15d4dTest cases -
Related Issues / PR's
Screenshots
Comparison between local and prod env
Screen.Recording.2024-12-04.at.10.15.42.AM.mov
Affected Areas and Manually Tested Areas
Tested before and after of -
Important
Replaces variable update queue with topological sort in
DashboardVariableSelection.tsx
to fix dashboard loading issues and adds utility functions for dependency management.DashboardVariableSelection.tsx
.buildDependencies
,buildDependencyGraph
,buildParentDependencyGraph
, andonUpdateVariableNode
toutil.ts
for managing variable dependencies.checkAPIInvocation
to determine when API calls should be made based on dependencies.VariableItem.test.tsx
to test new dependency logic.dashboardVariables.test.tsx
to test utility functions for dependency management.This description was created by for f56d0dd. It will automatically update as commits are pushed.