diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 23493e49..4612721f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -3,8 +3,9 @@ ## v0.3.0 (2021-12-22) - feat: implement transaction mechanism for load test -- feat: support `--continue-on-failure` flag to continue running next step when failure occurs +- feat: support `--continue-on-failure` flag to continue running next step when failure occurs, default to failfast - refactor: fork [boomer] as sub module +- feat: report GA events with version ## v0.2.2 (2021-12-07) diff --git a/internal/boomer/README.md b/internal/boomer/README.md index f2d40771..b6ef5ce2 100644 --- a/internal/boomer/README.md +++ b/internal/boomer/README.md @@ -2,6 +2,4 @@ This module is initially forked from [myzhan/boomer] and made a lot of changes. -- remove distribute runner - [myzhan/boomer]: https://github.com/myzhan/boomer diff --git a/internal/ga/client_test.go b/internal/ga/client_test.go index e0479611..a1e1cae4 100644 --- a/internal/ga/client_test.go +++ b/internal/ga/client_test.go @@ -20,11 +20,11 @@ func TestStructToUrlValues(t *testing.T) { event := EventTracking{ Category: "unittest", Action: "convert", - Label: "StructToUrlValues", + Label: "v0.3.0", Value: "123", } val := structToUrlValues(event) - if val.Encode() != "ea=convert&ec=unittest&el=StructToUrlValues&ev=123" { + if val.Encode() != "ea=convert&ec=unittest&el=v0.3.0&ev=123" { t.Fail() } } diff --git a/internal/ga/events.go b/internal/ga/events.go index 71f62b1c..2044d196 100644 --- a/internal/ga/events.go +++ b/internal/ga/events.go @@ -4,6 +4,8 @@ import ( "fmt" "net/url" "time" + + "github.com/httprunner/hrp/internal/version" ) type IEvent interface { @@ -14,7 +16,7 @@ type EventTracking struct { HitType string `form:"t"` // Event hit type = event Category string `form:"ec"` // Required. Event Category. Action string `form:"ea"` // Required. Event Action. - Label string `form:"el"` // Optional. Event label + Label string `form:"el"` // Optional. Event label, used as version. Value string `form:"ev"` // Optional. Event value, must be digits, "123" } @@ -30,6 +32,7 @@ func (e EventTracking) StartTiming(variable string) UserTimingTracking { func (e EventTracking) ToUrlValues() url.Values { e.HitType = "event" + e.Label = version.VERSION return structToUrlValues(e) } @@ -45,6 +48,7 @@ type UserTimingTracking struct { func (e UserTimingTracking) ToUrlValues() url.Values { e.HitType = "timing" + e.Label = version.VERSION e.Duration = fmt.Sprintf("%d", int64(e.duration.Seconds()*1000)) return structToUrlValues(e) }