From b53907e5bfcadf26f1b5198677ee07234dde83c4 Mon Sep 17 00:00:00 2001 From: Aris Tzoumas Date: Wed, 7 Jun 2023 09:30:33 +0300 Subject: [PATCH] chore: naming conventions --- admin/admin.go | 4 +-- app/apphandlers/processorAppHandler.go | 4 +-- backend-config/namespace_config.go | 4 +-- backend-config/single_workspace.go | 4 +-- gateway/gateway.go | 6 ++-- gateway/integration_test.go | 8 ++--- integration_test/docker_test/docker_test.go | 6 ++-- .../kafka_batching/kafka_batching_test.go | 10 +++--- .../multi_tenant_test/multi_tenant_test.go | 8 ++--- processor/processor.go | 34 +++++++++---------- processor/processor_isolation_test.go | 8 ++--- processor/worker_test.go | 18 +++++----- .../batchrouter/batchrouter_isolation_test.go | 4 +-- router/batchrouter/handle.go | 8 ++--- router/batchrouter/handle_lifecycle.go | 26 +++++++------- router/eventorder_test.go | 8 ++--- router/handle.go | 10 +++--- router/handle_lifecycle.go | 34 +++++++++---------- router/misc.go | 10 +++--- router/misc_test.go | 24 ++++++------- router/router_isolation_test.go | 6 ++-- router/router_throttling_test.go | 12 +++---- services/alert/pagerduty.go | 4 +-- services/alert/victorops.go | 4 +-- testhelper/destination/kafka/kafka.go | 6 ++-- testhelper/destination/minio.go | 4 +-- testhelper/destination/sshserver/sshserver.go | 4 +-- testhelper/destination/transformer.go | 4 +-- .../azure-synapse/azure_synapse_test.go | 4 +-- .../integrations/bigquery/bigquery_test.go | 4 +-- .../clickhouse/clickhouse_test.go | 4 +-- .../integrations/datalake/datalake_test.go | 4 +-- .../deltalake-native/deltalake_test.go | 4 +-- warehouse/integrations/mssql/mssql_test.go | 4 +-- .../integrations/postgres/postgres_test.go | 4 +-- .../integrations/redshift/redshift_test.go | 4 +-- .../integrations/snowflake/snowflake_test.go | 4 +-- warehouse/warehouse.go | 4 +-- 38 files changed, 161 insertions(+), 161 deletions(-) diff --git a/admin/admin.go b/admin/admin.go index 0ef993507b9..8c34e17e729 100644 --- a/admin/admin.go +++ b/admin/admin.go @@ -45,7 +45,7 @@ import ( "github.com/spf13/viper" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-server/utils/misc" ) @@ -170,5 +170,5 @@ func StartServer(ctx context.Context) error { srv := &http.Server{Handler: srvMux, ReadHeaderTimeout: 3 * time.Second} - return kit_httputil.Serve(ctx, srv, l, time.Second) + return kithttputil.Serve(ctx, srv, l, time.Second) } diff --git a/app/apphandlers/processorAppHandler.go b/app/apphandlers/processorAppHandler.go index f9406b8de16..9d3bdb68184 100644 --- a/app/apphandlers/processorAppHandler.go +++ b/app/apphandlers/processorAppHandler.go @@ -20,7 +20,7 @@ import ( "github.com/bugsnag/bugsnag-go/v2" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/stats" "github.com/rudderlabs/rudder-server/app" "github.com/rudderlabs/rudder-server/app/cluster" @@ -315,5 +315,5 @@ func (a *processorApp) startHealthWebHandler(ctx context.Context, db *jobsdb.Han MaxHeaderBytes: a.config.http.MaxHeaderBytes, } - return kit_httputil.ListenAndServe(ctx, srv) + return kithttputil.ListenAndServe(ctx, srv) } diff --git a/backend-config/namespace_config.go b/backend-config/namespace_config.go index 9e8a9ea5d4a..4f740355a88 100644 --- a/backend-config/namespace_config.go +++ b/backend-config/namespace_config.go @@ -13,7 +13,7 @@ import ( jsoniter "github.com/json-iterator/go" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-server/services/controlplane/identity" "github.com/rudderlabs/rudder-server/utils/types" @@ -183,7 +183,7 @@ func (nc *namespaceConfig) makeHTTPRequest(req *http.Request) ([]byte, error) { return nil, err } - defer func() { kit_httputil.CloseResponse(resp) }() + defer func() { kithttputil.CloseResponse(resp) }() respBody, err := io.ReadAll(resp.Body) if err != nil { return nil, err diff --git a/backend-config/single_workspace.go b/backend-config/single_workspace.go index 1bd642cf3d4..a8825439cb1 100644 --- a/backend-config/single_workspace.go +++ b/backend-config/single_workspace.go @@ -13,7 +13,7 @@ import ( "github.com/cenkalti/backoff" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-server/services/controlplane/identity" "github.com/rudderlabs/rudder-server/utils/types" ) @@ -151,7 +151,7 @@ func (wc *singleWorkspaceConfig) makeHTTPRequest(ctx context.Context, url string return nil, err } - defer func() { kit_httputil.CloseResponse(resp) }() + defer func() { kithttputil.CloseResponse(resp) }() respBody, err := io.ReadAll(resp.Body) if err != nil { return nil, err diff --git a/gateway/gateway.go b/gateway/gateway.go index 23479960b83..255b403b9cb 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -31,7 +31,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/chiware" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" "github.com/rudderlabs/rudder-server/app" @@ -1384,7 +1384,7 @@ func (gateway *HandleT) StartWebHandler(ctx context.Context) error { MaxHeaderBytes: maxHeaderBytes, } - return kit_httputil.ListenAndServe(ctx, gateway.httpWebServer) + return kithttputil.ListenAndServe(ctx, gateway.httpWebServer) } // StartAdminHandler for Admin Operations @@ -1404,7 +1404,7 @@ func (gateway *HandleT) StartAdminHandler(ctx context.Context) error { ReadHeaderTimeout: ReadHeaderTimeout, } - return kit_httputil.ListenAndServe(ctx, srv) + return kithttputil.ListenAndServe(ctx, srv) } // Gets the config from config backend and extracts enabled writekeys diff --git a/gateway/integration_test.go b/gateway/integration_test.go index ec51e495f3b..2aa174d19f0 100644 --- a/gateway/integration_test.go +++ b/gateway/integration_test.go @@ -22,7 +22,7 @@ import ( "github.com/ory/dockertest/v3" "github.com/stretchr/testify/require" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-go-kit/testhelper/rand" "github.com/rudderlabs/rudder-server/app" @@ -117,11 +117,11 @@ func testGatewayByAppType(t *testing.T, appType string) { t.Logf("BackendConfig server listening on: %s", backendConfigSrv.URL) t.Cleanup(backendConfigSrv.Close) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) - httpAdminPort, err := kit_helper.GetFreePort() + httpAdminPort, err := kithelper.GetFreePort() require.NoError(t, err) - debugPort, err := kit_helper.GetFreePort() + debugPort, err := kithelper.GetFreePort() require.NoError(t, err) rudderTmpDir, err := os.MkdirTemp("", "rudder_server_*_test") diff --git a/integration_test/docker_test/docker_test.go b/integration_test/docker_test/docker_test.go index d13933eb013..8a2865096d0 100644 --- a/integration_test/docker_test/docker_test.go +++ b/integration_test/docker_test/docker_test.go @@ -32,7 +32,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/config" "github.com/rudderlabs/rudder-go-kit/logger" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-go-kit/testhelper/rand" "github.com/rudderlabs/rudder-server/runner" @@ -429,12 +429,12 @@ func setupMainFlow(svcCtx context.Context, t *testing.T) <-chan struct{} { t.Setenv("DEST_TRANSFORM_URL", transformerContainer.TransformURL) t.Setenv("DEPLOYMENT_TYPE", string(deployment.DedicatedType)) - httpPortInt, err := kit_helper.GetFreePort() + httpPortInt, err := kithelper.GetFreePort() require.NoError(t, err) httpPort = strconv.Itoa(httpPortInt) t.Setenv("RSERVER_GATEWAY_WEB_PORT", httpPort) - httpAdminPort, err := kit_helper.GetFreePort() + httpAdminPort, err := kithelper.GetFreePort() require.NoError(t, err) t.Setenv("RSERVER_GATEWAY_ADMIN_WEB_PORT", strconv.Itoa(httpAdminPort)) diff --git a/integration_test/kafka_batching/kafka_batching_test.go b/integration_test/kafka_batching/kafka_batching_test.go index 2fd5ad374af..1a3be3d768c 100644 --- a/integration_test/kafka_batching/kafka_batching_test.go +++ b/integration_test/kafka_batching/kafka_batching_test.go @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/require" "github.com/rudderlabs/rudder-go-kit/stats/testhelper" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-go-kit/testhelper/rand" @@ -131,13 +131,13 @@ func TestKafkaBatching(t *testing.T) { t.Logf("BackendConfig server listening on: %s", backendConfigSrv.URL) t.Cleanup(backendConfigSrv.Close) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) - httpAdminPort, err := kit_helper.GetFreePort() + httpAdminPort, err := kithelper.GetFreePort() require.NoError(t, err) - debugPort, err := kit_helper.GetFreePort() + debugPort, err := kithelper.GetFreePort() require.NoError(t, err) - prometheusPort, err := kit_helper.GetFreePort() + prometheusPort, err := kithelper.GetFreePort() require.NoError(t, err) rudderTmpDir, err := os.MkdirTemp("", "rudder_server_*_test") diff --git a/integration_test/multi_tenant_test/multi_tenant_test.go b/integration_test/multi_tenant_test/multi_tenant_test.go index 815042a9d3e..5412b96e9ee 100644 --- a/integration_test/multi_tenant_test/multi_tenant_test.go +++ b/integration_test/multi_tenant_test/multi_tenant_test.go @@ -25,7 +25,7 @@ import ( "github.com/ory/dockertest/v3" "github.com/stretchr/testify/require" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-go-kit/testhelper/rand" "github.com/rudderlabs/rudder-server/app" @@ -138,11 +138,11 @@ func testMultiTenantByAppType(t *testing.T, appType string) { t.Logf("BackendConfig server listening on: %s", backendConfigSrv.URL) t.Cleanup(backendConfigSrv.Close) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) - httpAdminPort, err := kit_helper.GetFreePort() + httpAdminPort, err := kithelper.GetFreePort() require.NoError(t, err) - debugPort, err := kit_helper.GetFreePort() + debugPort, err := kithelper.GetFreePort() require.NoError(t, err) rudderTmpDir, err := os.MkdirTemp("", "rudder_server_*_test") diff --git a/processor/processor.go b/processor/processor.go index 65b2ce52bc0..1520f9e35db 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -23,7 +23,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/ro" "github.com/rudderlabs/rudder-go-kit/stats" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" backendconfig "github.com/rudderlabs/rudder-server/backend-config" eventschema "github.com/rudderlabs/rudder-server/event-schema" "github.com/rudderlabs/rudder-server/jobsdb" @@ -98,10 +98,10 @@ type Handle struct { transDebugger transformationdebugger.TransformationDebugger isolationStrategy isolation.Strategy limiter struct { - read kit_sync.Limiter - preprocess kit_sync.Limiter - transform kit_sync.Limiter - store kit_sync.Limiter + read kitsync.Limiter + preprocess kitsync.Limiter + transform kitsync.Limiter + store kitsync.Limiter } config struct { isolationMode isolation.Mode @@ -139,7 +139,7 @@ type Handle struct { } adaptiveLimit func(int64) int64 - storePlocker kit_sync.PartitionLocker + storePlocker kitsync.PartitionLocker } type processorStats struct { statGatewayDBR stats.Measurement @@ -349,7 +349,7 @@ func (proc *Handle) Setup( if proc.adaptiveLimit == nil { proc.adaptiveLimit = func(limit int64) int64 { return limit } } - proc.storePlocker = *kit_sync.NewPartitionLocker() + proc.storePlocker = *kitsync.NewPartitionLocker() // Stats proc.statsFactory = stats.Default @@ -447,22 +447,22 @@ func (proc *Handle) Start(ctx context.Context) error { // limiters s := proc.statsFactory var limiterGroup sync.WaitGroup - proc.limiter.read = kit_sync.NewLimiter(ctx, &limiterGroup, "proc_read", + proc.limiter.read = kitsync.NewLimiter(ctx, &limiterGroup, "proc_read", config.GetInt("Processor.Limiter.read.limit", 50), s, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.read.dynamicPeriod", 1, time.Second))) - proc.limiter.preprocess = kit_sync.NewLimiter(ctx, &limiterGroup, "proc_preprocess", + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.read.dynamicPeriod", 1, time.Second))) + proc.limiter.preprocess = kitsync.NewLimiter(ctx, &limiterGroup, "proc_preprocess", config.GetInt("Processor.Limiter.preprocess.limit", 50), s, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.preprocess.dynamicPeriod", 1, time.Second))) - proc.limiter.transform = kit_sync.NewLimiter(ctx, &limiterGroup, "proc_transform", + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.preprocess.dynamicPeriod", 1, time.Second))) + proc.limiter.transform = kitsync.NewLimiter(ctx, &limiterGroup, "proc_transform", config.GetInt("Processor.Limiter.transform.limit", 50), s, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.transform.dynamicPeriod", 1, time.Second))) - proc.limiter.store = kit_sync.NewLimiter(ctx, &limiterGroup, "proc_store", + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.transform.dynamicPeriod", 1, time.Second))) + proc.limiter.store = kitsync.NewLimiter(ctx, &limiterGroup, "proc_store", config.GetInt("Processor.Limiter.store.limit", 50), s, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.store.dynamicPeriod", 1, time.Second))) + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Processor.Limiter.store.dynamicPeriod", 1, time.Second))) g.Go(func() error { limiterGroup.Wait() return nil @@ -2706,8 +2706,8 @@ func filterConfig(eventCopy *transformer.TransformerEventT) { } } -func (*Handle) getLimiterPriority(partition string) kit_sync.LimiterPriorityValue { - return kit_sync.LimiterPriorityValue(config.GetInt(fmt.Sprintf("Processor.Limiter.%s.Priority", partition), 1)) +func (*Handle) getLimiterPriority(partition string) kitsync.LimiterPriorityValue { + return kitsync.LimiterPriorityValue(config.GetInt(fmt.Sprintf("Processor.Limiter.%s.Priority", partition), 1)) } func (proc *Handle) filterDestinations( diff --git a/processor/processor_isolation_test.go b/processor/processor_isolation_test.go index 6fb173982d8..595b51b7e60 100644 --- a/processor/processor_isolation_test.go +++ b/processor/processor_isolation_test.go @@ -19,10 +19,10 @@ import ( "github.com/ory/dockertest/v3" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource/postgres" trand "github.com/rudderlabs/rudder-go-kit/testhelper/rand" @@ -232,7 +232,7 @@ func ProcIsolationScenario(t testing.TB, spec *ProcIsolationScenarioSpec) (overa config.Set("JobsDB.enableWriterQueue", false) // find free port for gateway http server to listen on - httpPortInt, err := kit_helper.GetFreePort() + httpPortInt, err := kithelper.GetFreePort() require.NoError(t, err) gatewayPort = strconv.Itoa(httpPortInt) @@ -301,7 +301,7 @@ func ProcIsolationScenario(t testing.TB, spec *ProcIsolationScenarioSpec) (overa resp, err := client.Do(req) require.NoError(t, err, "should be able to send the request to gateway") require.Equal(t, http.StatusOK, resp.StatusCode, "should be able to send the request to gateway successfully", payload) - func() { kit_httputil.CloseResponse(resp) }() + func() { kithttputil.CloseResponse(resp) }() return nil }) } diff --git a/processor/worker_test.go b/processor/worker_test.go index 76577f2ccd7..6ca10f9f0d4 100644 --- a/processor/worker_test.go +++ b/processor/worker_test.go @@ -9,7 +9,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" "github.com/rudderlabs/rudder-server/jobsdb" "github.com/rudderlabs/rudder-server/services/rsources" "github.com/rudderlabs/rudder-server/utils/workerpool" @@ -37,10 +37,10 @@ func TestWorkerPool(t *testing.T) { if pipelining { var limiterWg sync.WaitGroup - wh.limiters.query = kit_sync.NewLimiter(poolCtx, &limiterWg, "query", 2, stats.Default) - wh.limiters.process = kit_sync.NewLimiter(poolCtx, &limiterWg, "process", 2, stats.Default) - wh.limiters.store = kit_sync.NewLimiter(poolCtx, &limiterWg, "store", 2, stats.Default) - wh.limiters.transform = kit_sync.NewLimiter(poolCtx, &limiterWg, "transform", 2, stats.Default) + wh.limiters.query = kitsync.NewLimiter(poolCtx, &limiterWg, "query", 2, stats.Default) + wh.limiters.process = kitsync.NewLimiter(poolCtx, &limiterWg, "process", 2, stats.Default) + wh.limiters.store = kitsync.NewLimiter(poolCtx, &limiterWg, "store", 2, stats.Default) + wh.limiters.transform = kitsync.NewLimiter(poolCtx, &limiterWg, "transform", 2, stats.Default) defer limiterWg.Wait() } @@ -148,10 +148,10 @@ type mockWorkerHandle struct { } limiters struct { - query kit_sync.Limiter - process kit_sync.Limiter - transform kit_sync.Limiter - store kit_sync.Limiter + query kitsync.Limiter + process kitsync.Limiter + transform kitsync.Limiter + store kitsync.Limiter } limitsReached bool diff --git a/router/batchrouter/batchrouter_isolation_test.go b/router/batchrouter/batchrouter_isolation_test.go index ba10b643b9b..16cae13f830 100644 --- a/router/batchrouter/batchrouter_isolation_test.go +++ b/router/batchrouter/batchrouter_isolation_test.go @@ -19,7 +19,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/config" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource/postgres" "github.com/rudderlabs/rudder-server/jobsdb" @@ -225,7 +225,7 @@ func BatchrouterIsolationScenario(t testing.TB, spec *BrtIsolationScenarioSpec) defer mockWH.Close() t.Logf("Preparing the necessary configuration") - gatewayPort, err := kit_helper.GetFreePort() + gatewayPort, err := kithelper.GetFreePort() require.NoError(t, err) config.Set("Gateway.webPort", gatewayPort) config.Set("Profiler.Enabled", false) diff --git a/router/batchrouter/handle.go b/router/batchrouter/handle.go index 360342b9622..98051f9f149 100644 --- a/router/batchrouter/handle.go +++ b/router/batchrouter/handle.go @@ -25,7 +25,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/config" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" backendconfig "github.com/rudderlabs/rudder-server/backend-config" "github.com/rudderlabs/rudder-server/jobsdb" "github.com/rudderlabs/rudder-server/router/batchrouter/asyncdestinationmanager" @@ -109,9 +109,9 @@ type Handle struct { encounteredMergeRuleMap map[string]map[string]bool limiter struct { - read kit_sync.Limiter - process kit_sync.Limiter - upload kit_sync.Limiter + read kitsync.Limiter + process kitsync.Limiter + upload kitsync.Limiter } lastExecTimesMu sync.RWMutex diff --git a/router/batchrouter/handle_lifecycle.go b/router/batchrouter/handle_lifecycle.go index 235e43c9ac9..3ccb620b313 100644 --- a/router/batchrouter/handle_lifecycle.go +++ b/router/batchrouter/handle_lifecycle.go @@ -17,7 +17,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/config" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" backendconfig "github.com/rudderlabs/rudder-server/backend-config" "github.com/rudderlabs/rudder-server/jobsdb" "github.com/rudderlabs/rudder-server/router/batchrouter/asyncdestinationmanager" @@ -141,30 +141,30 @@ func (brt *Handle) Setup( var limiterGroup sync.WaitGroup limiterStatsPeriod := config.GetDuration("BatchRouter.Limiter.statsPeriod", 15, time.Second) - brt.limiter.read = kit_sync.NewLimiter(ctx, &limiterGroup, "brt_read", + brt.limiter.read = kitsync.NewLimiter(ctx, &limiterGroup, "brt_read", getBatchRouterConfigInt("Limiter.read.limit", brt.destType, 20), stats.Default, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("BatchRouter.Limiter.read.dynamicPeriod", 1, time.Second)), - kit_sync.WithLimiterTags(map[string]string{"destType": brt.destType}), - kit_sync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { + kitsync.WithLimiterDynamicPeriod(config.GetDuration("BatchRouter.Limiter.read.dynamicPeriod", 1, time.Second)), + kitsync.WithLimiterTags(map[string]string{"destType": brt.destType}), + kitsync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { return time.After(limiterStatsPeriod) }), ) - brt.limiter.process = kit_sync.NewLimiter(ctx, &limiterGroup, "brt_process", + brt.limiter.process = kitsync.NewLimiter(ctx, &limiterGroup, "brt_process", getBatchRouterConfigInt("Limiter.process.limit", brt.destType, 20), stats.Default, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("BatchRouter.Limiter.process.dynamicPeriod", 1, time.Second)), - kit_sync.WithLimiterTags(map[string]string{"destType": brt.destType}), - kit_sync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { + kitsync.WithLimiterDynamicPeriod(config.GetDuration("BatchRouter.Limiter.process.dynamicPeriod", 1, time.Second)), + kitsync.WithLimiterTags(map[string]string{"destType": brt.destType}), + kitsync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { return time.After(limiterStatsPeriod) }), ) - brt.limiter.upload = kit_sync.NewLimiter(ctx, &limiterGroup, "brt_upload", + brt.limiter.upload = kitsync.NewLimiter(ctx, &limiterGroup, "brt_upload", getBatchRouterConfigInt("Limiter.upload.limit", brt.destType, 50), stats.Default, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("BatchRouter.Limiter.upload.dynamicPeriod", 1, time.Second)), - kit_sync.WithLimiterTags(map[string]string{"destType": brt.destType}), - kit_sync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { + kitsync.WithLimiterDynamicPeriod(config.GetDuration("BatchRouter.Limiter.upload.dynamicPeriod", 1, time.Second)), + kitsync.WithLimiterTags(map[string]string{"destType": brt.destType}), + kitsync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { return time.After(limiterStatsPeriod) }), ) diff --git a/router/eventorder_test.go b/router/eventorder_test.go index b9b1b65b4c7..db2dfba999a 100644 --- a/router/eventorder_test.go +++ b/router/eventorder_test.go @@ -19,7 +19,7 @@ import ( "time" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-server/router/utils" "github.com/rudderlabs/rudder-server/runner" @@ -28,7 +28,7 @@ import ( "golang.org/x/sync/errgroup" "github.com/ory/dockertest/v3" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" trand "github.com/rudderlabs/rudder-go-kit/testhelper/rand" "github.com/rudderlabs/rudder-server/testhelper/destination" "github.com/rudderlabs/rudder-server/testhelper/workspaceConfig" @@ -148,7 +148,7 @@ func TestEventOrderGuarantee(t *testing.T) { config.Set("Router.maxStatusUpdateWait", "10ms") // find free port for gateway http server to listen on - httpPortInt, err := kit_helper.GetFreePort() + httpPortInt, err := kithelper.GetFreePort() require.NoError(t, err) gatewayPort = strconv.Itoa(httpPortInt) @@ -235,7 +235,7 @@ func TestEventOrderGuarantee(t *testing.T) { resp, err := client.Do(req) require.NoError(t, err, "should be able to send the request to gateway") require.Equal(t, http.StatusOK, resp.StatusCode, "should be able to send the request to gateway successfully", payload) - func() { kit_httputil.CloseResponse(resp) }() + func() { kithttputil.CloseResponse(resp) }() } }() diff --git a/router/handle.go b/router/handle.go index 98f34472bcf..7ac41a48d37 100644 --- a/router/handle.go +++ b/router/handle.go @@ -15,7 +15,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" backendconfig "github.com/rudderlabs/rudder-server/backend-config" "github.com/rudderlabs/rudder-server/jobsdb" "github.com/rudderlabs/rudder-server/processor/integrations" @@ -100,10 +100,10 @@ type Handle struct { startEnded chan struct{} limiter struct { - pickup kit_sync.Limiter - transform kit_sync.Limiter - batch kit_sync.Limiter - process kit_sync.Limiter + pickup kitsync.Limiter + transform kitsync.Limiter + batch kitsync.Limiter + process kitsync.Limiter stats struct { pickup *partition.Stats transform *partition.Stats diff --git a/router/handle_lifecycle.go b/router/handle_lifecycle.go index f2f7303621b..a842b51cfcc 100644 --- a/router/handle_lifecycle.go +++ b/router/handle_lifecycle.go @@ -10,7 +10,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/config" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" backendconfig "github.com/rudderlabs/rudder-server/backend-config" "github.com/rudderlabs/rudder-server/jobsdb" customDestinationManager "github.com/rudderlabs/rudder-server/router/customdestinationmanager" @@ -158,45 +158,45 @@ func (rt *Handle) Setup( var limiterGroup sync.WaitGroup limiterStatsPeriod := config.GetDuration("Router.Limiter.statsPeriod", 15, time.Second) - rt.limiter.pickup = kit_sync.NewLimiter(ctx, &limiterGroup, "rt_pickup", + rt.limiter.pickup = kitsync.NewLimiter(ctx, &limiterGroup, "rt_pickup", getRouterConfigInt(rt.destType, "Limiter.pickup.limit", 100), stats.Default, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.pickup.dynamicPeriod", 1, time.Second)), - kit_sync.WithLimiterTags(map[string]string{"destType": rt.destType}), - kit_sync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.pickup.dynamicPeriod", 1, time.Second)), + kitsync.WithLimiterTags(map[string]string{"destType": rt.destType}), + kitsync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { return time.After(limiterStatsPeriod) }), ) rt.limiter.stats.pickup = partition.NewStats() - rt.limiter.transform = kit_sync.NewLimiter(ctx, &limiterGroup, "rt_transform", + rt.limiter.transform = kitsync.NewLimiter(ctx, &limiterGroup, "rt_transform", getRouterConfigInt(rt.destType, "Limiter.transform.limit", 200), stats.Default, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.transform.dynamicPeriod", 1, time.Second)), - kit_sync.WithLimiterTags(map[string]string{"destType": rt.destType}), - kit_sync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.transform.dynamicPeriod", 1, time.Second)), + kitsync.WithLimiterTags(map[string]string{"destType": rt.destType}), + kitsync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { return time.After(limiterStatsPeriod) }), ) rt.limiter.stats.transform = partition.NewStats() - rt.limiter.batch = kit_sync.NewLimiter(ctx, &limiterGroup, "rt_batch", + rt.limiter.batch = kitsync.NewLimiter(ctx, &limiterGroup, "rt_batch", getRouterConfigInt(rt.destType, "Limiter.batch.limit", 200), stats.Default, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.batch.dynamicPeriod", 1, time.Second)), - kit_sync.WithLimiterTags(map[string]string{"destType": rt.destType}), - kit_sync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.batch.dynamicPeriod", 1, time.Second)), + kitsync.WithLimiterTags(map[string]string{"destType": rt.destType}), + kitsync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { return time.After(limiterStatsPeriod) }), ) rt.limiter.stats.batch = partition.NewStats() - rt.limiter.process = kit_sync.NewLimiter(ctx, &limiterGroup, "rt_process", + rt.limiter.process = kitsync.NewLimiter(ctx, &limiterGroup, "rt_process", getRouterConfigInt(rt.destType, "Limiter.process.limit", 200), stats.Default, - kit_sync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.process.dynamicPeriod", 1, time.Second)), - kit_sync.WithLimiterTags(map[string]string{"destType": rt.destType}), - kit_sync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { + kitsync.WithLimiterDynamicPeriod(config.GetDuration("Router.Limiter.process.dynamicPeriod", 1, time.Second)), + kitsync.WithLimiterTags(map[string]string{"destType": rt.destType}), + kitsync.WithLimiterStatsTriggerFunc(func() <-chan time.Time { return time.After(limiterStatsPeriod) }), ) diff --git a/router/misc.go b/router/misc.go index f1d483bb4b3..2cfadf03b38 100644 --- a/router/misc.go +++ b/router/misc.go @@ -7,7 +7,7 @@ import ( "time" "github.com/rudderlabs/rudder-go-kit/config" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" "github.com/rudderlabs/rudder-server/processor/integrations" "github.com/rudderlabs/rudder-server/router/isolation" "github.com/rudderlabs/rudder-server/utils/misc" @@ -72,12 +72,12 @@ func isolationMode(destType string, config *config.Config) isolation.Mode { return isolation.Mode(config.GetString("Router.isolationMode", string(defaultIsolationMode))) } -func LimiterPriorityValueFrom(v, max int) kit_sync.LimiterPriorityValue { +func LimiterPriorityValueFrom(v, max int) kitsync.LimiterPriorityValue { if v <= 0 { - return kit_sync.LimiterPriorityValueLow + return kitsync.LimiterPriorityValueLow } if v > max { - return kit_sync.LimiterPriorityValueHigh + return kitsync.LimiterPriorityValueHigh } - return kit_sync.LimiterPriorityValue(int(math.Ceil(float64(kit_sync.LimiterPriorityValueHigh) * float64(v) / float64(max)))) + return kitsync.LimiterPriorityValue(int(math.Ceil(float64(kitsync.LimiterPriorityValueHigh) * float64(v) / float64(max)))) } diff --git a/router/misc_test.go b/router/misc_test.go index 123660b5453..3b24008da7b 100644 --- a/router/misc_test.go +++ b/router/misc_test.go @@ -3,25 +3,25 @@ package router_test import ( "testing" - kit_sync "github.com/rudderlabs/rudder-go-kit/sync" + kitsync "github.com/rudderlabs/rudder-go-kit/sync" "github.com/rudderlabs/rudder-server/router" "github.com/stretchr/testify/require" ) func TestLimiterPriorityValueFrom(t *testing.T) { - require.Equal(t, kit_sync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(-1, 100), "negative value should correspond to lowest priority") - require.Equal(t, kit_sync.LimiterPriorityValueHigh, router.LimiterPriorityValueFrom(2, 1), "value larger than the max should correspond to highest priority") + require.Equal(t, kitsync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(-1, 100), "negative value should correspond to lowest priority") + require.Equal(t, kitsync.LimiterPriorityValueHigh, router.LimiterPriorityValueFrom(2, 1), "value larger than the max should correspond to highest priority") - require.Equal(t, kit_sync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(0, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(1, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(25, 100)) + require.Equal(t, kitsync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(0, 100)) + require.Equal(t, kitsync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(1, 100)) + require.Equal(t, kitsync.LimiterPriorityValueLow, router.LimiterPriorityValueFrom(25, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueMedium, router.LimiterPriorityValueFrom(26, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueMedium, router.LimiterPriorityValueFrom(50, 100)) + require.Equal(t, kitsync.LimiterPriorityValueMedium, router.LimiterPriorityValueFrom(26, 100)) + require.Equal(t, kitsync.LimiterPriorityValueMedium, router.LimiterPriorityValueFrom(50, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueMediumHigh, router.LimiterPriorityValueFrom(51, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueMediumHigh, router.LimiterPriorityValueFrom(75, 100)) + require.Equal(t, kitsync.LimiterPriorityValueMediumHigh, router.LimiterPriorityValueFrom(51, 100)) + require.Equal(t, kitsync.LimiterPriorityValueMediumHigh, router.LimiterPriorityValueFrom(75, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueHigh, router.LimiterPriorityValueFrom(76, 100)) - require.Equal(t, kit_sync.LimiterPriorityValueHigh, router.LimiterPriorityValueFrom(100, 100)) + require.Equal(t, kitsync.LimiterPriorityValueHigh, router.LimiterPriorityValueFrom(76, 100)) + require.Equal(t, kitsync.LimiterPriorityValueHigh, router.LimiterPriorityValueFrom(100, 100)) } diff --git a/router/router_isolation_test.go b/router/router_isolation_test.go index e2d96172017..3e10726589f 100644 --- a/router/router_isolation_test.go +++ b/router/router_isolation_test.go @@ -21,7 +21,7 @@ import ( "github.com/rudderlabs/rudder-go-kit/config" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource/postgres" "github.com/rudderlabs/rudder-server/jobsdb" @@ -192,9 +192,9 @@ func RouterIsolationScenario(t testing.TB, spec *RtIsolationScenarioSpec) (overa defer mockCBE.Close() t.Logf("Preparing the necessary configuration") - gatewayPort, err := kit_helper.GetFreePort() + gatewayPort, err := kithelper.GetFreePort() require.NoError(t, err) - adminPort, err := kit_helper.GetFreePort() + adminPort, err := kithelper.GetFreePort() require.NoError(t, err) config.Set("Gateway.webPort", gatewayPort) config.Set("Gateway.adminWebPort", adminPort) diff --git a/router/router_throttling_test.go b/router/router_throttling_test.go index 1ea8100b6dc..4c0ac35aef0 100644 --- a/router/router_throttling_test.go +++ b/router/router_throttling_test.go @@ -22,8 +22,8 @@ import ( "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-go-kit/testhelper/docker/resource" trand "github.com/rudderlabs/rudder-go-kit/testhelper/rand" "github.com/rudderlabs/rudder-server/runner" @@ -109,11 +109,11 @@ func Test_RouterThrottling(t *testing.T) { "workspaceId": workspaceID, }) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) - httpAdminPort, err := kit_helper.GetFreePort() + httpAdminPort, err := kithelper.GetFreePort() require.NoError(t, err) - debugPort, err := kit_helper.GetFreePort() + debugPort, err := kithelper.GetFreePort() require.NoError(t, err) rudderTmpDir, err := os.MkdirTemp("", "rudder_server_*_test") require.NoError(t, err) @@ -207,7 +207,7 @@ func Test_RouterThrottling(t *testing.T) { resp, err := client.Do(req) require.NoError(t, err, "should be able to send the request to gateway") require.Equal(t, http.StatusOK, resp.StatusCode) - func() { kit_httputil.CloseResponse(resp) }() + func() { kithttputil.CloseResponse(resp) }() } require.Eventuallyf(t, diff --git a/services/alert/pagerduty.go b/services/alert/pagerduty.go index d5555dbd5e4..7ccceca5365 100644 --- a/services/alert/pagerduty.go +++ b/services/alert/pagerduty.go @@ -8,7 +8,7 @@ import ( "time" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/logger" ) @@ -44,7 +44,7 @@ func (ops *PagerDuty) Alert(message string) { } body, err := io.ReadAll(resp.Body) - defer func() { kit_httputil.CloseResponse(resp) }() + defer func() { kithttputil.CloseResponse(resp) }() if err != nil { pkgLogger.Errorf("Alert: Failed to read response body: %s", err.Error()) return diff --git a/services/alert/victorops.go b/services/alert/victorops.go index e50fcd15427..97ba8ad3264 100644 --- a/services/alert/victorops.go +++ b/services/alert/victorops.go @@ -9,7 +9,7 @@ import ( "time" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" ) func (ops *VictorOps) Alert(message string) { @@ -33,7 +33,7 @@ func (ops *VictorOps) Alert(message string) { } body, err := io.ReadAll(resp.Body) - defer func() { kit_httputil.CloseResponse(resp) }() + defer func() { kithttputil.CloseResponse(resp) }() if err != nil { pkgLogger.Errorf("Alert: Failed to read response body: %s", err.Error()) return diff --git a/testhelper/destination/kafka/kafka.go b/testhelper/destination/kafka/kafka.go index dcda3d59243..3315267ae24 100644 --- a/testhelper/destination/kafka/kafka.go +++ b/testhelper/destination/kafka/kafka.go @@ -10,7 +10,7 @@ import ( dc "github.com/ory/dockertest/v3/docker" "golang.org/x/sync/errgroup" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/testhelper/destination" ) @@ -169,7 +169,7 @@ func Setup(pool *dockertest.Pool, cln destination.Cleaner, opts ...Option) (*Res }) } - zookeeperPortInt, err := kit_helper.GetFreePort() + zookeeperPortInt, err := kithelper.GetFreePort() if err != nil { return nil, err } @@ -321,7 +321,7 @@ func Setup(pool *dockertest.Pool, cln destination.Cleaner, opts ...Option) (*Res containers := make([]*dockertest.Resource, c.brokers) for i := uint(0); i < c.brokers; i++ { i := i - localhostPortInt, err := kit_helper.GetFreePort() + localhostPortInt, err := kithelper.GetFreePort() if err != nil { return nil, err } diff --git a/testhelper/destination/minio.go b/testhelper/destination/minio.go index 7845d4ca36b..9a32607a56c 100644 --- a/testhelper/destination/minio.go +++ b/testhelper/destination/minio.go @@ -9,7 +9,7 @@ import ( _ "github.com/lib/pq" "github.com/minio/minio-go" "github.com/ory/dockertest/v3" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" ) type MINIOResource struct { @@ -67,7 +67,7 @@ func SetupMINIO(pool *dockertest.Pool, d Cleaner) (*MINIOResource, error) { if err != nil { return err } - defer func() { kit_httputil.CloseResponse(resp) }() + defer func() { kithttputil.CloseResponse(resp) }() if resp.StatusCode != http.StatusOK { return fmt.Errorf("status code not OK") } diff --git a/testhelper/destination/sshserver/sshserver.go b/testhelper/destination/sshserver/sshserver.go index fa229102824..10718f1aa9e 100644 --- a/testhelper/destination/sshserver/sshserver.go +++ b/testhelper/destination/sshserver/sshserver.go @@ -10,7 +10,7 @@ import ( "github.com/ory/dockertest/v3" dc "github.com/ory/dockertest/v3/docker" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/testhelper/destination" ) @@ -88,7 +88,7 @@ func Setup(pool *dockertest.Pool, cln destination.Cleaner, opts ...Option) (*Res }) } - portInt, err := kit_helper.GetFreePort() + portInt, err := kithelper.GetFreePort() if err != nil { return nil, err } diff --git a/testhelper/destination/transformer.go b/testhelper/destination/transformer.go index 7f55c0aa699..316b82519d9 100644 --- a/testhelper/destination/transformer.go +++ b/testhelper/destination/transformer.go @@ -9,7 +9,7 @@ import ( _ "github.com/lib/pq" "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" ) type TransformerResource struct { @@ -56,7 +56,7 @@ func SetupTransformer(pool *dockertest.Pool, d Cleaner) (*TransformerResource, e if err != nil { return err } - defer func() { kit_httputil.CloseResponse(resp) }() + defer func() { kithttputil.CloseResponse(resp) }() if resp.StatusCode != 200 { return errors.New(resp.Status) } diff --git a/warehouse/integrations/azure-synapse/azure_synapse_test.go b/warehouse/integrations/azure-synapse/azure_synapse_test.go index 7413d9240e7..2cdbbe02a20 100644 --- a/warehouse/integrations/azure-synapse/azure_synapse_test.go +++ b/warehouse/integrations/azure-synapse/azure_synapse_test.go @@ -14,7 +14,7 @@ import ( "github.com/rudderlabs/rudder-server/testhelper/workspaceConfig" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" backendconfig "github.com/rudderlabs/rudder-server/backend-config" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" @@ -44,7 +44,7 @@ func TestIntegration(t *testing.T) { minioPort := c.Port("minio", 9000) azureSynapsePort := c.Port("azure_synapse", 1433) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/bigquery/bigquery_test.go b/warehouse/integrations/bigquery/bigquery_test.go index d80d3ba383b..44e6f0de180 100644 --- a/warehouse/integrations/bigquery/bigquery_test.go +++ b/warehouse/integrations/bigquery/bigquery_test.go @@ -17,7 +17,7 @@ import ( "github.com/rudderlabs/rudder-server/testhelper/workspaceConfig" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" "github.com/rudderlabs/rudder-server/warehouse/encoding" @@ -59,7 +59,7 @@ func TestIntegration(t *testing.T) { jobsDBPort := c.Port("jobsDb", 5432) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/clickhouse/clickhouse_test.go b/warehouse/integrations/clickhouse/clickhouse_test.go index 57a5776871d..6178596f2eb 100644 --- a/warehouse/integrations/clickhouse/clickhouse_test.go +++ b/warehouse/integrations/clickhouse/clickhouse_test.go @@ -19,7 +19,7 @@ import ( "github.com/rudderlabs/rudder-server/testhelper/workspaceConfig" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" "github.com/rudderlabs/rudder-server/warehouse/encoding" @@ -61,7 +61,7 @@ func TestIntegration(t *testing.T) { clusterPort3 := c.Port("clickhouse03", 9000) clusterPort4 := c.Port("clickhouse04", 9000) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/datalake/datalake_test.go b/warehouse/integrations/datalake/datalake_test.go index 178f014f7b3..7b488647a03 100644 --- a/warehouse/integrations/datalake/datalake_test.go +++ b/warehouse/integrations/datalake/datalake_test.go @@ -16,7 +16,7 @@ import ( "github.com/minio/minio-go/v6" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" "github.com/rudderlabs/rudder-server/warehouse/encoding" @@ -76,7 +76,7 @@ func TestIntegration(t *testing.T) { minioPort := c.Port("minio", 9000) azurePort := c.Port("azure", 10000) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/deltalake-native/deltalake_test.go b/warehouse/integrations/deltalake-native/deltalake_test.go index 7980d0ae2c7..dd1b1d2ef82 100644 --- a/warehouse/integrations/deltalake-native/deltalake_test.go +++ b/warehouse/integrations/deltalake-native/deltalake_test.go @@ -17,7 +17,7 @@ import ( dbsql "github.com/databricks/databricks-sql-go" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" @@ -86,7 +86,7 @@ func TestIntegration(t *testing.T) { jobsDBPort := c.Port("jobsDb", 5432) databricksConnectorPort := c.Port("databricks-connector", 50051) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/mssql/mssql_test.go b/warehouse/integrations/mssql/mssql_test.go index 5d9736e8ed5..3d9b615d6ac 100644 --- a/warehouse/integrations/mssql/mssql_test.go +++ b/warehouse/integrations/mssql/mssql_test.go @@ -14,7 +14,7 @@ import ( "github.com/rudderlabs/rudder-server/testhelper/workspaceConfig" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" "github.com/rudderlabs/rudder-server/warehouse/client" @@ -45,7 +45,7 @@ func TestIntegration(t *testing.T) { minioPort := c.Port("minio", 9000) mssqlPort := c.Port("mssql", 1433) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/postgres/postgres_test.go b/warehouse/integrations/postgres/postgres_test.go index aba055865e1..c05a9f95d8d 100644 --- a/warehouse/integrations/postgres/postgres_test.go +++ b/warehouse/integrations/postgres/postgres_test.go @@ -19,7 +19,7 @@ import ( "github.com/rudderlabs/rudder-server/warehouse/tunnelling" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" @@ -52,7 +52,7 @@ func TestIntegration(t *testing.T) { postgresPort := c.Port("postgres", 5432) sshPort := c.Port("ssh-server", 2222) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/redshift/redshift_test.go b/warehouse/integrations/redshift/redshift_test.go index 337af58541d..adf4c04fec5 100644 --- a/warehouse/integrations/redshift/redshift_test.go +++ b/warehouse/integrations/redshift/redshift_test.go @@ -21,7 +21,7 @@ import ( sqlmiddleware "github.com/rudderlabs/rudder-server/warehouse/integrations/middleware/sqlquerywrapper" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" "github.com/rudderlabs/rudder-server/warehouse/encoding" @@ -94,7 +94,7 @@ func TestIntegration(t *testing.T) { jobsDBPort := c.Port("jobsDb", 5432) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/integrations/snowflake/snowflake_test.go b/warehouse/integrations/snowflake/snowflake_test.go index 4c738186c61..f4b3c3eeabf 100644 --- a/warehouse/integrations/snowflake/snowflake_test.go +++ b/warehouse/integrations/snowflake/snowflake_test.go @@ -17,7 +17,7 @@ import ( "github.com/rudderlabs/rudder-server/testhelper/workspaceConfig" "github.com/rudderlabs/compose-test/testcompose" - kit_helper "github.com/rudderlabs/rudder-go-kit/testhelper" + kithelper "github.com/rudderlabs/rudder-go-kit/testhelper" "github.com/rudderlabs/rudder-server/runner" "github.com/rudderlabs/rudder-server/testhelper/health" snowflakedb "github.com/snowflakedb/gosnowflake" @@ -99,7 +99,7 @@ func TestIntegration(t *testing.T) { jobsDBPort := c.Port("jobsDb", 5432) - httpPort, err := kit_helper.GetFreePort() + httpPort, err := kithelper.GetFreePort() require.NoError(t, err) workspaceID := warehouseutils.RandHex() diff --git a/warehouse/warehouse.go b/warehouse/warehouse.go index f4556afaeae..5bd4dfbdb6f 100644 --- a/warehouse/warehouse.go +++ b/warehouse/warehouse.go @@ -29,7 +29,7 @@ import ( "github.com/cenkalti/backoff/v4" "github.com/rudderlabs/rudder-go-kit/config" - kit_httputil "github.com/rudderlabs/rudder-go-kit/httputil" + kithttputil "github.com/rudderlabs/rudder-go-kit/httputil" "github.com/rudderlabs/rudder-go-kit/logger" "github.com/rudderlabs/rudder-go-kit/stats" "github.com/rudderlabs/rudder-server/app" @@ -1571,7 +1571,7 @@ func startWebHandler(ctx context.Context) error { ReadHeaderTimeout: 3 * time.Second, } - return kit_httputil.ListenAndServe(ctx, srv) + return kithttputil.ListenAndServe(ctx, srv) } // CheckForWarehouseEnvVars Checks if all the required Env Variables for Warehouse are present