diff --git a/pkg/app/carbonapi/http_handlers.go b/pkg/app/carbonapi/http_handlers.go index 2a19fb3f..5810d760 100644 --- a/pkg/app/carbonapi/http_handlers.go +++ b/pkg/app/carbonapi/http_handlers.go @@ -160,7 +160,7 @@ func (app *App) renderHandler(w http.ResponseWriter, r *http.Request, lg *zap.Lo defer func() { //2xx response code is treated as success if toLog.HttpCode/100 == 2 { - if toLog.TotalMetricCount < int64(app.config.ResolveGlobs) { + if toLog.TotalMetricCount < int64(app.config.SimpleRequestThreshold) { app.ms.RenderDurationExpSimple.Observe(time.Since(t0).Seconds()) app.ms.RenderDurationLinSimple.Observe(time.Since(t0).Seconds()) } else { @@ -901,7 +901,7 @@ func (app *App) findHandler(w http.ResponseWriter, r *http.Request, lg *zap.Logg logLevel := zap.InfoLevel defer func() { if toLog.HttpCode/100 == 2 { - if toLog.TotalMetricCount < int64(app.config.ResolveGlobs) { + if toLog.TotalMetricCount < int64(app.config.SimpleRequestThreshold) { app.ms.FindDurationLinSimple.Observe(time.Since(t0).Seconds()) } else { app.ms.FindDurationLinComplex.Observe(time.Since(t0).Seconds()) diff --git a/pkg/cfg/api.go b/pkg/cfg/api.go index 2e4b00e9..229776c2 100644 --- a/pkg/cfg/api.go +++ b/pkg/cfg/api.go @@ -89,6 +89,8 @@ func DefaultAPIConfig() API { BucketsNum: 10, BucketSize: 2, }, + + SimpleRequestThreshold: 1000, } cfg.Listen = ":8081" @@ -164,6 +166,8 @@ type API struct { EmbedZipper bool `yaml:"embedZipper"` // ZipperConfig represents the config for the embedded zipper. ZipperConfig string `yaml:"zipperConfig"` + + SimpleRequestThreshold int `yaml:"simpleRequestThreshold"` } // CacheConfig configs the cache