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

feat: lazily load exception autocapture #856

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Oct 24, 2023

It's a while until we're going to be able to work on exception autocapture as events but we ship the code to everyone. No bueno.

Move it to lazy loading so things are there when we're ready to use them. Reduces bundle by c7%

Nit-pickingly this is a breaking change by removing posthog.captureException but we don't see any events logged from that in the last 90 days

@github-actions
Copy link

github-actions bot commented Oct 24, 2023

Size Change: -30.7 kB (-4%)

Total Size: 709 kB

Filename Size Change
dist/array.full.js 170 kB -7.68 kB (-4%)
dist/array.js 111 kB -7.67 kB (-6%)
dist/es.js 111 kB -7.67 kB (-6%)
dist/module.js 111 kB -7.67 kB (-6%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 12 kB
dist/recorder-v2.js 95.1 kB
dist/recorder.js 58.4 kB
dist/surveys.js 39.7 kB

compressed-size-action

Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

I think this works, but one thing wasn't clear to me

import { PostHog } from '../../posthog-core'
import { DecideResponse, Properties } from '../../types'
import { ErrorEventArgs, ErrorProperties, errorToProperties, unhandledRejectionToProperties } from './error-conversion'
import { isPrimitive } from './type-checking'

const EXCEPTION_INGESTION_ENDPOINT = '/e/'

export const extendPostHog = (instance: PostHog, response: DecideResponse) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The place I could see this being called, the decide response isn't passed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good eyes!

@pauldambra pauldambra marked this pull request as ready for review October 25, 2023 08:01
@pauldambra pauldambra merged commit 8fdd3e1 into master Oct 26, 2023
13 checks passed
@pauldambra pauldambra deleted the feat/lazily-load-exceptions branch October 26, 2023 08:12
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