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
Flamegraph: Add switch for color scheme by value or by package #70770
Conversation
/* eslint-disable no-bitwise */ | ||
/* eslint-disable camelcase */ | ||
|
||
export default function murmurhash3_32_gc(key: string, seed = 0) { |
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.
Taken from pyro code, not sure if we need this, the hash func quality here probably isn't the most important for color coding.
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.
If we only need a hash can we use the same one from the color-generator?
public/app/plugins/panel/flamegraph/flamegraphV2/components/FlameGraph/rendering.ts
Show resolved
Hide resolved
// the language from the backend and use the right regex but right now we just try all of them from most to least | ||
// specific. | ||
const matchers = [ | ||
['phpspy', /^(?<packageName>(.*\/)*)(?<filename>.*\.php+)(?<line_info>.*)$/], |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
// specific. | ||
const matchers = [ | ||
['phpspy', /^(?<packageName>(.*\/)*)(?<filename>.*\.php+)(?<line_info>.*)$/], | ||
['pyspy', /^(?<packageName>(.*\/)*)(?<filename>.*\.py+)(?<line_info>.*)$/], |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
const matchers = [ | ||
['phpspy', /^(?<packageName>(.*\/)*)(?<filename>.*\.php+)(?<line_info>.*)$/], | ||
['pyspy', /^(?<packageName>(.*\/)*)(?<filename>.*\.py+)(?<line_info>.*)$/], | ||
['rbspy', /^(?<packageName>(.*\/)*)(?<filename>.*\.rb+)(?<line_info>.*)$/], |
Check failure
Code scanning / CodeQL
Inefficient regular expression High
public/app/features/explore/TraceView/components/utils/color-generator.tsx
Show resolved
Hide resolved
Backend code coverage report for PR #70770 |
Frontend code coverage report for PR #70770
|
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 we want to do something about the code scanning alerts?
- Clicking around focusing blocks seems to mess up the color scheme
Screen.Recording.2023-06-29.at.14.20.18.mov
public/app/plugins/panel/flamegraph/flamegraphV2/components/FlameGraph/murmur3.ts
Show resolved
Hide resolved
/* eslint-disable no-bitwise */ | ||
/* eslint-disable camelcase */ | ||
|
||
export default function murmurhash3_32_gc(key: string, seed = 0) { |
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.
If we only need a hash can we use the same one from the color-generator?
public/app/plugins/panel/flamegraph/flamegraphV2/components/FlameGraph/colors.ts
Show resolved
Hide resolved
Would like to leave it for later. The hash function in traceView seems very simplistic (not that I am expert on hashFunctions) so not sure if it does not make sense to use some normal hash function for this so the hashes (and colors) are more randomly distributed. Will take a look at that at some point though.
If they do not block the PR would also leave it for now. The problem is I am not really sure how to improve that right away and the labels are mostly machine generated so it's not likely somebody imho that somebody would pass some very weird string here (and even so it will just be slow UI). Also this may possibly change a bit if we pass the language information from backend already.
Can you try again? Does not happen for me and I remember fixing issue like this in this PR (not sure when) so wonder if you may been on some older commit or something like that. |
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.
Appears to have cleared itself up. All you seem to have done is pulled from main so not sure what was causing the issue in the video.
This looks brilliant btw 👍
Adds a button with dropdown to select how the items in flamegraph should be colored.
The current value representation is a bit minimalistic, by changing the gradient in the dot in the button but the color dot is what we use as a color picker so it is sort of consistent with other pickers.
flamegraph_colors_cheme.mp4
Note:
This is behind feature flag
flameGraphV2