mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 13:47:54 +00:00
Revert "Add a controlling variable for mixpanel reporting"
This reverts commit 1a7ed0f95b
.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
24f5c7f7c7
commit
9c486275c9
@ -166,10 +166,6 @@ export const schemaTypes = {
|
||||
type: PermissiveBoolean,
|
||||
default: false,
|
||||
},
|
||||
mixpanelReport: {
|
||||
type: PermissiveBoolean,
|
||||
default: true,
|
||||
},
|
||||
|
||||
// Function schema types
|
||||
// The type should be the value that the promise resolves
|
||||
|
@ -190,11 +190,6 @@ export const schema = {
|
||||
mutable: true,
|
||||
removeIfNull: false,
|
||||
},
|
||||
mixpanelReport: {
|
||||
source: 'db',
|
||||
mutable: true,
|
||||
removeIfNull: false,
|
||||
},
|
||||
};
|
||||
|
||||
export type Schema = typeof schema;
|
||||
|
@ -129,11 +129,6 @@ export class DeviceConfig {
|
||||
defaultValue: 'false',
|
||||
rebootRequired: true,
|
||||
},
|
||||
mixpanelReport: {
|
||||
envVarName: 'SUPERVISOR_MIXPANEL_REPORT',
|
||||
varType: 'bool',
|
||||
defaultValue: 'true',
|
||||
},
|
||||
};
|
||||
|
||||
public static validKeys = [
|
||||
|
@ -1,10 +1,10 @@
|
||||
import * as Bluebird from 'bluebird';
|
||||
import mask = require('json-mask');
|
||||
import * as _ from 'lodash';
|
||||
import * as memoizee from 'memoizee';
|
||||
|
||||
import Mixpanel = require('mixpanel');
|
||||
|
||||
import Config from './config';
|
||||
import log from './lib/supervisor-console';
|
||||
import supervisorVersion = require('./lib/supervisor-version');
|
||||
|
||||
@ -15,7 +15,6 @@ interface InitArgs {
|
||||
unmanaged: boolean;
|
||||
mixpanelHost: { host: string; path: string } | null;
|
||||
mixpanelToken: string;
|
||||
config: Config;
|
||||
}
|
||||
|
||||
// The minimum amount of time to wait between sending
|
||||
@ -36,43 +35,31 @@ const mixpanelMask = [
|
||||
export class EventTracker {
|
||||
private defaultProperties: EventTrackProperties | null;
|
||||
private client: any;
|
||||
private isEnabled: boolean = true;
|
||||
|
||||
public constructor() {
|
||||
this.client = null;
|
||||
this.defaultProperties = null;
|
||||
}
|
||||
|
||||
public async init({
|
||||
public init({
|
||||
unmanaged,
|
||||
mixpanelHost,
|
||||
mixpanelToken,
|
||||
uuid,
|
||||
config,
|
||||
}: InitArgs): Promise<void> {
|
||||
this.defaultProperties = {
|
||||
distinct_id: uuid,
|
||||
uuid,
|
||||
supervisorVersion,
|
||||
};
|
||||
if (unmanaged || mixpanelHost == null) {
|
||||
return;
|
||||
}
|
||||
this.client = Mixpanel.init(mixpanelToken, {
|
||||
host: mixpanelHost.host,
|
||||
path: mixpanelHost.path,
|
||||
});
|
||||
|
||||
this.isEnabled = await config.get('mixpanelReport');
|
||||
log.info(
|
||||
`Mixpanel reporting is ${this.isEnabled ? 'enabled' : 'disabled'}`,
|
||||
);
|
||||
config.on('change', conf => {
|
||||
const mixpanelReport = conf.mixpanelReport;
|
||||
if (mixpanelReport != null && mixpanelReport !== this.isEnabled) {
|
||||
this.isEnabled = mixpanelReport;
|
||||
log.info(`${mixpanelReport ? 'A' : 'Dea'}ctivating mixpanel reporting`);
|
||||
}: InitArgs): Bluebird<void> {
|
||||
return Bluebird.try(() => {
|
||||
this.defaultProperties = {
|
||||
distinct_id: uuid,
|
||||
uuid,
|
||||
supervisorVersion,
|
||||
};
|
||||
if (unmanaged || mixpanelHost == null) {
|
||||
return;
|
||||
}
|
||||
this.client = Mixpanel.init(mixpanelToken, {
|
||||
host: mixpanelHost.host,
|
||||
path: mixpanelHost.path,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -93,7 +80,7 @@ export class EventTracker {
|
||||
// Don't send potentially sensitive information, by using a whitelist
|
||||
properties = mask(properties, mixpanelMask);
|
||||
this.logEvent('Event:', event, JSON.stringify(properties));
|
||||
if (this.client == null || !this.isEnabled) {
|
||||
if (this.client == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
_ = require 'lodash'
|
||||
|
||||
EventEmitter = require 'events'
|
||||
|
||||
{ EventTracker } = require './event-tracker'
|
||||
@ -72,7 +70,7 @@ module.exports = class Supervisor extends EventEmitter
|
||||
# so we leave a trail of breadcrumbs in the logs in case runtime
|
||||
# fails to get to the first dashboard logs
|
||||
log.debug('Starting event tracker')
|
||||
@eventTracker.init(_.assign({}, conf, { @config }))
|
||||
@eventTracker.init(conf)
|
||||
.then =>
|
||||
log.debug('Starting up api binder')
|
||||
@apiBinder.initClient()
|
||||
|
@ -45,7 +45,6 @@ testTarget1 = {
|
||||
'SUPERVISOR_LOCAL_MODE': 'false'
|
||||
'SUPERVISOR_LOG_CONTROL': 'true'
|
||||
'SUPERVISOR_OVERRIDE_LOCK': 'false'
|
||||
'SUPERVISOR_MIXPANEL_REPORT': 'true'
|
||||
'SUPERVISOR_POLL_INTERVAL': '60000'
|
||||
'SUPERVISOR_VPN_CONTROL': 'true'
|
||||
'SUPERVISOR_PERSISTENT_LOGGING': 'false'
|
||||
@ -131,7 +130,6 @@ testTargetWithDefaults2 = {
|
||||
'SUPERVISOR_OVERRIDE_LOCK': 'false'
|
||||
'SUPERVISOR_POLL_INTERVAL': '60000'
|
||||
'SUPERVISOR_VPN_CONTROL': 'true'
|
||||
'SUPERVISOR_MIXPANEL_REPORT': 'true'
|
||||
'SUPERVISOR_PERSISTENT_LOGGING': 'false'
|
||||
}
|
||||
apps: {
|
||||
|
@ -42,9 +42,6 @@ describe 'EventTracker', ->
|
||||
mixpanelToken: 'someToken'
|
||||
uuid: 'barbaz'
|
||||
mixpanelHost: { host: '', path: '' }
|
||||
config:
|
||||
get: -> Promise.resolve(true)
|
||||
on: ->
|
||||
})
|
||||
expect(promise).to.be.fulfilled
|
||||
.then =>
|
||||
|
@ -177,7 +177,6 @@ describe 'DeviceConfig', ->
|
||||
SUPERVISOR_DELTA_APPLY_TIMEOUT: '0',
|
||||
SUPERVISOR_DELTA_RETRY_COUNT: '30',
|
||||
SUPERVISOR_DELTA_RETRY_INTERVAL: '10000',
|
||||
SUPERVISOR_MIXPANEL_REPORT: 'true'
|
||||
SUPERVISOR_DELTA_VERSION: '2',
|
||||
SUPERVISOR_INSTANT_UPDATE_TRIGGER: 'true',
|
||||
SUPERVISOR_OVERRIDE_LOCK: 'false',
|
||||
|
Loading…
Reference in New Issue
Block a user