Skip to content

Commit

Permalink
[refactor] Move sampling strategy interfaces to internal/sampling/str…
Browse files Browse the repository at this point in the history
…ategy (#6547)

## Which problem is this PR solving?
- Towards #6411 

## Description of the changes
- Move sampling strategy interfaces from
cmd/collector/app/sampling/samplingstrategy to
internal/sampling/strategy

## 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 <[email protected]>
  • Loading branch information
ary82 authored Jan 15, 2025
1 parent 0b5f8b1 commit d1d9ced
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion cmd/collector/app/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/jaegertracing/jaeger/cmd/collector/app/flags"
"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/cmd/collector/app/server"
"github.com/jaegertracing/jaeger/internal/safeexpvar"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/pkg/healthcheck"
"github.com/jaegertracing/jaeger/pkg/metrics"
Expand Down
2 changes: 1 addition & 1 deletion cmd/collector/app/server/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"google.golang.org/grpc/reflection"

"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
samplinggrpc "github.com/jaegertracing/jaeger/internal/sampling/grpc"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/telemetry"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/collector/app/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"go.uber.org/zap/zapcore"

"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
samplinghttp "github.com/jaegertracing/jaeger/internal/sampling/http"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/healthcheck"
"github.com/jaegertracing/jaeger/pkg/httpmetrics"
"github.com/jaegertracing/jaeger/pkg/metrics"
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/remotesampling/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import (
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"

"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/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive"
"github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/static"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/pdata/ptrace"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/remotesampling"
"github.com/jaegertracing/jaeger/internal/metrics/otelmetrics"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive"
"github.com/jaegertracing/jaeger/storage_v2/v1adapter"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/sampling/grpc/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package grpc
import (
"context"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/sampling/http/cfgmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package http
import (
"context"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)

Expand Down
2 changes: 1 addition & 1 deletion plugin/sampling/strategyprovider/adaptive/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"go.uber.org/zap"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/leaderelection"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
span_model "github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/pkg/hostname"
"github.com/jaegertracing/jaeger/pkg/metrics"
Expand Down
2 changes: 1 addition & 1 deletion plugin/sampling/strategyprovider/adaptive/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/spf13/viper"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/leaderelection"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/distributedlock"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin"
Expand Down
6 changes: 3 additions & 3 deletions plugin/sampling/strategyprovider/adaptive/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap"

ss "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/pkg/distributedlock"
lmocks "github.com/jaegertracing/jaeger/pkg/distributedlock/mocks"
Expand All @@ -25,8 +25,8 @@ import (
)

var (
_ ss.Factory = new(Factory)
_ plugin.Configurable = new(Factory)
_ samplingstrategy.Factory = new(Factory)
_ plugin.Configurable = new(Factory)
)

func TestFactory(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion plugin/sampling/strategyprovider/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/spf13/viper"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive"
Expand Down
8 changes: 4 additions & 4 deletions plugin/sampling/strategyprovider/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap"

ss "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/distributedlock"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin"
Expand All @@ -23,8 +23,8 @@ import (
)

var (
_ ss.Factory = new(Factory)
_ plugin.Configurable = new(Factory)
_ samplingstrategy.Factory = new(Factory)
_ plugin.Configurable = new(Factory)
)

func TestNewFactory(t *testing.T) {
Expand Down Expand Up @@ -121,7 +121,7 @@ func (f *mockFactory) InitFromViper(v *viper.Viper, logger *zap.Logger) {
f.logger = logger
}

func (f *mockFactory) CreateStrategyProvider() (ss.Provider, ss.Aggregator, error) {
func (f *mockFactory) CreateStrategyProvider() (samplingstrategy.Provider, samplingstrategy.Aggregator, error) {
if f.retError {
return nil, nil, errors.New("error creating store")
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/sampling/strategyprovider/static/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/spf13/viper"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin"
"github.com/jaegertracing/jaeger/storage"
Expand Down
6 changes: 3 additions & 3 deletions plugin/sampling/strategyprovider/static/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/zap"

ss "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/pkg/config"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin"
)

var (
_ ss.Factory = new(Factory)
_ plugin.Configurable = new(Factory)
_ samplingstrategy.Factory = new(Factory)
_ plugin.Configurable = new(Factory)
)

func TestFactory(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions plugin/sampling/strategyprovider/static/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

"go.uber.org/zap"

ss "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/internal/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/proto-gen/api_v2"
)

Expand All @@ -44,7 +44,7 @@ type storedStrategies struct {
type strategyLoader func() ([]byte, error)

// NewProvider creates a strategy store that holds static sampling strategies.
func NewProvider(options Options, logger *zap.Logger) (ss.Provider, error) {
func NewProvider(options Options, logger *zap.Logger) (samplingstrategy.Provider, error) {
ctx, cancelFunc := context.WithCancel(context.Background())
h := &samplingProvider{
logger: logger,
Expand Down

0 comments on commit d1d9ced

Please sign in to comment.