change: do not send GA events in CI environment

This commit is contained in:
debugtalk
2022-04-05 10:31:50 +08:00
parent 7b6aa9213c
commit e7b32b8251
3 changed files with 17 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ func TestSendEvents(t *testing.T) {
Action: "SendEvents",
Value: 123,
}
err := gaClient.SendEvent(event)
err := SendEvent(event)
if err != nil {
t.Fatal(err)
}

View File

@@ -2,6 +2,7 @@ package sdk
import (
"fmt"
"os"
"github.com/denisbrodbeck/machineid"
"github.com/getsentry/sentry-go"
@@ -46,5 +47,9 @@ func init() {
}
func SendEvent(e IEvent) error {
if os.Getenv("CI") == "true" {
// do not send GA events in CI environment
return nil
}
return gaClient.SendEvent(e)
}