fix: report GA event with value to indicate failure

This commit is contained in:
debugtalk
2022-01-08 12:35:54 +08:00
parent e596bddda7
commit 2598691c69
3 changed files with 13 additions and 7 deletions

View File

@@ -35,10 +35,16 @@ func (p *parser) loadPlugin(path string) error {
}
// report event for loading go plugin
go ga.SendEvent(ga.EventTracking{
Category: "LoadGoPlugin",
Action: "plugin.Open",
})
defer func() {
event := ga.EventTracking{
Category: "LoadGoPlugin",
Action: "plugin.Open",
}
if err != nil {
event.Value = 1 // failed
}
go ga.SendEvent(event)
}()
// load plugin
plugins, err := plugin.Open(pluginPath)