From a736e69f9d38e10fe5a0d05c8bdb6445cbf71f65 Mon Sep 17 00:00:00 2001 From: Lorenzo Alberto Maria Ambrosi Date: Thu, 3 Oct 2019 21:09:42 +0200 Subject: [PATCH] Refactor Sentry & Mixpanel properties Change-type: patch Changelog-entry: Refactor Sentry & Mixpanel properties Signed-off-by: Lorenzo Alberto Maria Ambrosi --- lib/gui/app/modules/analytics.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/gui/app/modules/analytics.js b/lib/gui/app/modules/analytics.js index 40a648f2..0646d6c4 100644 --- a/lib/gui/app/modules/analytics.js +++ b/lib/gui/app/modules/analytics.js @@ -31,10 +31,18 @@ const configUrl = settings.get('configUrl') || 'https://balena.io/etcher/static/ const DEFAULT_PROBABILITY = 0.1 -const services = { - sentry: sentryToken, - mixpanel: mixpanelToken +let services = { + sentry: null, + mixpanel: null } + +if (settings.get('errorReporting')) { + services = { + sentry: sentryToken, + mixpanel: mixpanelToken + } +} + resinCorvus.install({ services, options: { @@ -42,7 +50,12 @@ resinCorvus.install({ shouldReport: () => { return settings.get('errorReporting') }, - mixpanelDeferred: true + mixpanelDeferred: true, + sentryConfig: { + dataCallback: (object) => { + return _.omit(object, [ 'transaction', 'request.url' ]) + } + } } }) @@ -59,7 +72,12 @@ const initConfig = async () => { const mixpanel = _.get(config, [ 'analytics', 'mixpanel' ], {}) mixpanelSample = mixpanel.probability || DEFAULT_PROBABILITY if (isClientEligible(mixpanelSample)) { - validatedConfig = validateMixpanelConfig(mixpanel) + const defaultConfig = { + property_blacklist: [ + '$current_url' + ] + } + validatedConfig = _.merge(defaultConfig, validateMixpanelConfig(mixpanel)) } } catch (err) { resinCorvus.logException(err)