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

fix(frontend): handle incorrect http event display in session timeline #1684

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions frontend/dashboard/app/components/session_replay_event_details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export default function SessionReplayEventDetails({
eventDetails
}: SessionReplayEventDetailsProps) {

function getBodyFromEventDetails(eventDetails: any): ReactNode {
const entries = Object.entries(eventDetails).filter(([key]) => key !== "user_defined_attribute")
function getBodyFromEventDetails(): ReactNode {
// Remove user defined attrs. In case of http event, remove start_time and end_time as well since they represent uptime in ms and not timestamps.
const entries = Object.entries(eventDetails).filter(([key]) => key !== "user_defined_attribute" && !(eventType === "http" && (key === "start_time" || key === "end_time")))
const userDefinedAttributes = Object.entries(eventDetails).find(([key]) => key === "user_defined_attribute")?.[1]
const keyStyle = "text-gray-400 w-1/3"
const valueStyle = "w-2/3 pl-2"
Expand All @@ -37,6 +38,15 @@ export default function SessionReplayEventDetails({
</p>
</div>
)
} else if (key === "request_headers" || key === "response_headers" && typeof value === "object") {
return (
<div className="flex flex-col" key={key}>
<p className={keyStyle}>{key}:</p>
<p className="w-full p-1 text-xs rounded-md whitespace-pre">
{JSON.stringify(value, null, "\t")}
</p>
</div>
)
} else if (value === "" || value === null || typeof value === "object") {
return null // Skip empty or invalid values
} else {
Expand Down Expand Up @@ -122,7 +132,7 @@ export default function SessionReplayEventDetails({
{getAttachmentsFromEventDetails()}
{getExceptionOverviewLinkFromEventDetails()}
{getTraceDetailsLinkFromEventDetails()}
{getBodyFromEventDetails(eventDetails)}
{getBodyFromEventDetails()}
</div>
)
}
Loading