2016-09-08 11:00:23 +03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var config = require('./config.json');
|
2016-10-14 11:36:07 +03:00
|
|
|
var wrapper = require('./lib/appInsightsWrapper.js');
|
|
|
|
var bi = {};
|
2016-09-08 11:00:23 +03:00
|
|
|
|
|
|
|
bi.start = function () {
|
|
|
|
if (!config.instrumentationKey) {
|
2016-09-26 05:49:39 +03:00
|
|
|
console.error('No instrumentation key found. Failed to start az-iot-bi.');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (process.env.TEST) {
|
|
|
|
console.log('process.env.TEST is found. Do not start az-iot-bi for test environment.');
|
2016-09-08 11:00:23 +03:00
|
|
|
return false;
|
|
|
|
}
|
2016-10-14 11:36:07 +03:00
|
|
|
return wrapper.start(config.instrumentationKey);
|
2016-09-08 11:00:23 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
bi.trackEvent = function (eventName, properties) {
|
2016-10-14 11:36:07 +03:00
|
|
|
wrapper.trackEvent(eventName, properties);
|
2016-09-08 11:00:23 +03:00
|
|
|
};
|
|
|
|
|
2017-06-19 11:39:07 +03:00
|
|
|
bi.trackEventWithoutInternalProperties = function (eventName, properties) {
|
|
|
|
wrapper.trackEventWithoutInternalProperties(eventName, properties);
|
|
|
|
};
|
|
|
|
|
2016-09-08 11:00:23 +03:00
|
|
|
bi.flush = function () {
|
2016-10-14 11:36:07 +03:00
|
|
|
wrapper.sendPendingData();
|
2017-06-19 11:39:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
bi.isBIEnabled = function () {
|
|
|
|
return wrapper.isBIEnabled();
|
|
|
|
};
|
2016-09-08 11:00:23 +03:00
|
|
|
|
2017-12-25 10:00:46 +03:00
|
|
|
bi.disableRecordingClientIP = function() {
|
|
|
|
wrapper.disableRecordingClientIP();
|
|
|
|
}
|
|
|
|
|
2016-09-08 11:00:23 +03:00
|
|
|
module.exports = bi;
|