Skip to content

Commit

Permalink
fix(err): stackframes: skip empty list, get context per-event (#26530)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverb123 authored Nov 29, 2024
1 parent ce66669 commit b1810ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
18 changes: 12 additions & 6 deletions frontend/src/lib/components/Errors/ErrorDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@ function StackTrace({
showAllFrames: boolean
}): JSX.Element | null {
const { stackFrameRecords } = useValues(stackFrameLogic)
const { loadFromRawIds } = useActions(stackFrameLogic)
const displayFrames = showAllFrames ? frames : frames.filter((f) => f.in_app)

useEffect(() => {
loadFromRawIds(frames.map(({ raw_id }) => raw_id))
}, [frames, loadFromRawIds])

const panels = displayFrames.map(
({ raw_id, source, line, column, resolved_name, lang, resolved, resolve_failure }, index) => {
const record = stackFrameRecords[raw_id]
Expand Down Expand Up @@ -122,8 +117,19 @@ function FrameContextLine({
}
function ChainedStackTraces({ exceptionList }: { exceptionList: ErrorTrackingException[] }): JSX.Element {
const hasAnyInApp = exceptionList.some(({ stacktrace }) => stacktrace?.frames?.some(({ in_app }) => in_app))

const [showAllFrames, setShowAllFrames] = useState(!hasAnyInApp)
const { loadFromRawIds } = useActions(stackFrameLogic)

useEffect(() => {
const frames: ErrorTrackingStackFrame[] = exceptionList.flatMap((e) => {
const trace = e.stacktrace
if (trace?.type === 'resolved') {
return trace.frames
}
return []
})
loadFromRawIds(frames.map(({ raw_id }) => raw_id))
}, [exceptionList, loadFromRawIds])

return (
<>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/components/Errors/stackFrameLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export const stackFrameLogic = kea<stackFrameLogicType>([
loadFromRawIds: async ({ rawIds }) => {
const loadedRawIds = Object.keys(values.stackFrameRecords)
rawIds = rawIds.filter((rawId) => !loadedRawIds.includes(rawId))
if (rawIds.length === 0) {
return values.stackFrameRecords
}
const { results } = await api.errorTracking.stackFrames(rawIds)
return mapStackFrameRecords(results, values.stackFrameRecords)
},
Expand Down
3 changes: 2 additions & 1 deletion rust/cymbal/src/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export KAFKA_CONSUMER_TOPIC="exception_symbolification_events"
export OBJECT_STORAGE_BUCKET="posthog"
export OBJECT_STORAGE_ACCESS_KEY_ID="object_storage_root_user"
export OBJECT_STORAGE_SECRET_ACCESS_KEY="object_storage_root_password"
export ALLOW_INTERNAL_IPS="true"

cargo run --bin cymbal
RUST_LOG=info cargo run --bin cymbal

0 comments on commit b1810ea

Please sign in to comment.