This commit is contained in:
Igor Gov 2021-07-20 16:51:52 +03:00
parent 3be0c9ecd9
commit 1e66ebd8b3
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,11 @@
package main
import "github.com/up9inc/mizu/cli/cmd"
import (
"fmt"
"github.com/up9inc/mizu/cli/cmd"
)
func main() {
fmt.Println("Running mizu...")
cmd.Execute()
}

View File

@ -8,12 +8,13 @@ import (
"net/http"
)
var TELEMETRY_URL = "https://us-east4-up9-prod.cloudfunctions.net/mizu-telemetry"
func ReportRun(cmd string, args interface{}) {
if Branch != "main" {
rlog.Debugf("reporting only on main branch")
return
}
url := "https://us-east4-up9-prod.cloudfunctions.net/mizu-telemetry"
argsBytes, _ := json.Marshal(args)
argsMap := map[string]string{"telemetry_type": "mizu_execution", "cmd": cmd, "args": string(argsBytes), "component": "mizu_cli"}
@ -21,7 +22,7 @@ func ReportRun(cmd string, args interface{}) {
jsonValue, _ := json.Marshal(argsMap)
if resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonValue)); err != nil {
if resp, err := http.Post(TELEMETRY_URL, "application/json", bytes.NewBuffer(jsonValue)); err != nil {
rlog.Debugf("error sending telemtry err: %v, response %v", err, resp)
} else {
rlog.Debugf("Successfully reported telemetry")