Skip to content

Commit 82dcc45

Browse files
authored
Merge pull request #235 from checkr/zz/add-global-switch-of-eval-debug
Add EvalDebugEnabled env variable
2 parents 57fe2c4 + ec943b2 commit 82dcc45

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/config/env.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ var Config = struct {
3030
EvalCacheRefreshTimeout time.Duration `env:"FLAGR_EVALCACHE_REFRESHTIMEOUT" envDefault:"59s"`
3131
// EvalCacheRefreshInterval - time interval of getting the flags data from DB into the in-memory evaluation cache
3232
EvalCacheRefreshInterval time.Duration `env:"FLAGR_EVALCACHE_REFRESHINTERVAL" envDefault:"3s"`
33+
// EvalEnableDebug - controls if we want to return evaluation debugging information back to the api requests
34+
// Note that this is a global switch:
35+
// if it's disabled, no evaluation debug info will be returned.
36+
// if it's enabled, it respects evaluation request's enableDebug field
37+
EvalDebugEnabled bool `env:"FLAGR_EVAL_DEBUG_ENABLED" envDefault:"true"`
3338

3439
// DBDriver - Flagr supports sqlite3, mysql, postgres
3540
DBDriver string `env:"FLAGR_DB_DBDRIVER" envDefault:"sqlite3"`

pkg/handler/eval.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ var evalFlag = func(evalContext models.EvalContext) *models.EvalResult {
144144
for _, segment := range f.Segments {
145145
sID = util.Int64Ptr(int64(segment.ID))
146146
variantID, log, evalNextSegment := evalSegment(f.ID, evalContext, segment)
147-
if evalContext.EnableDebug {
147+
if config.Config.EvalDebugEnabled && evalContext.EnableDebug {
148148
logs = append(logs, log)
149149
}
150150
if variantID != nil {

0 commit comments

Comments
 (0)