mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-28 03:40:13 +08:00
feat: report GA4 events for hrp cmd
This commit is contained in:
@@ -2,12 +2,9 @@ package pytest
|
||||
|
||||
import (
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/myexec"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||
)
|
||||
|
||||
func RunPytest(args []string) error {
|
||||
sdk.SendGA4Event("hrp_pytest", nil)
|
||||
|
||||
args = append([]string{"run"}, args...)
|
||||
return myexec.ExecPython3Command("httprunner", args...)
|
||||
}
|
||||
|
||||
@@ -54,8 +54,15 @@ func CopyFile(templateFile, targetFile string) error {
|
||||
}
|
||||
|
||||
func CreateScaffold(projectName string, pluginType PluginType, venv string, force bool) error {
|
||||
// report event
|
||||
sdk.SendGA4Event("hrp_startproject", nil)
|
||||
// report GA event
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
sdk.SendGA4Event("hrp_startproject", map[string]interface{}{
|
||||
"pluginType": string(pluginType),
|
||||
"force": force,
|
||||
"engagement_time_msec": time.Since(startTime).Milliseconds(),
|
||||
})
|
||||
}()
|
||||
|
||||
log.Info().
|
||||
Str("projectName", projectName).
|
||||
|
||||
@@ -41,7 +41,7 @@ func init() {
|
||||
}
|
||||
|
||||
// init GA4 client
|
||||
ga4Client = NewGA4Client(ga4MeasurementID, ga4APISecret)
|
||||
ga4Client = NewGA4Client(ga4MeasurementID, ga4APISecret, false)
|
||||
}
|
||||
|
||||
type GA4Client struct {
|
||||
|
||||
@@ -4,11 +4,9 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/myexec"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/sdk"
|
||||
)
|
||||
|
||||
func OpenWiki() error {
|
||||
sdk.SendGA4Event("hrp_wiki", nil)
|
||||
log.Info().Msgf("%s https://httprunner.com", openCmd)
|
||||
return myexec.RunCommand(openCmd, "https://httprunner.com")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user