Skip to content

Stack Trace and Breadcrumbs table polish#112

Merged
svc-shorpo merged 3 commits into
hyperdxio:mainfrom
svc-shorpo:sentry
Nov 21, 2023
Merged

Stack Trace and Breadcrumbs table polish#112
svc-shorpo merged 3 commits into
hyperdxio:mainfrom
svc-shorpo:sentry

Conversation

@svc-shorpo
Copy link
Copy Markdown
Contributor

@svc-shorpo svc-shorpo commented Nov 19, 2023

Log Side Panel polish

Screenshot 2023-11-18 at 6 13 26 PM

Screenshot 2023-11-18 at 6 13 11 PM

Screenshot 2023-11-18 at 6 12 00 PM

Screen.Recording.2023-11-18.at.6.12.03.PM.mov

Screenshot 2023-11-18 at 6 11 33 PM

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 19, 2023

🦋 Changeset detected

Latest commit: ec9bf7b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@hyperdx/app Minor
@hyperdx/api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svc-shorpo svc-shorpo force-pushed the sentry branch 3 times, most recently from 4f53f2d to f5b4a61 Compare November 19, 2023 02:57
MikeShi42
MikeShi42 previously approved these changes Nov 19, 2023
Copy link
Copy Markdown
Contributor

@MikeShi42 MikeShi42 left a comment

Choose a reason for hiding this comment

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

Mainly just style thoughts, two other things:

Do you think we can switch displayedTab in the LogSidePanel to show the trace view if it's an exception by default? The parsed property tab is still kind of useful (mainly for us for debugging I suspect 😅) but the trace view is much better.

Minor scope creep, do you think you could add a ?? '[]' fallback case in the <ExceptionSubpanel breadcrumbs={JSON.parse... call? It looks like those properties might not exist sometimes.

https://github.com/hyperdxio/hyperdx/pull/112/files#diff-5f55b5edc12310ed29646b1473a4351297d3aafef28cb4a1b4288084c18ef632L657-L670

I can create a follow up ticket otherwise.

tr {
td {
padding: 6px 12px;
border-bottom: 1px solid $slate-950;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thoughts on leaving out the border for some of the network panel stuff? it feels a bit cleaner/less busy
image

};

export const StacktraceRow = ({ row }: { row: Row<StacktraceFrame> }) => {
const [lineContextOpen, setLineContextOpen] = React.useState(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's a bit more intuitive to have the line context open (as it feels like the most helpful part!)

Comment thread packages/app/src/LogSidePanel.tsx Outdated
<Table
hideHeader
columns={stacktraceColumns}
data={firstException.stacktrace?.frames ?? []}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if we should reverse the frames here so that the more specific and likely user-land code is on top?
image

Comment thread packages/app/src/LogSidePanel.tsx Outdated
</SectionWrapper>
</CollapsibleSection>

<CollapsibleSection title="Breadcrumbs" initiallyCollapsed>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also think it'd be nice if this was default open

header: 'Message',
size: UNDEFINED_WIDTH,
cell: ({ row }) =>
row.original.message || <span className="text-slate-500">Empty</span>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it'd be nice here if can also make use of the fetch/xhr categories, as they currently show up as empty (maybe a follow up PR?) Here's a few examples if helpful of the data structure I see:

{
  "category": "fetch",
  "data": {
    "method": "GET",
    "status_code": 200,
    "url": "http://localhost:8080/__nextjs_original-stack-frame"
  },
  "timestamp": 1700379487.918,
  "type": "http"
}
{
  "category": "xhr",
  "data": {
    "method": "POST",
    "status_code": 200,
    "url": "http://localhost:4318/v1/traces"
  },
  "timestamp": 1700379491.015,
  "type": "http"
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll do it in a separate pr

@@ -0,0 +1,333 @@
import * as React from 'react';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm curious how do we differentiate what should belong here vs LogSidePanel? Is this like a generic util elements for the LogSidePanel?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, that's the idea

Comment thread packages/app/src/TeamPageElements.tsx Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oops, removed

Copy link
Copy Markdown
Contributor

@MikeShi42 MikeShi42 left a comment

Choose a reason for hiding this comment

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

I'm assuming we'll leave changing displayedTab to trace for exceptions for a follow up PR as well?

Comment thread packages/app/src/LogSidePanel.tsx Outdated
'breadcrumbs',
)
],
) ?? []
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually I believe in this case we need to do

JSON.parse(
selectedLogData?.['string.values']?.[
  selectedLogData?.['string.names']?.indexOf(
    'breadcrumbs',
  )
] ?? '[]')

as the undefined value into JSON.parse will throw a parse error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point. moved JSON.parse calls into separate memo'd consts with try/catch block just in case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm assuming we'll leave changing displayedTab to trace for exceptions for a follow up PR as well?

yes, will do in a separate PR, this one already becomes a bit unwieldy :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

made changes here: #118

Copy link
Copy Markdown
Contributor

@MikeShi42 MikeShi42 left a comment

Choose a reason for hiding this comment

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

🚢🚢🚢

@svc-shorpo svc-shorpo merged commit 9c2e279 into hyperdxio:main Nov 21, 2023
@svc-shorpo svc-shorpo deleted the sentry branch November 21, 2023 05:43
knudtty pushed a commit that referenced this pull request Apr 16, 2026
alex-fedotyev added a commit that referenced this pull request May 6, 2026
The dashboard activeTabs URL state goes through parseAsJsonEncoded
(packages/app/src/utils/queryParsers.ts), which intentionally
double-encodes the JSON to survive Microsoft Teams' '+' -> '%2B'
re-encoding. The serializer writes encodeURIComponent(JSON.stringify(...))
and nuqs's URL machinery then encodes the '%XX' sequences a second
time. URLSearchParams.get(...) decodes one level, so the helper has
to decode the second level itself before JSON.parse.

The previous helper read the param, called JSON.parse on a still-
URL-encoded string ('%7B%22..."), threw, and returned {} silently.
Tests #112 and #197 polled getActiveTabsParam()[id] for 5s, got
undefined every time, and timed out on toBeTruthy.

Fix: decodeURIComponent before JSON.parse. Keep a fallback to plain
JSON.parse for compatibility with the old single-encoded format,
mirroring the parser's own backward-compat path.

The implementation (handleTabChange / setUrlActiveTabs in DBDashboardPage)
was correct all along; only the test-side reader needed updating.
alex-fedotyev added a commit that referenced this pull request May 8, 2026
The dashboard activeTabs URL state goes through parseAsJsonEncoded
(packages/app/src/utils/queryParsers.ts), which intentionally
double-encodes the JSON to survive Microsoft Teams' '+' -> '%2B'
re-encoding. The serializer writes encodeURIComponent(JSON.stringify(...))
and nuqs's URL machinery then encodes the '%XX' sequences a second
time. URLSearchParams.get(...) decodes one level, so the helper has
to decode the second level itself before JSON.parse.

The previous helper read the param, called JSON.parse on a still-
URL-encoded string ('%7B%22..."), threw, and returned {} silently.
Tests #112 and #197 polled getActiveTabsParam()[id] for 5s, got
undefined every time, and timed out on toBeTruthy.

Fix: decodeURIComponent before JSON.parse. Keep a fallback to plain
JSON.parse for compatibility with the old single-encoded format,
mirroring the parser's own backward-compat path.

The implementation (handleTabChange / setUrlActiveTabs in DBDashboardPage)
was correct all along; only the test-side reader needed updating.
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