-
Notifications
You must be signed in to change notification settings - Fork 4k
fix(telemetry): configure Sentry build as dist #97700
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| type AppVersion = { | ||
| buildNumber?: string; | ||
| semanticVersion: string; | ||
| }; | ||
|
|
||
| function getAppVersion(version: string): AppVersion { | ||
| const [semanticVersion, buildNumber] = version.split('-'); | ||
|
|
||
| return {semanticVersion, buildNumber}; | ||
| } | ||
|
|
||
| export default getAppVersion; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import {isDevelopment} from '@libs/Environment/Environment'; | ||
| import {breadcrumbsIntegration, browserProfilingIntegration, consoleIntegration, navigationIntegration, reportingObserverIntegration, tracingIntegration} from '@libs/telemetry/integrations'; | ||
| import {processBeforeSendLogs, processBeforeSendTransactions} from '@libs/telemetry/middlewares'; | ||
| import getAppVersion from '@libs/VersionUtils'; | ||
|
|
||
| import CONFIG from '@src/CONFIG'; | ||
| import CONST from '@src/CONST'; | ||
|
|
@@ -11,6 +12,7 @@ import pkg from '../../../package.json'; | |
| import makeDebugTransport from './debugTransport'; | ||
|
|
||
| function setupSentry(): void { | ||
| const {semanticVersion, buildNumber} = getAppVersion(pkg.version); | ||
| const integrations = [navigationIntegration, tracingIntegration, browserProfilingIntegration, breadcrumbsIntegration, consoleIntegration, reportingObserverIntegration].filter( | ||
| (integration): integration is NonNullable<typeof integration> => integration !== undefined, | ||
| ); | ||
|
|
@@ -27,7 +29,8 @@ function setupSentry(): void { | |
| enableUserInteractionTracing: true, | ||
| integrations, | ||
| environment: CONFIG.ENVIRONMENT, | ||
| release: `${pkg.name}@${pkg.version}`, | ||
| release: `${pkg.name}@${semanticVersion}`, | ||
| dist: buildNumber, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On Android and iOS builds, the SDK is initialized before JavaScript and Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Once events use this release/dist split, Useful? React with 👍 / 👎. |
||
| // UPDATE_REQUIRED is not a real error and makes our errors in Spotnana spike and get rate limited when we bump the app min version, so ignore it | ||
| ignoreErrors: [CONST.ERROR.UPDATE_REQUIRED], | ||
| beforeSendTransaction: processBeforeSendTransactions, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import getAppVersion from '@libs/VersionUtils'; | ||
|
|
||
| describe('getAppVersion', () => { | ||
| it('should split the semantic version from the build number', () => { | ||
| expect(getAppVersion('9.4.48-2')).toStrictEqual({semanticVersion: '9.4.48', buildNumber: '2'}); | ||
| }); | ||
|
|
||
| it('should support versions without a build number', () => { | ||
| expect(getAppVersion('9.4.48')).toStrictEqual({semanticVersion: '9.4.48', buildNumber: undefined}); | ||
| }); | ||
| }); |
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.
For production or staging web builds with a build suffix such as
9.4.48-2, events now use releasenew.expensify@9.4.48with dist2, whileconfig/rsbuild/rsbuild.common.tslines 547-550 still creates the Sentry release and associates commits undernew.expensify@9.4.48-2. Because these are distinct Sentry release identifiers, the release receiving events loses the uploaded release metadata and commit association; update the webpack plugin's release name/dist in the same change.Useful? React with 👍 / 👎.