-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: adds datadog RUM and logs to website (#8871)
* initial commit. * Updates * RUM config * Adds DD logs config * Moves config to config.toml file, rename vars * Testing logger Signed-off-by: bgdeutsch <bgdeutsch@gmail.com> * Revert logger testing. Signed-off-by: bgdeutsch <bgdeutsch@gmail.com> * Testing JS errors. Signed-off-by: bgdeutsch <bgdeutsch@gmail.com> * Refactor to use hugo for client-side env. Signed-off-by: bgdeutsch <bgdeutsch@gmail.com> * Remove console.log statement. Signed-off-by: bgdeutsch <bgdeutsch@gmail.com> * File should end in a newline. Signed-off-by: bgdeutsch <bgdeutsch@gmail.com>
- Loading branch information
Showing
5 changed files
with
91 additions
and
4 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{ $latest := index site.Data.docs.versions 0 }} | ||
{{ $ddConfig := site.Params.datadog_config }} | ||
{{ $env := hugo.Environment }} | ||
|
||
import { datadogRum } from '@datadog/browser-rum'; | ||
import { datadogLogs } from '@datadog/browser-logs'; | ||
|
||
const env = '{{ $env }}'; | ||
|
||
if (datadogRum) { | ||
if (env === 'preview' || env === 'production') { | ||
datadogRum.init({ | ||
applicationId: '{{ $ddConfig.application_id }}', | ||
clientToken: '{{ $ddConfig.client_token }}', | ||
env, | ||
service: '{{ $ddConfig.service_name }}', | ||
version: '{{ $latest }}', | ||
trackInteractions: true | ||
}); | ||
} | ||
} | ||
|
||
if (datadogLogs) { | ||
if (env === 'preview' || env === 'production') { | ||
datadogLogs.init({ | ||
clientToken: '{{ $ddConfig.client_token }}', | ||
forwardErrorsToLogs: true, | ||
env, | ||
service: '{{ $ddConfig.service_name }}', | ||
version: '{{ $latest }}' | ||
}) | ||
} | ||
} | ||
|
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