-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat: APM Sentry Frontend #14027
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: APM Sentry Frontend #14027
Conversation
Tracing.startTrace(getCurrentHub(), route); | ||
const scope = getCurrentHub().getScope(); | ||
if (scope) { | ||
const transactionSpan = scope.getSpan(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this potentially get a span inside the transaction span?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically yes but, scope.getSpan
always returns the parent span which always should be the transaction.
|
||
flushTransactionTimeout = setTimeout(() => { | ||
Sentry.getCurrentHub().finishSpan(transactionSpan); | ||
}, 5000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be longer? Is it possible to use the unload event to push up incomplete transactions when the tab is closed or moved away via URL bar?
Codecov Report
@@ Coverage Diff @@
## master #14027 +/- ##
==========================================
- Coverage 86.8% 80.48% -6.32%
==========================================
Files 3219 3214 -5
Lines 140347 139935 -412
Branches 4952 4963 +11
==========================================
- Hits 121831 112633 -9198
- Misses 17127 25920 +8793
+ Partials 1389 1382 -7
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #14027 +/- ##
==========================================
- Coverage 86.8% 80.48% -6.32%
==========================================
Files 3219 3214 -5
Lines 140347 139935 -412
Branches 4952 4963 +11
==========================================
- Hits 121831 112633 -9198
- Misses 17127 25920 +8793
+ Partials 1389 1382 -7
Continue to review full report at Codecov.
|
* master: ref(admin): Convert user edit page to react (#14074) ref: Remove unused Group.get_oldest_event and legacy events behavior (#14038) ref(api): Update DELETE users/ to support hard deleting (#14068) test(OrganizationDiscoverSavedQueryDetailTest): Stabilize put test (#14077) meta(readme): Sentry logo should link to sentry.io (#14076) ref: Remove duplicate column (#14073) App platform/update permissions token auth (#14046) feat: Support issue IDs as canonical parameters ref: Change to new traceparent header for Python SDK (#14070) feat: Use option to force-disable transaction events (#14056) feat(apm): Register option to force-disable transaction events (#14055) Feat/mark sentry app installed put route (#14060) ref: Remove unused Group.event_set property (#14036) fix: Filter out groups that are pending deletion/merge from `by_qualified_short_id` (SEN-849) fix(ui): Fix resolve/ignore actions for accounts without multi… (#14058) Fix: Remove extra $.param introduced in GH-14051 (#14061) feat: Use Snuba for Group.from_event_id (#14034) fix(ui) Display implicit default sort and default to descending (#14042) fix(github) Fix 404s not being handled in repository search (#14030) fix: Pass an empty array to $.param instead of an empty string when options.query is falsey (#14051) # Conflicts: # src/sentry/utils/sdk.py
Co-Authored-By: Alberto Leal <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More suggestions 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
I plan to merge this tomorrow 23. July. |
@@ -63,6 +67,21 @@ if (window.__initialData) { | |||
ConfigStore.loadInitialData(window.__initialData); | |||
} | |||
|
|||
// APM ------------------------------------------------------------- | |||
const config = ConfigStore.getConfig(); | |||
// This is just a simple gatekeeper to not enable apm for whole sentry.io at first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we feature flag this instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but this anyway would just report transaction events to our account.
Enabling this for other orgs would just increase the data which we, in the beginning, don't want to.
* master: (25 commits) ref(onboarding): Fix install promprt URL (#14106) fix(app-platform): Allow GET requests for published apps (#14109) feat: Update Group.get_latest_event to use Snuba event (#14039) ref(onboarding): Rename wizardNew -> onboarding (#14104) feat(apm): Update props to address proptype warnings for new transaction attributes (SEN-800) (#14040) ref(ui): Move and codesplit `ProjectPlugins` (#13952) feat(typescript): Add TypeScript compatibility (#13786) ref(templates): Remove unused content block default (#14090) ref(less): Remove unused admin.less (#14097) ref(onobarding): Remove old onboarding experience (#14066) fix(ui) Fix missing conditions in tag bars (#14063) ref(suspect-commits): Add hook (#14057) ref(frontend): Segment frontend web urls (#14096) feat(suspect-commits): Add analytics events (#14080) feat(servicehooks): Update servicehook URLs (#14093) license: Remove license headers (#14095) ref(templates): Remove unused account_nav (#14091) fix: Disable transaction events in store (#14088) fix(InstallWizard): Fix exception when InstallWizard completed (#14092) ref(admin): Fix thrashing on stat charts (#14094) ...
* master: (115 commits) feat: Update to JS SDK 5.6.0-beta.1 + 0.10.2 sentry-python (#14116) fix(apm): Whitelist dev.getsentry.net for local development (#14117) test(datasets): Make Sentry use generic test functions in Snuba (#14111) ref(suspect-commits): Add text changes to empty state (#14121) build: Switch to psycopg2-binary feat(api): Add option to fetch Organization details without Pr… (#13925) ref: Remove EventDetails endpoint (#14107) test(ui): Mock the onboarding learn more video (#14108) tests(acceptance): Add tests for resolving issues in Issues Li… (#14069) feat(ui): Add basic templates for Incident Rules in settings (#14112) feat(eventsv2) Add basic transaction list (#14103) ref(environments) Optimize environment queries (#14102) fix(events-v2) Add additional user attributes to the user column (#14101) fix: Don't start pageload transaction (#14115) feat: APM Sentry Frontend (#14027) ref(onboarding): Fix install promprt URL (#14106) fix(app-platform): Allow GET requests for published apps (#14109) feat: Update Group.get_latest_event to use Snuba event (#14039) ref(onboarding): Rename wizardNew -> onboarding (#14104) feat(apm): Update props to address proptype warnings for new transaction attributes (SEN-800) (#14040) ...
This PR adds frontend APM instrumentation to sentry.io.
It needs the
apm
branch insentry-javascript
this PR getsentry/sentry-javascript#2161The way it works right now is that we decided that we only create transaction events that were trigger from the frontend throughout our entire system.
Meaning the frontend takes the sampling decision, python / our backend doesn't create transaction events on its own.
We create a
op: pageload
transaction event on the initial page load, after 5 sec or on a navigation change, we send the transaction to Sentry.Currently we only instrument requests as individual spans.
After the initial page load, new transaction events with
op: navigation
will be emitted.There is a gatekeeper in there so only logged in users with emails that contain the word
sentry
orlocalhost
installation will enable emitting transaction events for now.