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(errors): Better define schema, align with python #1460

Merged
merged 10 commits into from
Oct 15, 2024
Merged

Conversation

neilkakkar
Copy link
Collaborator

@neilkakkar neilkakkar commented Oct 10, 2024

Changes

not json stringifying the stack, and aligning schema closer to sentry's / pythons, which should make inputting into cymbal easier as well (Olly lmk if this works well)
...

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Copy link

vercel bot commented Oct 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Oct 14, 2024 2:48pm

@posthog-bot
Copy link
Collaborator

Hey @neilkakkar! 👋
This pull request seems to contain no description. Please add useful context, rationale, and/or any other information that will help make sense of this change now and in the distant Mars-based future.

Copy link

github-actions bot commented Oct 10, 2024

Size Change: +3.15 kB (+0.11%)

Total Size: 2.82 MB

Filename Size Change
dist/all-external-dependencies.js 191 kB +453 B (+0.24%)
dist/array.full.js 354 kB +503 B (+0.14%)
dist/array.full.no-external.js 353 kB +503 B (+0.14%)
dist/array.js 168 kB +50 B (+0.03%)
dist/array.no-external.js 167 kB +50 B (+0.03%)
dist/exception-autocapture.js 11 kB +432 B (+4.1%)
dist/main.js 169 kB +50 B (+0.03%)
dist/module.full.js 354 kB +503 B (+0.14%)
dist/module.full.no-external.js 353 kB +503 B (+0.14%)
dist/module.js 168 kB +50 B (+0.03%)
dist/module.no-external.js 167 kB +50 B (+0.03%)
ℹ️ View Unchanged
Filename Size
dist/external-scripts-loader.js 2.35 kB
dist/recorder-v2.js 111 kB
dist/recorder.js 111 kB
dist/surveys-preview.js 59.8 kB
dist/surveys.js 66 kB
dist/tracing-headers.js 8.36 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

Comment on lines 16 to 30
export interface ErrorProperties {
$exception_type: string
$exception_message: string
$exception_level: SeverityLevel
$exception_list?: Exception[]
// $exception_source?: string
// $exception_lineno?: number
// $exception_colno?: number
$exception_DOMException_code?: string
$exception_is_synthetic?: boolean
// $exception_stack_trace_raw?: string
$exception_handled?: boolean
$exception_personURL?: string
$exception_language?: string
}
Copy link
Contributor

Choose a reason for hiding this comment

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

One for the future but would be cool to have a shared schema similar to what we have for TS <-> Python we have for queries

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will rm the commented out stuff 👀

Comment on lines -185 to -186
...(lineno ? { $exception_lineno: lineno } : {}),
...(colno ? { $exception_colno: colno } : {}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove these from the other places they're referenced in a follow up PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

they aren't referenced anywhere I think

Copy link
Contributor

Choose a reason for hiding this comment

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

I think they're mentioned in the new Rust service. They're also in the taxonomy descriptions but that's less important because arguably they should stick around there...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

uh oh, that shouldn't be the case, it should use the values from the frame instead 🤔 - let me check again

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh it's optional, all good, need it to stay there to support old versions that might send events 💀 , but yeah we don't need to use this at all imo

@neilkakkar neilkakkar marked this pull request as ready for review October 10, 2024 14:09
@@ -177,13 +224,7 @@ export function errorToProperties([event, source, lineno, colno, error]: ErrorEv
$exception_level: isSeverityLevel(errorProperties.$exception_level)
? errorProperties.$exception_level
: 'error',
...(source
? {
$exception_source: source, // TODO get this from URL if not present
Copy link
Contributor

Choose a reason for hiding this comment

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

I came here to ask if we should get rid of this... ahead of me :)

@neilkakkar
Copy link
Collaborator Author

have changed things a decent amount, now the only top level prop is $exception_list and sometimes $exception_level..

value: error.message,
mechanism: {
handled: true,
synthetic: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be synthetic: true? We don't know for certain if it's just a string

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

captureException only takes an error as a param though, not string 🤔 - and in this case we can't do stack resolution either, so not sure how we'd handle the synthetic case.. error.name would be undefined as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Won't that only apply to people using Typescript? I guess someone could give us a string but I'm not even sure how we'd handle that right now... Let's revisit it once we have a few more examples. This can be the happy path for now 👍

@@ -97,6 +97,7 @@ export function createEventProcessor(
// added manually to avoid any dependency on the lazily loaded content
$exception_message: any
$exception_type: any
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i haven't yet removed $exception_message from the sentry integration, but eventually yes will do.

@neilkakkar neilkakkar added the bump minor Bump minor version when this PR gets merged label Oct 14, 2024
@neilkakkar neilkakkar merged commit 1f30330 into main Oct 15, 2024
13 checks passed
@neilkakkar neilkakkar deleted the schema-define branch October 15, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants