From cec5ae1c9d0254aadecfd0a4d6f01d62b3310a54 Mon Sep 17 00:00:00 2001 From: Aryan Goyal <137564277+ary82@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:02:37 +0530 Subject: [PATCH] [refactor] Move plugin/sampling/leaderelection to internal/leaderelection (#6546) ## Which problem is this PR solving? - Towards #6411 ## Description of the changes - Move leaderelection package from plugin/sampling/leaderelection to internal/leaderelection ## How was this change tested? - Covered by existing ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` Signed-off-by: Aryan Goyal <137564277+ary82@users.noreply.github.com> --- cmd/jaeger/internal/extension/remotesampling/extension.go | 2 +- {plugin/sampling => internal}/leaderelection/leader_election.go | 0 .../leaderelection/leader_election_test.go | 0 .../leaderelection/mocks/ElectionParticipant.go | 0 plugin/sampling/strategyprovider/adaptive/aggregator.go | 2 +- plugin/sampling/strategyprovider/adaptive/aggregator_test.go | 2 +- plugin/sampling/strategyprovider/adaptive/factory.go | 2 +- plugin/sampling/strategyprovider/adaptive/post_aggregator.go | 2 +- .../sampling/strategyprovider/adaptive/post_aggregator_test.go | 2 +- plugin/sampling/strategyprovider/adaptive/provider.go | 2 +- plugin/sampling/strategyprovider/adaptive/provider_test.go | 2 +- 11 files changed, 8 insertions(+), 8 deletions(-) rename {plugin/sampling => internal}/leaderelection/leader_election.go (100%) rename {plugin/sampling => internal}/leaderelection/leader_election_test.go (100%) rename {plugin/sampling => internal}/leaderelection/mocks/ElectionParticipant.go (100%) diff --git a/cmd/jaeger/internal/extension/remotesampling/extension.go b/cmd/jaeger/internal/extension/remotesampling/extension.go index 881527cd611..b4d62d9d5a9 100644 --- a/cmd/jaeger/internal/extension/remotesampling/extension.go +++ b/cmd/jaeger/internal/extension/remotesampling/extension.go @@ -21,11 +21,11 @@ import ( "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy" "github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage" + "github.com/jaegertracing/jaeger/internal/leaderelection" "github.com/jaegertracing/jaeger/internal/metrics/otelmetrics" samplinggrpc "github.com/jaegertracing/jaeger/internal/sampling/grpc" samplinghttp "github.com/jaegertracing/jaeger/internal/sampling/http" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection" "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive" "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/static" "github.com/jaegertracing/jaeger/proto-gen/api_v2" diff --git a/plugin/sampling/leaderelection/leader_election.go b/internal/leaderelection/leader_election.go similarity index 100% rename from plugin/sampling/leaderelection/leader_election.go rename to internal/leaderelection/leader_election.go diff --git a/plugin/sampling/leaderelection/leader_election_test.go b/internal/leaderelection/leader_election_test.go similarity index 100% rename from plugin/sampling/leaderelection/leader_election_test.go rename to internal/leaderelection/leader_election_test.go diff --git a/plugin/sampling/leaderelection/mocks/ElectionParticipant.go b/internal/leaderelection/mocks/ElectionParticipant.go similarity index 100% rename from plugin/sampling/leaderelection/mocks/ElectionParticipant.go rename to internal/leaderelection/mocks/ElectionParticipant.go diff --git a/plugin/sampling/strategyprovider/adaptive/aggregator.go b/plugin/sampling/strategyprovider/adaptive/aggregator.go index 2389ec9254e..078a8bcb3f4 100644 --- a/plugin/sampling/strategyprovider/adaptive/aggregator.go +++ b/plugin/sampling/strategyprovider/adaptive/aggregator.go @@ -10,10 +10,10 @@ import ( "go.uber.org/zap" "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy" + "github.com/jaegertracing/jaeger/internal/leaderelection" span_model "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/pkg/hostname" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection" "github.com/jaegertracing/jaeger/storage/samplingstore" "github.com/jaegertracing/jaeger/storage/samplingstore/model" ) diff --git a/plugin/sampling/strategyprovider/adaptive/aggregator_test.go b/plugin/sampling/strategyprovider/adaptive/aggregator_test.go index a2145f80c35..9793aada743 100644 --- a/plugin/sampling/strategyprovider/adaptive/aggregator_test.go +++ b/plugin/sampling/strategyprovider/adaptive/aggregator_test.go @@ -13,9 +13,9 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" + epmocks "github.com/jaegertracing/jaeger/internal/leaderelection/mocks" "github.com/jaegertracing/jaeger/internal/metricstest" "github.com/jaegertracing/jaeger/model" - epmocks "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection/mocks" "github.com/jaegertracing/jaeger/storage/samplingstore/mocks" ) diff --git a/plugin/sampling/strategyprovider/adaptive/factory.go b/plugin/sampling/strategyprovider/adaptive/factory.go index 7467b3b49d5..3b42c0249b4 100644 --- a/plugin/sampling/strategyprovider/adaptive/factory.go +++ b/plugin/sampling/strategyprovider/adaptive/factory.go @@ -11,10 +11,10 @@ import ( "go.uber.org/zap" "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy" + "github.com/jaegertracing/jaeger/internal/leaderelection" "github.com/jaegertracing/jaeger/pkg/distributedlock" "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/plugin" - "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection" "github.com/jaegertracing/jaeger/storage" "github.com/jaegertracing/jaeger/storage/samplingstore" ) diff --git a/plugin/sampling/strategyprovider/adaptive/post_aggregator.go b/plugin/sampling/strategyprovider/adaptive/post_aggregator.go index 048b3367a95..12fc84b7198 100644 --- a/plugin/sampling/strategyprovider/adaptive/post_aggregator.go +++ b/plugin/sampling/strategyprovider/adaptive/post_aggregator.go @@ -12,8 +12,8 @@ import ( "go.uber.org/zap" + "github.com/jaegertracing/jaeger/internal/leaderelection" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection" "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive/calculationstrategy" "github.com/jaegertracing/jaeger/storage/samplingstore" "github.com/jaegertracing/jaeger/storage/samplingstore/model" diff --git a/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go b/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go index 1b83ceea27f..22921dd120f 100644 --- a/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go +++ b/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go @@ -14,10 +14,10 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" + epmocks "github.com/jaegertracing/jaeger/internal/leaderelection/mocks" "github.com/jaegertracing/jaeger/internal/metricstest" "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/pkg/testutils" - epmocks "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection/mocks" "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive/calculationstrategy" smocks "github.com/jaegertracing/jaeger/storage/samplingstore/mocks" "github.com/jaegertracing/jaeger/storage/samplingstore/model" diff --git a/plugin/sampling/strategyprovider/adaptive/provider.go b/plugin/sampling/strategyprovider/adaptive/provider.go index bc04184f083..aaa569d8bb4 100644 --- a/plugin/sampling/strategyprovider/adaptive/provider.go +++ b/plugin/sampling/strategyprovider/adaptive/provider.go @@ -10,7 +10,7 @@ import ( "go.uber.org/zap" - "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection" + "github.com/jaegertracing/jaeger/internal/leaderelection" "github.com/jaegertracing/jaeger/proto-gen/api_v2" "github.com/jaegertracing/jaeger/storage/samplingstore" "github.com/jaegertracing/jaeger/storage/samplingstore/model" diff --git a/plugin/sampling/strategyprovider/adaptive/provider_test.go b/plugin/sampling/strategyprovider/adaptive/provider_test.go index 8f0d83a640d..71877b7204f 100644 --- a/plugin/sampling/strategyprovider/adaptive/provider_test.go +++ b/plugin/sampling/strategyprovider/adaptive/provider_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" - epmocks "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection/mocks" + epmocks "github.com/jaegertracing/jaeger/internal/leaderelection/mocks" "github.com/jaegertracing/jaeger/proto-gen/api_v2" smocks "github.com/jaegertracing/jaeger/storage/samplingstore/mocks" "github.com/jaegertracing/jaeger/storage/samplingstore/model"