refactor: replace GA with GA4

This commit is contained in:
lilong.129
2023-07-20 23:29:49 +08:00
parent 503b3fd38f
commit 17b6d95b3b
8 changed files with 48 additions and 51 deletions
+7 -10
View File
@@ -93,17 +93,14 @@ func (b *HRPBoomer) SetPython3Venv(venv string) *HRPBoomer {
// Run starts to run load test for one or multiple testcases.
func (b *HRPBoomer) Run(testcases ...ITestCase) {
event := sdk.EventTracking{
Category: "RunLoadTests",
Action: "hrp boom",
}
// report start event
go sdk.SendEvent(event)
// report execution timing event
defer sdk.SendEvent(event.StartTiming("execution"))
// quit all plugins
startTime := time.Now()
defer func() {
// report boom event
sdk.SendGA4Event("hrp_boom", map[string]interface{}{
"engagement_time_msec": time.Since(startTime).Milliseconds(),
})
// quit all plugins
pluginMap.Range(func(key, value interface{}) bool {
if plugin, ok := value.(funplugin.IPlugin); ok {
plugin.Quit()