Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetEvalCache = func() *EvalCache { singletonEvalCacheOnce.Do(func() { ec := &EvalCache{ mapCache: make(map[string]*entity.Flag), refreshTimeout: config.Config.EvalCacheRefreshTimeout, refreshInterval: config.Config.EvalCacheRefreshInterval, } singletonEvalCache = ec }) return singletonEvalCache }
GetEvalCache gets the EvalCache
View Source
var NewKafkaRecorder = func() DataRecorder { cfg := sarama.NewConfig() tlscfg := createTLSConfiguration( config.Config.RecorderKafkaCertFile, config.Config.RecorderKafkaKeyFile, config.Config.RecorderKafkaCAFile, config.Config.RecorderKafkaVerifySSL, ) if tlscfg != nil { cfg.Net.TLS.Enable = true cfg.Net.TLS.Config = tlscfg } cfg.Producer.RequiredAcks = sarama.WaitForLocal cfg.Producer.Retry.Max = config.Config.RecorderKafkaRetryMax cfg.Producer.Flush.Frequency = config.Config.RecorderKafkaFlushFrequency cfg.Version = mustParseKafkaVersion(config.Config.RecorderKafkaVersion) brokerList := strings.Split(config.Config.RecorderKafkaBrokers, ",") producer, err := saramaNewAsyncProducer(brokerList, cfg) if err != nil { logrus.WithField("kafka_error", err).Fatal("Failed to start Sarama producer:") } if producer != nil { go func() { for err := range producer.Errors() { logrus.WithField("kafka_error", err).Error("failed to write access log entry") } }() } return &kafkaRecorder{ producer: producer, topic: config.Config.RecorderKafkaTopic, enabled: config.Config.RecorderEnabled, } }
NewKafkaRecorder creates a new Kafka recorder
View Source
var NewKinesisRecorder = func() DataRecorder { client := kinesis.New(session.New(aws.NewConfig())) p := newKinesisProducer(&producer.Config{ StreamName: config.Config.RecorderKinesisStreamName, Client: client, BacklogCount: config.Config.RecorderKinesisBacklogCount, MaxConnections: config.Config.RecorderKinesisMaxConnections, FlushInterval: config.Config.RecorderKinesisFlushInterval, BatchSize: config.Config.RecorderKinesisBatchSize, BatchCount: config.Config.RecorderKinesisBatchCount, AggregateBatchCount: config.Config.RecorderKinesisAggregateBatchCount, AggregateBatchSize: config.Config.RecorderKinesisAggregateBatchSize, Verbose: config.Config.RecorderKinesisVerbose, Logger: logrus.WithField("producer", "kinesis"), }) p.Start() go func() { for err := range p.NotifyFailures() { logrus.WithField("kinesis_error", err).Error("error pushing to kinesis") } }() return &kinesisRecorder{ producer: p, enabled: config.Config.RecorderEnabled, } }
NewKinesisRecorder creates a new Kinesis recorder
View Source
var NewPubsubRecorder = func() DataRecorder { client, err := pubsubClient() if err != nil { logrus.WithField("pubsub_error", err).Fatal("error getting pubsub client") } return &pubsubRecorder{ producer: client, topic: client.Topic(config.Config.RecorderPubsubTopicName), } }
NewPubsubRecorder creates a new Pubsub recorder
Functions ¶
func BlankResult ¶
func BlankResult(f *entity.Flag, evalContext models.EvalContext, msg string) *models.EvalResult
BlankResult creates a blank result
func ErrorMessage ¶
ErrorMessage generates error messages
Types ¶
type CRUD ¶
type CRUD interface { // Flags FindFlags(flag.FindFlagsParams) middleware.Responder CreateFlag(flag.CreateFlagParams) middleware.Responder GetFlag(flag.GetFlagParams) middleware.Responder PutFlag(flag.PutFlagParams) middleware.Responder DeleteFlag(flag.DeleteFlagParams) middleware.Responder SetFlagEnabledState(flag.SetFlagEnabledParams) middleware.Responder GetFlagSnapshots(params flag.GetFlagSnapshotsParams) middleware.Responder GetFlagEntityTypes(params flag.GetFlagEntityTypesParams) middleware.Responder // Segments CreateSegment(segment.CreateSegmentParams) middleware.Responder FindSegments(segment.FindSegmentsParams) middleware.Responder PutSegment(segment.PutSegmentParams) middleware.Responder DeleteSegment(segment.DeleteSegmentParams) middleware.Responder PutSegmentsReorder(segment.PutSegmentsReorderParams) middleware.Responder // Constraints CreateConstraint(constraint.CreateConstraintParams) middleware.Responder FindConstraints(constraint.FindConstraintsParams) middleware.Responder PutConstraint(params constraint.PutConstraintParams) middleware.Responder DeleteConstraint(params constraint.DeleteConstraintParams) middleware.Responder // Distributions FindDistributions(distribution.FindDistributionsParams) middleware.Responder PutDistributions(distribution.PutDistributionsParams) middleware.Responder // Variants CreateVariant(variant.CreateVariantParams) middleware.Responder FindVariants(variant.FindVariantsParams) middleware.Responder PutVariant(variant.PutVariantParams) middleware.Responder DeleteVariant(variant.DeleteVariantParams) middleware.Responder }
CRUD is the CRUD interface
type DataRecorder ¶
type DataRecorder interface {
AsyncRecord(*models.EvalResult)
}
DataRecorder can record and produce the evaluation result
type Eval ¶
type Eval interface { PostEvaluation(evaluation.PostEvaluationParams) middleware.Responder PostEvaluationBatch(evaluation.PostEvaluationBatchParams) middleware.Responder }
Eval is the Eval interface
type EvalCache ¶
type EvalCache struct {
// contains filtered or unexported fields
}
EvalCache is the in-memory cache just for evaluation
func GenFixtureEvalCache ¶
func GenFixtureEvalCache() *EvalCache
GenFixtureEvalCache generates a fixture
func (*EvalCache) GetByFlagKeyOrID ¶
GetByFlagKeyOrID gets the flag by Key or ID
Click to show internal directories.
Click to hide internal directories.