func (ss *CentralizedStrategy) start() {
	if !ss.pollerStart {
		var er error
		ss.proxy, er = newProxy(ss.daemonEndpoints)
		if er != nil {
			panic(er)
		}
		ss.startRulePoller()
		ss.startTargetPoller()
	}
	ss.pollerStart = true
}
start initiates rule and target pollers.
package sampling
import (
	crypto "crypto/rand"
	"errors"
	"fmt"
	"strings"
	"sync"
	"time"
	"github.com/aws/aws-xray-sdk-go/daemoncfg"
	"github.com/aws/aws-xray-sdk-go/internal/logger"
	"github.com/aws/aws-xray-sdk-go/internal/plugins"
	"github.com/aws/aws-xray-sdk-go/utils"
	xraySvc "github.com/aws/aws-sdk-go/service/xray"
)
type CentralizedStrategy struct {
	manifest *CentralizedManifest
	fallback *LocalizedStrategy
	proxy svcProxy
	clientID string
	clock utils.Clock
	rand utils.Rand
	pollerStart bool
	daemonEndpoints *daemoncfg.DaemonEndpoints
	mu sync.RWMutex
}
type svcProxy interface {
	GetSamplingTargets(s []*xraySvc.SamplingStatisticsDocument) (*xraySvc.GetSamplingTargetsOutput, error)
	GetSamplingRules() ([]*xraySvc.SamplingRuleRecord, error)
}
func NewCentralizedStrategy() (*CentralizedStrategy, error) {
	fb, err := NewLocalizedStrategy()
	if err != nil {
		return nil, err
	}
	return newCentralizedStrategy(fb)
}
func NewCentralizedStrategyWithJSONBytes(b []byte) (*CentralizedStrategy, error) {
	fb, err := NewLocalizedStrategyFromJSONBytes(b)
	if err != nil {
		return nil, err
	}
	return newCentralizedStrategy(fb)
}
func NewCentralizedStrategyWithFilePath(fp string) (*CentralizedStrategy, error) {
	fb, err := NewLocalizedStrategyFromFilePath(fp)
	if err != nil {
		return nil, err
	}
	return newCentralizedStrategy(fb)
}
func newCentralizedStrategy(fb *LocalizedStrategy) (*CentralizedStrategy, error) {
	var r [12]byte
	_, err := crypto.Read(r[:])
	if err != nil {
		return nil, err
	}
	id := fmt.Sprintf("%02x", r)
	clock := &utils.DefaultClock{}
	rand := &utils.DefaultRand{}
	m := &CentralizedManifest{
		Rules: []*CentralizedRule{},
		Index: map[string]*CentralizedRule{},
		clock: clock,
	}
	ss := &CentralizedStrategy{
		manifest: m,
		fallback: fb,
		clientID: id,
		clock:    clock,
		rand:     rand,
	}
	return ss, nil
}
func (ss *CentralizedStrategy) ShouldTrace(request *Request) *Decision {
	ss.mu.Lock()
	if !ss.pollerStart {
		ss.start()
	}
	ss.mu.Unlock()
	if request.ServiceType == "" {
		request.ServiceType = plugins.InstancePluginMetadata.Origin
	}
	logger.Debugf(
		"Determining ShouldTrace decision for:\n\thost: %s\n\tpath: %s\n\tmethod: %s\n\tservicename: %s\n\tservicetype: %s",
		request.Host,
		request.URL,
		request.Method,
		request.ServiceName,
		request.ServiceType,
	)
	if ss.manifest.expired() {
		logger.Debug("Centralized sampling data expired. Using fallback sampling strategy")
		return ss.fallback.ShouldTrace(request)
	}
	ss.manifest.mu.RLock()
	defer ss.manifest.mu.RUnlock()
	for _, r := range ss.manifest.Rules {
		r.mu.RLock()
		applicable := r.AppliesTo(request)
		r.mu.RUnlock()
		if !applicable {
			continue
		}
		logger.Debugf("Applicable rule: %s", r.ruleName)
		return r.Sample()
	}
	if r := ss.manifest.Default; r != nil {
		logger.Debugf("Applicable rule: %s", r.ruleName)
		return r.Sample()
	}
	logger.Debug("Centralized default sampling rule unavailable. Using fallback sampling strategy")
	return ss.fallback.ShouldTrace(request)
}