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(core): Deprecate hub capture APIs and add them to Scope #10039

Merged
merged 21 commits into from
Jan 8, 2024

Conversation

lforst
Copy link
Member

@lforst lforst commented Jan 3, 2024

Adds replacements for the following hub methods on the scope:

  • hub.captureException -> scope.captureException
  • hub.captureMessage -> scope.captureMessage
  • hub.captureEvent -> scope.captureEvent

We are adding all these methods to the scope class and are proxying the calls on the hub through the scope methods. We do not want to change the global calls (Sentry.capture...()) to call the scope methods directly yet, because we still require the hub logic for lastEventId. The scope methods are implicitly now tested because they are called from the hub/top-level methods.

Changes:

  • Deprecate hub methods
  • Add methods on scope
  • Add unit tests to test scope methods
  • Update JS doc a bit.

Copy link
Contributor

github-actions bot commented Jan 3, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.32 KB (+0.14% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 67.7 KB (+0.16% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61.31 KB (+0.17% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.95 KB (+0.33% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.65 KB (+0.34% 🔺)
@sentry/browser - Webpack (gzipped) 22.03 KB (+0.5% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 73.92 KB (+0.15% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 65.58 KB (+0.16% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 31.76 KB (+0.34% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.69 KB (+0.5% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 206.06 KB (+0.38% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 95.95 KB (+0.81% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 70.79 KB (+1.1% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 34.68 KB (+0.29% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 68.06 KB (+0.15% 🔺)
@sentry/react - Webpack (gzipped) 22.06 KB (+0.48% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 84.8 KB (+0.13% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.14 KB (+0.22% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 16.68 KB (+0.62% 🔺)

@lforst lforst changed the title feat(core): Put capture APIs on the scope feat(core): Deprecate hub capture APIs and add them to Scope Jan 5, 2024
@lforst lforst marked this pull request as ready for review January 5, 2024 15:54
packages/core/src/hub.ts Outdated Show resolved Hide resolved
packages/core/src/hub.ts Outdated Show resolved Hide resolved
packages/core/src/hub.ts Outdated Show resolved Hide resolved
lforst and others added 3 commits January 8, 2024 10:42
Co-authored-by: Francesco Novy <francesco.novy@sentry.io>
Co-authored-by: Francesco Novy <francesco.novy@sentry.io>
Co-authored-by: Francesco Novy <francesco.novy@sentry.io>
@lforst lforst merged commit 2cfb0ef into develop Jan 8, 2024
95 checks passed
@lforst lforst deleted the lforst-put-capture-apis-on-scope branch January 8, 2024 11:08
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