forked from airbytehq/airbyte
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🔧 Add Datadog support to webapp, cleanup sentry init (airbytehq#17821)
* Add support for Datadog Real User Monitoring (RUM) * Move sentry init to its own util * loadDatadogRum -> initDatadogRum * Move comment back to app index * Lazy load Sentry and Datadog * Update version value for Datadog to match Sentry * Switch process.env with window for sentry and datadog init * Remove import optimizations from Sentry and Datadog
- Loading branch information
1 parent
0c0fedb
commit c8f973b
Showing
6 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { datadogRum } from "@datadog/browser-rum"; | ||
export const loadDatadog = (): void => { | ||
const applicationId = window.REACT_APP_DATADOG_APPLICATION_ID ?? process.env.REACT_APP_DATADOG_APPLICATION_ID; | ||
if (!applicationId) { | ||
return; | ||
} | ||
|
||
const clientToken = window.REACT_APP_DATADOG_CLIENT_TOKEN ?? process.env.REACT_APP_DATADOG_CLIENT_TOKEN; | ||
const site = window.REACT_APP_DATADOG_SITE ?? process.env.REACT_APP_DATADOG_SITE; | ||
const service = window.REACT_APP_DATADOG_SERVICE ?? process.env.REACT_APP_DATADOG_SERVICE; | ||
const version = window.REACT_APP_WEBAPP_TAG ?? process.env.REACT_APP_WEBAPP_TAG ?? "dev"; | ||
|
||
datadogRum.init({ | ||
applicationId, | ||
clientToken, | ||
site, | ||
service, | ||
version, | ||
sampleRate: 100, | ||
sessionReplaySampleRate: 0, | ||
trackInteractions: false, | ||
trackResources: true, | ||
trackLongTasks: true, | ||
defaultPrivacyLevel: "mask-user-input", | ||
}); | ||
|
||
datadogRum.startSessionReplayRecording(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as Sentry from "@sentry/react"; | ||
import { Integrations } from "@sentry/tracing"; | ||
|
||
export const loadSentry = (): void => { | ||
const dsn = window.REACT_APP_SENTRY_DSN ?? process.env.REACT_APP_SENTRY_DSN; | ||
if (!dsn) { | ||
return; | ||
} | ||
|
||
const release = window.REACT_APP_WEBAPP_TAG ?? process.env.REACT_APP_WEBAPP_TAG ?? "dev"; | ||
const integrations = [new Integrations.BrowserTracing()]; | ||
|
||
Sentry.init({ | ||
dsn, | ||
release, | ||
integrations, | ||
tracesSampleRate: 1.0, | ||
}); | ||
}; |