Merge pull request #10843 from birarda/bug/user-activities-interface-only

disable user activity logger in DS/AC/ac-client
This commit is contained in:
Clément Brisset 2017-07-06 14:01:49 -07:00 committed by GitHub
commit 34e3f56002
6 changed files with 66 additions and 54 deletions

View file

@ -17,8 +17,8 @@
#include <QtCore/QThread> #include <QtCore/QThread>
#include <LogHandler.h> #include <LogHandler.h>
#include <SharedUtil.h>
#include <HifiConfigVariantMap.h> #include <HifiConfigVariantMap.h>
#include <SharedUtil.h>
#include <ShutdownEventListener.h> #include <ShutdownEventListener.h>
#include "Assignment.h" #include "Assignment.h"

View file

@ -40,11 +40,11 @@
#include <LogHandler.h> #include <LogHandler.h>
#include <PathUtils.h> #include <PathUtils.h>
#include <NumericalConstants.h> #include <NumericalConstants.h>
#include <Trace.h>
#include <StatTracker.h>
#include "DomainServerNodeData.h" #include "DomainServerNodeData.h"
#include "NodeConnectionData.h" #include "NodeConnectionData.h"
#include <Trace.h>
#include <StatTracker.h>
int const DomainServer::EXIT_CODE_REBOOT = 234923; int const DomainServer::EXIT_CODE_REBOOT = 234923;

View file

@ -952,7 +952,18 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Make sure we don't time out during slow operations at startup // Make sure we don't time out during slow operations at startup
updateHeartbeat(); updateHeartbeat();
Setting::Handle<bool> firstRun { Settings::firstRun, true };
// once the settings have been loaded, check if we need to flip the default for UserActivityLogger
auto& userActivityLogger = UserActivityLogger::getInstance();
if (!userActivityLogger.isDisabledSettingSet()) {
// the user activity logger is opt-out for Interface
// but it's defaulted to disabled for other targets
// so we need to enable it here if it has never been disabled by the user
userActivityLogger.disable(false);
}
if (userActivityLogger.isEnabled()) {
// sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value.
// The value will be 0 if the user blew away settings this session, which is both a feature and a bug. // The value will be 0 if the user blew away settings this session, which is both a feature and a bug.
static const QString TESTER = "HIFI_TESTER"; static const QString TESTER = "HIFI_TESTER";
@ -996,14 +1007,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
properties["processor_l3_cache_count"] = procInfo.numProcessorCachesL3; properties["processor_l3_cache_count"] = procInfo.numProcessorCachesL3;
} }
// add firstRun flag from settings to launch event
Setting::Handle<bool> firstRun { Settings::firstRun, true };
properties["first_run"] = firstRun.get(); properties["first_run"] = firstRun.get();
// add the user's machine ID to the launch event // add the user's machine ID to the launch event
properties["machine_fingerprint"] = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint()); properties["machine_fingerprint"] = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint());
UserActivityLogger::getInstance().logAction("launch", properties); userActivityLogger.logAction("launch", properties);
}
// Tell our entity edit sender about our known jurisdictions // Tell our entity edit sender about our known jurisdictions
_entityEditSender.setServerJurisdictions(&_entityServerJurisdictions); _entityEditSender.setServerJurisdictions(&_entityServerJurisdictions);

View file

@ -33,6 +33,7 @@ public:
public slots: public slots:
bool isEnabled() { return !_disabled.get(); } bool isEnabled() { return !_disabled.get(); }
bool isDisabledSettingSet() const { return _disabled.isSet(); }
void disable(bool disable); void disable(bool disable);
void logAction(QString action, QJsonObject details = QJsonObject(), JSONCallbackParameters params = JSONCallbackParameters()); void logAction(QString action, QJsonObject details = QJsonObject(), JSONCallbackParameters params = JSONCallbackParameters());
@ -53,7 +54,7 @@ private slots:
private: private:
UserActivityLogger(); UserActivityLogger();
Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", false }; Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", true };
QElapsedTimer _timer; QElapsedTimer _timer;
}; };

View file

@ -107,6 +107,7 @@ namespace Setting {
} }
bool isSet() const { bool isSet() const {
maybeInit();
return _isSet; return _isSet;
} }

View file

@ -42,7 +42,6 @@ ACClientApp::ACClientApp(int argc, char* argv[]) :
const QCommandLineOption listenPortOption("listenPort", "listen port", QString::number(INVALID_PORT)); const QCommandLineOption listenPortOption("listenPort", "listen port", QString::number(INVALID_PORT));
parser.addOption(listenPortOption); parser.addOption(listenPortOption);
if (!parser.parse(QCoreApplication::arguments())) { if (!parser.parse(QCoreApplication::arguments())) {
qCritical() << parser.errorText() << endl; qCritical() << parser.errorText() << endl;
parser.showHelp(); parser.showHelp();
@ -67,6 +66,7 @@ ACClientApp::ACClientApp(int argc, char* argv[]) :
const_cast<QLoggingCategory*>(&shared())->setEnabled(QtWarningMsg, false); const_cast<QLoggingCategory*>(&shared())->setEnabled(QtWarningMsg, false);
} }
QString domainServerAddress = "127.0.0.1:40103"; QString domainServerAddress = "127.0.0.1:40103";
if (parser.isSet(domainAddressOption)) { if (parser.isSet(domainAddressOption)) {
domainServerAddress = parser.value(domainAddressOption); domainServerAddress = parser.value(domainAddressOption);