-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add datadog js monitoring to app js
The `APP_VERSION` needs to be the same for in the javascript initialisation AND the command line tool that uploads the sourcemaps into datadog. Using an evironment var allows us to set the `APP_VERSION` variable in the build process, use it in the command line and pass it into the app js.
- Loading branch information
1 parent
bbd79ab
commit 11293af
Showing
8 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
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,20 @@ | ||
import { datadogLogs } from '@datadog/browser-logs' | ||
|
||
const initDatadog = () => { | ||
const ddEnv = window.location.hostname === 'www.citizensadvice.org.uk' ? "prod" : "dev"; | ||
const appVersion = document.querySelector('meta[name="app-version"]').getAttribute('content'); | ||
|
||
if (ddEnv && appVersion) { | ||
datadogLogs.init({ | ||
clientToken: 'pub32a7538113d7910e4304b8aa13ff4521', | ||
site: 'datadoghq.eu', | ||
forwardErrorsToLogs: true, | ||
sessionSampleRate: 100, | ||
service: 'energy-apps', | ||
env: ddEnv, | ||
version: appVersion | ||
}); | ||
} | ||
} | ||
|
||
export default initDatadog; |
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 @@ | ||
%meta{ name: "app-version", content: ENV.fetch("APP_VERSION", nil) } |
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