Skip to content
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

Collapsible flamegraph toggle in TraceDetailV2 #7173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hudsongeovane
Copy link

@hudsongeovane hudsongeovane commented Feb 22, 2025

Summary

This PR allows the user to collapse and uncollapse the flamegraph in the Trace Detail page.

Related Issues / PR's

This change is related to issue #7146

Screenshots

This is now the appearence of the page (a toggle button was inserted) without collapsing the flamegraph.

collapse flamegraph1

This is a screenshot of the page with the flamegraph collapsed.

collapse flamegraph2

Affected Areas and Manually Tested Areas

I tested the page manually and it works properly.


Important

Add toggle functionality to collapse and expand the flamegraph in TraceDetailV2.

  • Behavior:
    • Adds isFlamegraphCollapsed state and toggleFlamegraph function in TraceDetailV2.tsx to manage flamegraph visibility.
    • Flamegraph visibility toggled by a button with icon changing between ChevronDown and ChevronRight.
    • Conditional rendering of TraceFlamegraph based on isFlamegraphCollapsed state.
  • UI:
    • Adds a button to toggle flamegraph visibility in TraceDetailV2.tsx.
    • Button displays ChevronDown when expanded and ChevronRight when collapsed.

This description was created by Ellipsis for 1152be2. It will automatically update as commits are pushed.

Copy link

welcome bot commented Feb 22, 2025

Welcome to the SigNoz community! Thank you for your first pull request and making this project better. 🤗

@CLAassistant
Copy link

CLAassistant commented Feb 22, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 1152be2 in 1 minute and 39 seconds

More details
  • Looked at 59 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. frontend/src/pages/TraceDetailV2/TraceDetailV2.tsx:50
  • Draft comment:
    Consider extracting the icon size (currently hardcoded as 14) into a design token or a constant to maintain consistency across the app.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    While using design tokens for consistent values is generally good practice, this is a very minor UI detail. The size 14 appears to be used only once in this component for these specific icons. Without seeing the broader design system or other icon usages, we can't be certain this needs to be standardized. The comment feels overly nitpicky for the scope of this change.
    The suggestion could improve design consistency if there are other icons in the system that should share the same size. However, not every numeric value needs to be a constant - sometimes a one-off value is fine.
    Given that this is a minor UI detail and we don't have evidence that this size needs to be standardized across components, the comment adds unnecessary complexity for minimal benefit.
    Delete the comment as it suggests a potentially unnecessary abstraction for a minor UI detail without clear evidence that standardization is needed here.
2. frontend/src/pages/TraceDetailV2/TraceDetailV2.tsx:50
  • Draft comment:
    ⚠️ Avoid magic numbers: The toggle icon size is hardcoded as 14 in getFlamegraphButtonIcon. Consider extracting this value as a constant or using design tokens for consistency.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
3. frontend/src/pages/TraceDetailV2/TraceDetailV2.tsx:97
  • Draft comment:
    🔎 For better accessibility, consider adding an aria-label to the flamegraph toggle button to clearly indicate its purpose.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_YijOBAlBWtrX1WI5


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.

@@ -89,20 +98,24 @@ function TraceDetailsV2(): JSX.Element {
type="text"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For accessibility, consider adding an 'aria-expanded' attribute to the button (e.g. aria-expanded={!isFlamegraphCollapsed}) to clearly indicate its state.

Suggested change
type="text"
type="text" aria-expanded={!isFlamegraphCollapsed}

traceFlamegraphStatsWidth={traceFlamegraphStatsWidth}
selectedSpan={selectedSpan}
/>
{!isFlamegraphCollapsed && (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some doubts about this approach. I also explored passing the property directly to TraceFlamegraph (which would keep it mounted but not visible, I presume). If you think that's a better direction, please advise. Open to suggestions, thanks!

Copy link
Author

@hudsongeovane hudsongeovane Feb 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, from a UI/UX perspective, I don't know if it is clear to the user when the flamegraph is collpased that there is something hidden or ready to expand at all (See the 2nd screenshot). If you guys would like me to address that somehow, just let me know.

@hudsongeovane hudsongeovane force-pushed the 7146-enable-full-screen-trace-details branch from 1152be2 to a4e939e Compare February 27, 2025 18:56
@hudsongeovane hudsongeovane force-pushed the 7146-enable-full-screen-trace-details branch from a4e939e to 4a7fbb8 Compare March 6, 2025 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants