Skip to content

Commit

Permalink
Merge pull request #235 from checkr/zz/add-global-switch-of-eval-debug
Browse files Browse the repository at this point in the history
Add EvalDebugEnabled env variable
  • Loading branch information
zhouzhuojie authored Mar 11, 2019
2 parents 57fe2c4 + ec943b2 commit 82dcc45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/config/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ var Config = struct {
EvalCacheRefreshTimeout time.Duration `env:"FLAGR_EVALCACHE_REFRESHTIMEOUT" envDefault:"59s"`
// EvalCacheRefreshInterval - time interval of getting the flags data from DB into the in-memory evaluation cache
EvalCacheRefreshInterval time.Duration `env:"FLAGR_EVALCACHE_REFRESHINTERVAL" envDefault:"3s"`
// EvalEnableDebug - controls if we want to return evaluation debugging information back to the api requests
// Note that this is a global switch:
// if it's disabled, no evaluation debug info will be returned.
// if it's enabled, it respects evaluation request's enableDebug field
EvalDebugEnabled bool `env:"FLAGR_EVAL_DEBUG_ENABLED" envDefault:"true"`

// DBDriver - Flagr supports sqlite3, mysql, postgres
DBDriver string `env:"FLAGR_DB_DBDRIVER" envDefault:"sqlite3"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/handler/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ var evalFlag = func(evalContext models.EvalContext) *models.EvalResult {
for _, segment := range f.Segments {
sID = util.Int64Ptr(int64(segment.ID))
variantID, log, evalNextSegment := evalSegment(f.ID, evalContext, segment)
if evalContext.EnableDebug {
if config.Config.EvalDebugEnabled && evalContext.EnableDebug {
logs = append(logs, log)
}
if variantID != nil {
Expand Down

0 comments on commit 82dcc45

Please sign in to comment.