Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace satori/uuid with its well-maintained fork #1372

Merged
merged 4 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .enterprise-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9292ffbffb475a041c58a6c4a41a27f2019c5aa4
31f9fc66b61896da773267610a85bd95afe405e7
6 changes: 3 additions & 3 deletions event-schema/event_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import (
"sync"
"time"

uuid "github.com/gofrs/uuid"
"github.com/jeremywohl/flatten"
"github.com/lib/pq"
uuid "github.com/satori/go.uuid"

"github.com/rudderlabs/rudder-server/config"
"github.com/rudderlabs/rudder-server/jobsdb"
Expand Down Expand Up @@ -450,7 +450,7 @@ func (manager *EventSchemaManagerT) handleEvent(writeKey string, event EventT) {
}

func (manager *EventSchemaManagerT) createModel(writeKey string, eventType string, eventIdentifier string, eventModel *EventModelT, totalEventModels int, archiveOldestLastSeenModel func()) *EventModelT {
eventModelID := uuid.NewV4().String()
eventModelID := uuid.Must(uuid.NewV4()).String()
eventModel = &EventModelT{
UUID: eventModelID,
WriteKey: writeKey,
Expand All @@ -470,7 +470,7 @@ func (manager *EventSchemaManagerT) createModel(writeKey string, eventType strin
}

func (manager *EventSchemaManagerT) createSchema(schema map[string]string, schemaHash string, eventModel *EventModelT, totalSchemaVersions int, archiveOldestLastSeenVersion func()) *SchemaVersionT {
versionID := uuid.NewV4().String()
versionID := uuid.Must(uuid.NewV4()).String()
schemaVersion := manager.NewSchemaVersion(versionID, schema, schemaHash, eventModel.UUID)
eventModel.mergeSchema(schemaVersion)

Expand Down
10 changes: 5 additions & 5 deletions event-schema/event_schema_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"fmt"
"net/http"

uuid "github.com/gofrs/uuid"
"github.com/gorilla/mux"
"github.com/rudderlabs/rudder-server/gateway/response"
uuid "github.com/satori/go.uuid"
)

func handleBasicAuth(r *http.Request) error {
Expand Down Expand Up @@ -105,14 +105,14 @@ func (manager *EventSchemaManagerT) GetKeyCounts(w http.ResponseWriter, r *http.

keyCounts, err := manager.getKeyCounts(eventID)
if err != nil {
logID := uuid.NewV4().String()
logID := uuid.Must(uuid.NewV4()).String()
pkgLogger.Errorf("logID : %s, err: %s", logID, err.Error())
http.Error(w, response.MakeResponse(fmt.Sprintf("Internal Error: An error has been logged with logID : %s", logID)), 500)
return
}
keyCountsJSON, err := json.Marshal(keyCounts)
if err != nil {
logID := uuid.NewV4().String()
logID := uuid.Must(uuid.NewV4()).String()
pkgLogger.Errorf("logID : %s, err: %s", logID, err.Error())
http.Error(w, response.MakeResponse(fmt.Sprintf("Interna Error: An error has been logged with logID : %s", logID)), 500)
return
Expand Down Expand Up @@ -248,15 +248,15 @@ func (manager *EventSchemaManagerT) GetSchemaVersionMissingKeys(w http.ResponseW

err = json.Unmarshal(schema.Schema, &schemaMap)
if err != nil {
logID := uuid.NewV4().String()
logID := uuid.Must(uuid.NewV4()).String()
pkgLogger.Errorf("logID : %s, err: %s", logID, err.Error())
http.Error(w, response.MakeResponse(fmt.Sprintf("Internal Error: An error has been logged with logID : %s", logID)), 500)
return
}

err = json.Unmarshal(eventModel.Schema, &masterSchemaMap)
if err != nil {
logID := uuid.NewV4().String()
logID := uuid.Must(uuid.NewV4()).String()
pkgLogger.Errorf("logID : %s, err: %s", logID, err.Error())
http.Error(w, response.MakeResponse(fmt.Sprintf("Interna Error: An error has been logged with logID : %s", logID)), 500)
return
Expand Down
8 changes: 4 additions & 4 deletions gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"golang.org/x/sync/errgroup"

"github.com/bugsnag/bugsnag-go"
uuid "github.com/gofrs/uuid"
"github.com/gorilla/mux"
"github.com/rs/cors"
"github.com/rudderlabs/rudder-server/config"
Expand All @@ -42,7 +43,6 @@ import (
"github.com/rudderlabs/rudder-server/utils/logger"
"github.com/rudderlabs/rudder-server/utils/misc"
"github.com/rudderlabs/rudder-server/utils/types"
uuid "github.com/satori/go.uuid"
"github.com/tidwall/gjson"
"github.com/tidwall/sjson"
)
Expand Down Expand Up @@ -472,7 +472,7 @@ func (gateway *HandleT) userWebRequestWorkerProcess(userWebRequestWorker *userWe
toSet := vjson.Value().(map[string]interface{})
toSet["rudderId"] = rudderId
if messageId := strings.TrimSpace(vjson.Get("messageId").String()); messageId == "" {
toSet["messageId"] = uuid.NewV4().String()
toSet["messageId"] = uuid.Must(uuid.NewV4()).String()
}
out = append(out, toSet)
return true // keep iterating
Expand Down Expand Up @@ -509,7 +509,7 @@ func (gateway *HandleT) userWebRequestWorkerProcess(userWebRequestWorker *userWe
body, _ = sjson.SetBytes(body, "receivedAt", time.Now().Format(misc.RFC3339Milli))
eventBatchesToRecord = append(eventBatchesToRecord, fmt.Sprintf("%s", body))
sourcesJobRunID := gjson.GetBytes(body, "batch.0.context.sources.job_run_id").Str // pick the job_run_id from the first event of batch. We are assuming job_run_id will be same for all events in a batch and the batch is coming from rudder-sources
id := uuid.NewV4()
id := uuid.Must(uuid.NewV4())

params := map[string]interface{}{
"source_id": sourceID,
Expand Down Expand Up @@ -1455,7 +1455,7 @@ func (gateway *HandleT) addToWebRequestQ(writer *http.ResponseWriter, req *http.
//If necessary fetch userID from request body.
if userIDHeader == "" {
//If the request comes through proxy, proxy would already send this. So this shouldn't be happening in that case
userIDHeader = uuid.NewV4().String()
userIDHeader = uuid.Must(uuid.NewV4()).String()
}
userWebRequestWorker := gateway.findUserWebRequestWorker(userIDHeader)
ipAddr := misc.GetIPFromReq(req)
Expand Down
2 changes: 1 addition & 1 deletion gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"reflect"
"time"

uuid "github.com/gofrs/uuid"
"github.com/golang/mock/gomock"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
uuid "github.com/satori/go.uuid"
"github.com/tidwall/gjson"
"github.com/tidwall/sjson"

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/garyburd/redigo v1.6.0 // indirect
github.com/go-ini/ini v1.63.2 // indirect
github.com/go-redis/redis v6.15.7+incompatible
github.com/gofrs/uuid v3.2.0+incompatible // indirect
github.com/gofrs/uuid v4.1.0+incompatible
github.com/golang-migrate/migrate/v4 v4.11.0
github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.5.0
Expand Down Expand Up @@ -63,7 +63,6 @@ require (
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 // indirect
github.com/rs/cors v1.7.0
github.com/rudderlabs/analytics-go v3.3.1+incompatible
github.com/satori/go.uuid v1.2.0
github.com/segmentio/backo-go v0.0.0-20160424052352-204274ad699c // indirect
github.com/segmentio/ksuid v1.0.2
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PL
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.1.0+incompatible h1:sIa2eCvUTwgjbqXrPLfNwUf9S3i3mpH1O1atV+iL/Wk=
github.com/gofrs/uuid v4.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
Expand Down Expand Up @@ -550,7 +550,6 @@ github.com/rudderlabs/analytics-go v3.3.1+incompatible h1:WoPC5c5M+yz0jG43elyguH
github.com/rudderlabs/analytics-go v3.3.1+incompatible/go.mod h1:LF8/ty9kUX4PTY3l5c97K3nZZaX5Hwsvt+NBaRL/f30=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/segmentio/backo-go v0.0.0-20160424052352-204274ad699c h1:rsRTAcCR5CeNLkvgBVSjQoDGRRt6kggsE6XYBqCv2KQ=
Expand Down
12 changes: 6 additions & 6 deletions jobsdb/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"testing"
"time"

uuid "github.com/gofrs/uuid"
"github.com/ory/dockertest"
"github.com/rudderlabs/rudder-server/admin"
"github.com/rudderlabs/rudder-server/config"
"github.com/rudderlabs/rudder-server/jobsdb"
"github.com/rudderlabs/rudder-server/services/archiver"
"github.com/rudderlabs/rudder-server/services/stats"
"github.com/rudderlabs/rudder-server/utils/logger"
uuid "github.com/satori/go.uuid"
"github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -120,7 +120,7 @@ func genJobs(customVal string, jobCount, eventsPerJob int) []*jobsdb.JobT {
Parameters: []byte(`{"batch_id":1,"source_id":"sourceID","source_job_run_id":""}`),
EventPayload: []byte(`{"receivedAt":"2021-06-06T20:26:39.598+05:30","writeKey":"writeKey","requestIP":"[::1]", "batch": [{"anonymousId":"anon_id","channel":"android-sdk","context":{"app":{"build":"1","name":"RudderAndroidClient","namespace":"com.rudderlabs.android.sdk","version":"1.0"},"device":{"id":"49e4bdd1c280bc00","manufacturer":"Google","model":"Android SDK built for x86","name":"generic_x86"},"library":{"name":"com.rudderstack.android.sdk.core"},"locale":"en-US","network":{"carrier":"Android"},"screen":{"density":420,"height":1794,"width":1080},"traits":{"anonymousId":"49e4bdd1c280bc00"},"user_agent":"Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)"},"event":"Demo Track","integrations":{"All":true},"messageId":"b96f3d8a-7c26-4329-9671-4e3202f42f15","originalTimestamp":"2019-08-12T05:08:30.909Z","properties":{"category":"Demo Category","floatVal":4.501,"label":"Demo Label","testArray":[{"id":"elem1","value":"e1"},{"id":"elem2","value":"e2"}],"testMap":{"t1":"a","t2":4},"value":5},"rudderId":"a-292e-4e79-9880-f8009e0ae4a3","sentAt":"2019-08-12T05:08:30.909Z","type":"track"}]}`),
UserID: "a-292e-4e79-9880-f8009e0ae4a3",
UUID: uuid.NewV4(),
UUID: uuid.Must(uuid.NewV4()),
CustomVal: customVal,
EventCount: eventsPerJob,
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestJobsDB(t *testing.T) {
Parameters: []byte(`{"batch_id":1,"source_id":"sourceID","source_job_run_id":""}`),
EventPayload: []byte(`{"receivedAt":"2021-06-06T20:26:39.598+05:30","writeKey":"writeKey","requestIP":"[::1]", "batch": [{"anonymousId":"anon_id","channel":"android-sdk","context":{"app":{"build":"1","name":"RudderAndroidClient","namespace":"com.rudderlabs.android.sdk","version":"1.0"},"device":{"id":"49e4bdd1c280bc00","manufacturer":"Google","model":"Android SDK built for x86","name":"generic_x86"},"library":{"name":"com.rudderstack.android.sdk.core"},"locale":"en-US","network":{"carrier":"Android"},"screen":{"density":420,"height":1794,"width":1080},"traits":{"anonymousId":"49e4bdd1c280bc00"},"user_agent":"Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)"},"event":"Demo Track","integrations":{"All":true},"messageId":"b96f3d8a-7c26-4329-9671-4e3202f42f15","originalTimestamp":"2019-08-12T05:08:30.909Z","properties":{"category":"Demo Category","floatVal":4.501,"label":"Demo Label","testArray":[{"id":"elem1","value":"e1"},{"id":"elem2","value":"e2"}],"testMap":{"t1":"a","t2":4},"value":5},"rudderId":"a-292e-4e79-9880-f8009e0ae4a3","sentAt":"2019-08-12T05:08:30.909Z","type":"track"}]}`),
UserID: "a-292e-4e79-9880-f8009e0ae4a3",
UUID: uuid.NewV4(),
UUID: uuid.Must(uuid.NewV4()),
CustomVal: customVal,
}

Expand Down Expand Up @@ -338,7 +338,7 @@ func TestJobsDB(t *testing.T) {
err = jobDB.UpdateJobStatus(statuses, []string{customVal}, []jobsdb.ParameterFilterT{})
require.NoError(t, err)
}

t.Log("Test spill over with GetToRetry")
{
eventLimitList := jobDB.GetToRetry(jobsdb.GetQueryParamsT{
Expand All @@ -348,7 +348,7 @@ func TestJobsDB(t *testing.T) {
ParameterFilters: []jobsdb.ParameterFilterT{},
})
requireSequential(t, eventLimitList)
require.Equal(t, jobCountPerDS, len(eventLimitList))
require.Equal(t, jobCountPerDS, len(eventLimitList))
}

})
Expand Down Expand Up @@ -386,7 +386,7 @@ func BenchmarkJobsdb(b *testing.B) {
Parameters: []byte(`{"batch_id":1,"source_id":"sourceID","source_job_run_id":""}`),
EventPayload: []byte(`{"receivedAt":"2021-06-06T20:26:39.598+05:30","writeKey":"writeKey","requestIP":"[::1]", "batch": [{"anonymousId":"anon_id","channel":"android-sdk","context":{"app":{"build":"1","name":"RudderAndroidClient","namespace":"com.rudderlabs.android.sdk","version":"1.0"},"device":{"id":"49e4bdd1c280bc00","manufacturer":"Google","model":"Android SDK built for x86","name":"generic_x86"},"library":{"name":"com.rudderstack.android.sdk.core"},"locale":"en-US","network":{"carrier":"Android"},"screen":{"density":420,"height":1794,"width":1080},"traits":{"anonymousId":"49e4bdd1c280bc00"},"user_agent":"Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)"},"event":"Demo Track","integrations":{"All":true},"messageId":"b96f3d8a-7c26-4329-9671-4e3202f42f15","originalTimestamp":"2019-08-12T05:08:30.909Z","properties":{"category":"Demo Category","floatVal":4.501,"label":"Demo Label","testArray":[{"id":"elem1","value":"e1"},{"id":"elem2","value":"e2"}],"testMap":{"t1":"a","t2":4},"value":5},"rudderId":"a-292e-4e79-9880-f8009e0ae4a3","sentAt":"2019-08-12T05:08:30.909Z","type":"track"}]}`),
UserID: "a-292e-4e79-9880-f8009e0ae4a3",
UUID: uuid.NewV4(),
UUID: uuid.Must(uuid.NewV4()),
CustomVal: customVal,
}
}
Expand Down
2 changes: 1 addition & 1 deletion jobsdb/jobsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ import (
"github.com/rudderlabs/rudder-server/services/stats"
"github.com/rudderlabs/rudder-server/utils/misc"

uuid "github.com/gofrs/uuid"
"github.com/lib/pq"
uuid "github.com/satori/go.uuid"
)

// BackupSettingsT is for capturing the backup
Expand Down
Loading