change: replace uuid lib

This commit is contained in:
debugtalk
2022-10-24 00:28:13 +08:00
parent b205e99ffb
commit e3912f219d
4 changed files with 7 additions and 9 deletions

2
go.mod
View File

@@ -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

View File

@@ -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)

View File

@@ -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),
}
}

View File

@@ -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
}