Skip to content
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: add beforeSend to RUM init #33

Merged
merged 2 commits into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/DatadogLoggingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ class DatadogLoggingService extends NewRelicLoggingService {
this.initialize();
}

// to read more about the use cases for beforeSend, refer to the documentation:
// https://docs.datadoghq.com/real_user_monitoring/guide/enrich-and-control-rum-data/?tab=event#event-and-context-structure
// (e.g., discarding frontend errors matching the optional `IGNORED_ERROR_REGEX` configuration,
// currently implemented in `logError` below).
beforeSend() {
// common/shared logic across all MFEs
return true;
}

initialize() {
const requiredDatadogConfig = [
process.env.DATADOG_APPLICATION_ID,
Expand All @@ -42,6 +51,7 @@ class DatadogLoggingService extends NewRelicLoggingService {
const datadogVersion = process.env.DATADOG_VERSION || process.env.APP_VERSION || '1.0.0';
datadogRum.init({
applicationId: process.env.DATADOG_APPLICATION_ID,
beforeSend: this.beforeSend,
clientToken: process.env.DATADOG_CLIENT_TOKEN,
site: process.env.DATADOG_SITE || '',
service: process.env.DATADOG_SERVICE || '',
Expand Down
Loading