Skip to content
Open
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
28 changes: 14 additions & 14 deletions cmd/jaeger/internal/extension/remotesampling/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ var _ extension.Extension = (*rsExtension)(nil)
const defaultResourceName = "sampling_store_leader"

type rsExtension struct {
cfg *Config
telemetry component.TelemetrySettings
httpServer *http.Server
grpcServer *grpc.Server
strategyProvider samplingstrategy.Provider // TODO we should rename this to Provider, not "store"
adaptiveStore samplingstore.Store
distLock *leaderelection.DistributedElectionParticipant
shutdownWG sync.WaitGroup
cfg *Config
telemetry component.TelemetrySettings
httpServer *http.Server
grpcServer *grpc.Server
provider samplingstrategy.Provider
adaptiveStore samplingstore.Store
distLock *leaderelection.DistributedElectionParticipant
shutdownWG sync.WaitGroup
}

func newExtension(cfg *Config, telemetry component.TelemetrySettings) *rsExtension {
Expand Down Expand Up @@ -153,8 +153,8 @@ func (ext *rsExtension) Shutdown(ctx context.Context) error {
errs = append(errs, ext.distLock.Close())
}

if ext.strategyProvider != nil {
errs = append(errs, ext.strategyProvider.Close())
if ext.provider != nil {
errs = append(errs, ext.provider.Close())
}
return errors.Join(errs...)
}
Expand All @@ -173,7 +173,7 @@ func (ext *rsExtension) startFileBasedStrategyProvider(_ context.Context) error
return fmt.Errorf("failed to create the local file strategy store: %w", err)
}

ext.strategyProvider = provider
ext.provider = provider
return nil
}

Expand Down Expand Up @@ -214,7 +214,7 @@ func (ext *rsExtension) startAdaptiveStrategyProvider(host component.Host) error
if err := provider.Start(); err != nil {
return fmt.Errorf("failed to start the adaptive strategy store: %w", err)
}
ext.strategyProvider = provider
ext.provider = provider
return nil
}

Expand All @@ -223,7 +223,7 @@ func (ext *rsExtension) startHTTPServer(ctx context.Context, host component.Host
mf = mf.Namespace(metrics.NSOptions{Name: "jaeger_remote_sampling"})
handler := samplinghttp.NewHandler(samplinghttp.HandlerParams{
ConfigManager: &samplinghttp.ConfigManager{
SamplingProvider: ext.strategyProvider,
SamplingProvider: ext.provider,
},
MetricsFactory: mf,

Expand Down Expand Up @@ -270,7 +270,7 @@ func (ext *rsExtension) startGRPCServer(ctx context.Context, host component.Host
return err
}

api_v2.RegisterSamplingManagerServer(ext.grpcServer, samplinggrpc.NewHandler(ext.strategyProvider))
api_v2.RegisterSamplingManagerServer(ext.grpcServer, samplinggrpc.NewHandler(ext.provider))

healthServer := health.NewServer() // support health checks on the gRPC server
healthServer.SetServingStatus("jaeger.api_v2.SamplingManager", grpc_health_v1.HealthCheckResponse_SERVING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ func TestShutdownWithProviderError(t *testing.T) {
telemetry: componenttest.NewNopTelemetrySettings(),
}

ext.strategyProvider = &mockFailingProvider{}
ext.provider = &mockFailingProvider{}

err := ext.Shutdown(context.Background())
require.Error(t, err)
Expand Down
Loading