Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(error-tracking): read exception level from $exception_level (#80319)

posthog[bot]00c8c3cb9ae3
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 9038f21135d2..21d26d62b8eb 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -1941,9 +1941,9 @@ snapshots:
errortracking-contextdisplay--context-display-misc--light:
hash: v1.k794b7964.00799acd69df9d4178cc8e3a22396275da74af7e9ac3aa44230457a93ba1e6b0.Hw5Bm-xSzHlK5h1pGziquWyxHVAn4tsb_XN8IboLpCw
errortracking-contextdisplay--context-display-with-stacktrace--dark:
- hash: v1.k794b7964.9121d4f367026feecf12778c6b7b059e23bade1da1128df35caa395e6c49c055.Eyc0wiDeWL4bsFO0RS2-iTrHqv_Bxd5L7xdfagzpGxY
+ hash: v1.k794b7964.cb01ac0c8ec731bf6615682b42a02a4af6010dedc74a4e02f98682c00f89033d.r9ko2z5Ew7PiEmPRGAugMqp2sA7Pwv-vMMERAFGKuEA
errortracking-contextdisplay--context-display-with-stacktrace--light:
- hash: v1.k794b7964.2f60cfda48c4da83267fbafd7551aa3391b84ee1eac3eb91c4b0bf3f3b001a86.-wGXL7sLZx5P7cIM7CdrmxqC-CtckBVdIZSwGJmH8zs
+ hash: v1.k794b7964.2cb3491793b79cf90503fca5f272462570ca063baf084f4798ef855f560d5691.hVu_B8x0_P63Lnkqyk-syp8-LlqSbzw1GdRonGsH6W4
errortracking-exceptioncard--exception-card-all-events--dark:
hash: v1.k794b7964.b483574651f80c06e0ff28e020f9a49f859a6961ce4371e1429e8af16e440b05.u_JXXvDFsIfQPKnvnaS4HjCvBOG2tYOkywcnufkxA0Q
errortracking-exceptioncard--exception-card-all-events--light:
diff --git a/frontend/src/lib/components/Errors/utils.test.ts b/frontend/src/lib/components/Errors/utils.test.ts
index 0391964caa30..36d12f3d4fc7 100644
--- a/frontend/src/lib/components/Errors/utils.test.ts
+++ b/frontend/src/lib/components/Errors/utils.test.ts
@@ -109,7 +109,7 @@ describe('Error Display', () => {
runtime: 'web',
lib: 'posthog-js',
libVersion: '1.0.0',
- level: 'info',
+ level: undefined,
os: 'Windows',
osVersion: '10',
sentryUrl:
@@ -171,6 +171,13 @@ describe('Error Display', () => {
})
})
+ // The tests above already cover a lone $level and no level key at all, which both resolve to
+ // undefined. This only pins that $exception_level is the key we read.
+ it('reads level from $exception_level', () => {
+ const result = getExceptionAttributes({ $exception_level: 'fatal', $level: 'info' })
+ expect(result.level).toEqual('fatal')
+ })
+
// A non-string $session_id (e.g. a numeric timestamp from a misbehaving SDK) must not leak
// through as a number — it used to crash the issue scene via a ts-pattern exhaustive match.
it.each([
diff --git a/frontend/src/lib/components/Errors/utils.ts b/frontend/src/lib/components/Errors/utils.ts
index 3162c834e3b5..50b873359a80 100644
--- a/frontend/src/lib/components/Errors/utils.ts
+++ b/frontend/src/lib/components/Errors/utils.ts
@@ -76,7 +76,7 @@ export function getExceptionAttributes(properties: Record<string, any>): Excepti
$os: os,
$os_version: osVersion,
$sentry_url: sentryUrl,
- $level: level,
+ $exception_level: level,
$cymbal_errors: ingestionErrors,
} = properties
diff --git a/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsx b/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsx
index 2f86520cbd64..fe2042f42120 100644
--- a/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsx
+++ b/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsx
@@ -67,7 +67,7 @@ export function ContextDisplay({
}))
const exceptionEntries = exceptionAttributes
? [
- { key: 'Level', value: exceptionAttributes.level, filterKey: '$level' },
+ { key: 'Level', value: exceptionAttributes.level, filterKey: '$exception_level' },
{ key: 'Synthetic', value: exceptionAttributes.synthetic },
{
key: 'Library',