Telemetry events

* Don't trace event on exit
change 'PowertoyModuleDeleter' to not call 'module->disable();' before 'module->destroy();' so the module can distinguish between being turned off and PowerToys exiting.
Code formatting.

* uppercase for event name

* Trace on/off event for ShortcutGuide module

* Trace the 'hide' event only if the guide was visible
'on_hide()' is invoked when the module is turned off, in that case don't trace the hide event.

* Remove spaces in data field names
Remove 'ShowGuide' event since it's not providing any useful data.

* Include build number in version number
This commit is contained in:
Enrico Giordani
2019-10-22 08:11:23 +02:00
committed by GitHub
parent 5fb59cd64a
commit a07a42624b
11 changed files with 79 additions and 49 deletions

View File

@@ -13,7 +13,6 @@ struct PowertoyModuleDeleter {
void operator()(PowertoyModuleIface* module) const {
if (module) {
powertoys_events().unregister_receiver(module);
module->disable();
module->destroy();
}
}
@@ -26,12 +25,12 @@ struct PowertoyModuleDLLDeleter {
}
};
class PowertoyModule {
public:
PowertoyModule(PowertoyModuleIface* module, HMODULE handle) : handle(handle), module(module) {
if (!module)
if (!module) {
throw std::runtime_error("Module not initialized");
}
name = module->get_name();
auto want_signals = module->get_events();
if (want_signals) {
@@ -40,9 +39,11 @@ public:
}
}
}
const std::wstring& get_name() const {
return name;
}
const std::wstring get_config() const {
std::wstring result;
int size = 0;
@@ -54,30 +55,36 @@ public:
delete[] buffer;
return result;
}
void set_config(const std::wstring& config) {
module->set_config(config.c_str());
}
void call_custom_action(const std::wstring& action) {
module->call_custom_action(action.c_str());
}
intptr_t signal_event(const std::wstring& signal_event, intptr_t data) {
return module->signal_event(signal_event.c_str(), data);
}
bool is_enabled() {
return module->is_enabled();
}
void enable() {
module->enable();
}
void disable() {
module->disable();
}
private:
std::unique_ptr<HMODULE, PowertoyModuleDLLDeleter> handle;
std::unique_ptr<PowertoyModuleIface, PowertoyModuleDeleter> module;
std::wstring name;
};
PowertoyModule load_powertoy(const std::wstring& filename);
std::unordered_map<std::wstring, PowertoyModule>& modules();
std::unordered_map<std::wstring, PowertoyModule>& modules();

View File

@@ -20,7 +20,7 @@ void Trace::EventLaunch(const std::wstring& versionNumber) {
TraceLoggingWrite(
g_hProvider,
"Runner::Event::Launch",
TraceLoggingWideString(versionNumber.c_str(), "version"),
TraceLoggingWideString(versionNumber.c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));