mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-16 04:47:38 +08:00
feat: report GA4 events for hrp cmd
This commit is contained in:
@@ -3,6 +3,7 @@ package convert
|
||||
import (
|
||||
_ "embed"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
@@ -138,22 +139,25 @@ func (c *TCaseConverter) loadCase(casePath string, fromType FromType) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *TCaseConverter) Convert(casePath string, fromType FromType, outputType OutputType) error {
|
||||
// report event
|
||||
sdk.SendGA4Event(
|
||||
"hrp_convert",
|
||||
map[string]interface{}{
|
||||
"from": fromType.String(),
|
||||
"to": outputType.String(),
|
||||
},
|
||||
)
|
||||
func (c *TCaseConverter) Convert(casePath string, fromType FromType, outputType OutputType) (err error) {
|
||||
// report GA event
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
sdk.SendGA4Event("hrp_convert", map[string]interface{}{
|
||||
"from": fromType.String(),
|
||||
"to": outputType.String(),
|
||||
"success": err == nil,
|
||||
"engagement_time_msec": time.Since(startTime).Milliseconds(),
|
||||
})
|
||||
}()
|
||||
|
||||
log.Info().Str("path", casePath).
|
||||
Str("fromType", fromType.String()).
|
||||
Str("outputType", outputType.String()).
|
||||
Msg("convert testcase")
|
||||
|
||||
// load source file
|
||||
err := c.loadCase(casePath, fromType)
|
||||
err = c.loadCase(casePath, fromType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user