diff --git a/go.mod b/go.mod index fc8e3a47..df99d58c 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/go-openapi/spec v0.20.7 github.com/go-ping/ping v1.1.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 - github.com/google/uuid v1.3.0 github.com/gorilla/websocket v1.5.0 github.com/httprunner/funplugin v0.5.0 github.com/jinzhu/copier v0.3.5 @@ -49,6 +48,7 @@ require ( github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/swag v0.22.3 // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/go-hclog v1.3.0 // indirect github.com/hashicorp/go-plugin v1.4.5 // indirect github.com/hashicorp/yamux v0.1.1 // indirect diff --git a/hrp/internal/sdk/init.go b/hrp/internal/sdk/init.go index ddb12087..24fa7ae6 100644 --- a/hrp/internal/sdk/init.go +++ b/hrp/internal/sdk/init.go @@ -5,8 +5,8 @@ import ( "github.com/denisbrodbeck/machineid" "github.com/getsentry/sentry-go" - "github.com/google/uuid" "github.com/rs/zerolog/log" + uuid "github.com/satori/go.uuid" "github.com/httprunner/httprunner/v4/hrp/internal/env" "github.com/httprunner/httprunner/v4/hrp/internal/version" @@ -23,8 +23,7 @@ func init() { // init GA client clientID, err := machineid.ProtectedID("hrp") if err != nil { - nodeUUID, _ := uuid.NewUUID() - clientID = nodeUUID.String() + clientID = uuid.NewV1().String() } gaClient = NewGAClient(trackingID, clientID) diff --git a/hrp/pkg/boomer/output.go b/hrp/pkg/boomer/output.go index 2d64ee0e..0a3b7de3 100644 --- a/hrp/pkg/boomer/output.go +++ b/hrp/pkg/boomer/output.go @@ -9,12 +9,12 @@ import ( "sync" "time" - "github.com/google/uuid" "github.com/olekukonko/tablewriter" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/push" "github.com/rs/zerolog/log" + uuid "github.com/satori/go.uuid" "github.com/httprunner/httprunner/v4/hrp/internal/json" ) @@ -461,10 +461,9 @@ var ( // NewPrometheusPusherOutput returns a PrometheusPusherOutput. func NewPrometheusPusherOutput(gatewayURL, jobName string, mode string) *PrometheusPusherOutput { - nodeUUID, _ := uuid.NewUUID() return &PrometheusPusherOutput{ pusher: push.New(gatewayURL, jobName). - Grouping("instance", nodeUUID.String()). + Grouping("instance", uuid.NewV1().String()). Grouping("mode", mode), } } diff --git a/hrp/pkg/boomer/utils.go b/hrp/pkg/boomer/utils.go index f10a90d0..99c2bea4 100644 --- a/hrp/pkg/boomer/utils.go +++ b/hrp/pkg/boomer/utils.go @@ -10,8 +10,8 @@ import ( "strings" "time" - "github.com/google/uuid" "github.com/rs/zerolog/log" + uuid "github.com/satori/go.uuid" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/mem" "github.com/shirou/gopsutil/process" @@ -84,7 +84,7 @@ func startCPUProfile(file string, duration time.Duration) (err error) { // generate a random nodeID like locust does, using the same algorithm. func getNodeID() (nodeID string) { hostname, _ := os.Hostname() - id := strings.Replace(uuid.New().String(), "-", "", -1) + id := strings.Replace(uuid.NewV4().String(), "-", "", -1) nodeID = fmt.Sprintf("%s_%s", hostname, id) return }