mirror of
https://github.com/balena-io/etcher.git
synced 2025-08-01 23:47:43 +00:00
Refactor Sentry & Mixpanel properties
Change-type: patch Changelog-entry: Refactor Sentry & Mixpanel properties Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzothunder.ambrosi@gmail.com>
This commit is contained in:
parent
284301a659
commit
a736e69f9d
@ -31,10 +31,18 @@ const configUrl = settings.get('configUrl') || 'https://balena.io/etcher/static/
|
|||||||
|
|
||||||
const DEFAULT_PROBABILITY = 0.1
|
const DEFAULT_PROBABILITY = 0.1
|
||||||
|
|
||||||
const services = {
|
let services = {
|
||||||
sentry: sentryToken,
|
sentry: null,
|
||||||
mixpanel: mixpanelToken
|
mixpanel: null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.get('errorReporting')) {
|
||||||
|
services = {
|
||||||
|
sentry: sentryToken,
|
||||||
|
mixpanel: mixpanelToken
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resinCorvus.install({
|
resinCorvus.install({
|
||||||
services,
|
services,
|
||||||
options: {
|
options: {
|
||||||
@ -42,7 +50,12 @@ resinCorvus.install({
|
|||||||
shouldReport: () => {
|
shouldReport: () => {
|
||||||
return settings.get('errorReporting')
|
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' ], {})
|
const mixpanel = _.get(config, [ 'analytics', 'mixpanel' ], {})
|
||||||
mixpanelSample = mixpanel.probability || DEFAULT_PROBABILITY
|
mixpanelSample = mixpanel.probability || DEFAULT_PROBABILITY
|
||||||
if (isClientEligible(mixpanelSample)) {
|
if (isClientEligible(mixpanelSample)) {
|
||||||
validatedConfig = validateMixpanelConfig(mixpanel)
|
const defaultConfig = {
|
||||||
|
property_blacklist: [
|
||||||
|
'$current_url'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
validatedConfig = _.merge(defaultConfig, validateMixpanelConfig(mixpanel))
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
resinCorvus.logException(err)
|
resinCorvus.logException(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user