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,
|
type: PermissiveBoolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
mixpanelReport: {
|
|
||||||
type: PermissiveBoolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Function schema types
|
// Function schema types
|
||||||
// The type should be the value that the promise resolves
|
// The type should be the value that the promise resolves
|
||||||
|
@ -190,11 +190,6 @@ export const schema = {
|
|||||||
mutable: true,
|
mutable: true,
|
||||||
removeIfNull: false,
|
removeIfNull: false,
|
||||||
},
|
},
|
||||||
mixpanelReport: {
|
|
||||||
source: 'db',
|
|
||||||
mutable: true,
|
|
||||||
removeIfNull: false,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Schema = typeof schema;
|
export type Schema = typeof schema;
|
||||||
|
@ -129,11 +129,6 @@ export class DeviceConfig {
|
|||||||
defaultValue: 'false',
|
defaultValue: 'false',
|
||||||
rebootRequired: true,
|
rebootRequired: true,
|
||||||
},
|
},
|
||||||
mixpanelReport: {
|
|
||||||
envVarName: 'SUPERVISOR_MIXPANEL_REPORT',
|
|
||||||
varType: 'bool',
|
|
||||||
defaultValue: 'true',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static validKeys = [
|
public static validKeys = [
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
import * as Bluebird from 'bluebird';
|
||||||
import mask = require('json-mask');
|
import mask = require('json-mask');
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as memoizee from 'memoizee';
|
import * as memoizee from 'memoizee';
|
||||||
|
|
||||||
import Mixpanel = require('mixpanel');
|
import Mixpanel = require('mixpanel');
|
||||||
|
|
||||||
import Config from './config';
|
|
||||||
import log from './lib/supervisor-console';
|
import log from './lib/supervisor-console';
|
||||||
import supervisorVersion = require('./lib/supervisor-version');
|
import supervisorVersion = require('./lib/supervisor-version');
|
||||||
|
|
||||||
@ -15,7 +15,6 @@ interface InitArgs {
|
|||||||
unmanaged: boolean;
|
unmanaged: boolean;
|
||||||
mixpanelHost: { host: string; path: string } | null;
|
mixpanelHost: { host: string; path: string } | null;
|
||||||
mixpanelToken: string;
|
mixpanelToken: string;
|
||||||
config: Config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The minimum amount of time to wait between sending
|
// The minimum amount of time to wait between sending
|
||||||
@ -36,43 +35,31 @@ const mixpanelMask = [
|
|||||||
export class EventTracker {
|
export class EventTracker {
|
||||||
private defaultProperties: EventTrackProperties | null;
|
private defaultProperties: EventTrackProperties | null;
|
||||||
private client: any;
|
private client: any;
|
||||||
private isEnabled: boolean = true;
|
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
this.client = null;
|
this.client = null;
|
||||||
this.defaultProperties = null;
|
this.defaultProperties = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init({
|
public init({
|
||||||
unmanaged,
|
unmanaged,
|
||||||
mixpanelHost,
|
mixpanelHost,
|
||||||
mixpanelToken,
|
mixpanelToken,
|
||||||
uuid,
|
uuid,
|
||||||
config,
|
}: InitArgs): Bluebird<void> {
|
||||||
}: InitArgs): Promise<void> {
|
return Bluebird.try(() => {
|
||||||
this.defaultProperties = {
|
this.defaultProperties = {
|
||||||
distinct_id: uuid,
|
distinct_id: uuid,
|
||||||
uuid,
|
uuid,
|
||||||
supervisorVersion,
|
supervisorVersion,
|
||||||
};
|
};
|
||||||
if (unmanaged || mixpanelHost == null) {
|
if (unmanaged || mixpanelHost == null) {
|
||||||
return;
|
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`);
|
|
||||||
}
|
}
|
||||||
|
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
|
// Don't send potentially sensitive information, by using a whitelist
|
||||||
properties = mask(properties, mixpanelMask);
|
properties = mask(properties, mixpanelMask);
|
||||||
this.logEvent('Event:', event, JSON.stringify(properties));
|
this.logEvent('Event:', event, JSON.stringify(properties));
|
||||||
if (this.client == null || !this.isEnabled) {
|
if (this.client == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
_ = require 'lodash'
|
|
||||||
|
|
||||||
EventEmitter = require 'events'
|
EventEmitter = require 'events'
|
||||||
|
|
||||||
{ EventTracker } = require './event-tracker'
|
{ 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
|
# so we leave a trail of breadcrumbs in the logs in case runtime
|
||||||
# fails to get to the first dashboard logs
|
# fails to get to the first dashboard logs
|
||||||
log.debug('Starting event tracker')
|
log.debug('Starting event tracker')
|
||||||
@eventTracker.init(_.assign({}, conf, { @config }))
|
@eventTracker.init(conf)
|
||||||
.then =>
|
.then =>
|
||||||
log.debug('Starting up api binder')
|
log.debug('Starting up api binder')
|
||||||
@apiBinder.initClient()
|
@apiBinder.initClient()
|
||||||
|
@ -45,7 +45,6 @@ testTarget1 = {
|
|||||||
'SUPERVISOR_LOCAL_MODE': 'false'
|
'SUPERVISOR_LOCAL_MODE': 'false'
|
||||||
'SUPERVISOR_LOG_CONTROL': 'true'
|
'SUPERVISOR_LOG_CONTROL': 'true'
|
||||||
'SUPERVISOR_OVERRIDE_LOCK': 'false'
|
'SUPERVISOR_OVERRIDE_LOCK': 'false'
|
||||||
'SUPERVISOR_MIXPANEL_REPORT': 'true'
|
|
||||||
'SUPERVISOR_POLL_INTERVAL': '60000'
|
'SUPERVISOR_POLL_INTERVAL': '60000'
|
||||||
'SUPERVISOR_VPN_CONTROL': 'true'
|
'SUPERVISOR_VPN_CONTROL': 'true'
|
||||||
'SUPERVISOR_PERSISTENT_LOGGING': 'false'
|
'SUPERVISOR_PERSISTENT_LOGGING': 'false'
|
||||||
@ -131,7 +130,6 @@ testTargetWithDefaults2 = {
|
|||||||
'SUPERVISOR_OVERRIDE_LOCK': 'false'
|
'SUPERVISOR_OVERRIDE_LOCK': 'false'
|
||||||
'SUPERVISOR_POLL_INTERVAL': '60000'
|
'SUPERVISOR_POLL_INTERVAL': '60000'
|
||||||
'SUPERVISOR_VPN_CONTROL': 'true'
|
'SUPERVISOR_VPN_CONTROL': 'true'
|
||||||
'SUPERVISOR_MIXPANEL_REPORT': 'true'
|
|
||||||
'SUPERVISOR_PERSISTENT_LOGGING': 'false'
|
'SUPERVISOR_PERSISTENT_LOGGING': 'false'
|
||||||
}
|
}
|
||||||
apps: {
|
apps: {
|
||||||
|
@ -42,9 +42,6 @@ describe 'EventTracker', ->
|
|||||||
mixpanelToken: 'someToken'
|
mixpanelToken: 'someToken'
|
||||||
uuid: 'barbaz'
|
uuid: 'barbaz'
|
||||||
mixpanelHost: { host: '', path: '' }
|
mixpanelHost: { host: '', path: '' }
|
||||||
config:
|
|
||||||
get: -> Promise.resolve(true)
|
|
||||||
on: ->
|
|
||||||
})
|
})
|
||||||
expect(promise).to.be.fulfilled
|
expect(promise).to.be.fulfilled
|
||||||
.then =>
|
.then =>
|
||||||
|
@ -177,7 +177,6 @@ describe 'DeviceConfig', ->
|
|||||||
SUPERVISOR_DELTA_APPLY_TIMEOUT: '0',
|
SUPERVISOR_DELTA_APPLY_TIMEOUT: '0',
|
||||||
SUPERVISOR_DELTA_RETRY_COUNT: '30',
|
SUPERVISOR_DELTA_RETRY_COUNT: '30',
|
||||||
SUPERVISOR_DELTA_RETRY_INTERVAL: '10000',
|
SUPERVISOR_DELTA_RETRY_INTERVAL: '10000',
|
||||||
SUPERVISOR_MIXPANEL_REPORT: 'true'
|
|
||||||
SUPERVISOR_DELTA_VERSION: '2',
|
SUPERVISOR_DELTA_VERSION: '2',
|
||||||
SUPERVISOR_INSTANT_UPDATE_TRIGGER: 'true',
|
SUPERVISOR_INSTANT_UPDATE_TRIGGER: 'true',
|
||||||
SUPERVISOR_OVERRIDE_LOCK: 'false',
|
SUPERVISOR_OVERRIDE_LOCK: 'false',
|
||||||
|
Loading…
Reference in New Issue
Block a user