-
Notifications
You must be signed in to change notification settings - Fork 404
[Plugin] EXPLAIN/PROFILE Visualization #1537
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
[Plugin] EXPLAIN/PROFILE Visualization #1537
Conversation
merge main
src/Explain.tsx - Detect redisearch cluster profile and select the appropriate parser. src/parser.ts - Add redisearch cluster profile parsing and also track parentIds which can be used to add hover support later.
- Use "Records Produced" for graph
- Highlight time based on execution time
- Use outline instead of border to apply the box edge styling outside the box. - Add different profiling time for redisgraph PROFILE.
graph/search query.
className={cx(styles.buttonIcon, styles.viewTypeIcon)} | ||
onClick={onDropDownViewClick} | ||
> | ||
{isOpen && profileOptions.length > 1 && canCommandProfile && !summaryText && ( |
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.
can be profileOptions length less than 2?
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.
Removed the check. profileOptions
will always have 2 elements (PROFILE
and EXPLAIN
).
activeResultsMode={activeResultsMode} | ||
resultsMode={resultsMode} | ||
onQueryOpen={() => onQueryOpen(id)} | ||
onQueryProfile={(profileType: ProfileQueryType) => { |
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.
could you please move this to the separate function?
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.
We are using a prop function of the component here. Are you suggesting we can define the function inside the component?
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.
yes, just a function inside the component
smth like that:
const handleQueryProfile = (profileType: ProfileQueryType) => {}
...
onQueryProfile={handleQueryProfile}
} | ||
}) | ||
|
||
const canCommandProfile = isCommandAllowedForProfile(query.split(' ')[0].toLowerCase()) |
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.
I think it's better to move (' ')[0].toLowerCase()
to the isCommandAllowedForProfile
to not duplicate this everywhere in future
and it will be enough just use isCommandAllowedForProfile(query)
in the condition below
|
||
const ALLOWED_PROFILE_COMMANDS = [...SEARCH_COMMANDS, ...GRAPH_COMMANDS] | ||
|
||
export function isCommandAllowedForProfile(cmd: string) { |
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.
we use arrow functions almost anywhere instead of function declaration , can you change it?
also, could you please add unit tests to each functions?
} | ||
|
||
return null | ||
} |
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.
please add unit tests for generateGraphProfileQuery
, generateSearchProfileQuery
, generateProfileQueryForCommand
<div className={cx(styles.dropdownOption, styles.dropdownProfileOption)}> | ||
<EuiIcon | ||
className={styles.iconDropdownOption} | ||
type={'visTagCloud'} |
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.
do not need {''}
here just double quoutes
- Add unit tests for profile/explain commands generator - Use arrow functions
export function isCommandAllowedForProfile(cmd: string) { | ||
return ALLOWED_PROFILE_COMMANDS.includes(cmd) | ||
export const isCommandAllowedForProfile = (query: string) => { | ||
return ALLOWED_PROFILE_COMMANDS.includes(query.split(' ')[0].toLowerCase()) |
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.
could you also add some check like
query?.split(' ')?.[0]?.toLowerCase()
or query && ALLOWED_PROFILE_COMMANDS.includes(...)
just to avoid some errors
] | ||
|
||
describe('generateGraphProfileQuery', () => { | ||
|
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.
please, remove empty line
] | ||
|
||
describe('generateSearchProfileQuery', () => { | ||
|
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.
the same
|
||
function generateGraphProfileQuery(query: string, type: ProfileQueryType) { | ||
return [`graph.${type}`, ...query.split(' ').slice(1)].join(' ') | ||
export function generateGraphProfileQuery(query: string, type: ProfileQueryType) { |
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.
could you also change here to arrow function?
} | ||
|
||
function generateSearchProfileQuery(query: string, type: ProfileQueryType) { | ||
export function generateSearchProfileQuery(query: string, type: ProfileQueryType) { |
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.
the same
|
||
function generateSearchProfileQuery(query: string, type: ProfileQueryType) { | ||
export function generateSearchProfileQuery(query: string, type: ProfileQueryType) { | ||
const commandSplit = query.split(' ') |
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.
also, add checks to be sure that we cover null
value of query
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, please resolve conflict
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.
lgtm, changed target branch to feature/RI-3726_profile_explain
all bugfix please create from this branch (feature/RI-3726_profile_explain) with name starts fe/bugfix/RI-XXXX
we have pipelines to run tests from branches
fe/feature/** and fe/bugfix/** (will run FE tests)
feature/** (will run all tests after approve on circle ci)
This reverts commit fc31b41.
This reverts commit 58a0ccc.
FT.EXPLAIN/FT.EXPLAINCLI visualization
FT.PROFILE
GRAPH.EXPLAIN
GRAPH.PROFILE