Skip to content

Commit

Permalink
chore: naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
atzoum committed Jun 7, 2023
1 parent 3c147ce commit b53907e
Show file tree
Hide file tree
Showing 38 changed files with 161 additions and 161 deletions.
4 changes: 2 additions & 2 deletions admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions app/apphandlers/processorAppHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions backend-config/namespace_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions backend-config/single_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions gateway/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions integration_test/docker_test/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
Expand Down
10 changes: 5 additions & 5 deletions integration_test/kafka_batching/kafka_batching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions integration_test/multi_tenant_test/multi_tenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
Expand Down
34 changes: 17 additions & 17 deletions processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -139,7 +139,7 @@ type Handle struct {
}

adaptiveLimit func(int64) int64
storePlocker kit_sync.PartitionLocker
storePlocker kitsync.PartitionLocker
}
type processorStats struct {
statGatewayDBR stats.Measurement
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions processor/processor_isolation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
})
}
Expand Down
18 changes: 9 additions & 9 deletions processor/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
}

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions router/batchrouter/batchrouter_isolation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions router/batchrouter/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit b53907e

Please sign in to comment.