From c7af4480d5e6777ebf971d21b61921e84ae91b60 Mon Sep 17 00:00:00 2001 From: albertteoh Date: Sat, 5 Sep 2020 07:45:02 +1000 Subject: [PATCH] Address review comments --- CHANGELOG.md | 14 ++++++++++++++ plugin/storage/es/options.go | 14 ++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d85e1a64dc62..e7ffde30491b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,20 @@ Changes by Version ### Backend Changes #### Breaking Changes +* Configurable ES doc count ([#2453](https://github.com/jaegertracing/jaeger/pull/2453), [@albertteoh](https://github.com/albertteoh)) + + The `--es.max-num-spans` flag has been deprecated in favour of `--es.max-doc-count`. + `--es.max-num-spans` is marked for removal in v1.21.0 as indicated in the flag description. + + If both `--es.max-num-spans` and `--es.max-doc-count` are set, the lesser of the two will be used. + + The use of `--es.max-doc-count` (which defaults to 10,000) will limit the results from all Elasticsearch + queries by the configured value, limiting counts for Jaeger UI: + + * Services + * Operations + * Dependencies (edges in a dependency graph) + * Span fetch size for a trace #### New Features diff --git a/plugin/storage/es/options.go b/plugin/storage/es/options.go index 3bfafee8f481..06da56a3d8f5 100644 --- a/plugin/storage/es/options.go +++ b/plugin/storage/es/options.go @@ -179,7 +179,9 @@ func addFlags(flagSet *flag.FlagSet, nsConfig *namespaceConfig) { flagSet.Int( nsConfig.namespace+suffixMaxNumSpans, nsConfig.MaxDocCount, - "(deprecated, will be removed in release v1.21.0. Please use es.max-doc-count). The maximum number of spans to fetch at a time per query in Elasticsearch") + "(deprecated, will be removed in release v1.21.0. Please use es.max-doc-count). "+ + "The maximum number of spans to fetch at a time per query in Elasticsearch. "+ + "The lesser of es.max-num-spans and es.max-doc-count will be used if both are set.") flagSet.Int64( nsConfig.namespace+suffixNumShards, nsConfig.NumShards, @@ -288,15 +290,11 @@ func initFromViper(cfg *namespaceConfig, v *viper.Viper) { cfg.CreateIndexTemplates = v.GetBool(cfg.namespace + suffixCreateIndexTemplate) cfg.Version = uint(v.GetInt(cfg.namespace + suffixVersion)) - maxNumSpans := v.GetInt(cfg.namespace + suffixMaxNumSpans) cfg.MaxDocCount = v.GetInt(cfg.namespace + suffixMaxDocCount) - if maxNumSpans != 0 { - if cfg.MaxDocCount != 0 { - cfg.MaxDocCount = int(math.Min(float64(maxNumSpans), float64(cfg.MaxDocCount))) - } else { - cfg.MaxDocCount = maxNumSpans - } + if v.IsSet(cfg.namespace + suffixMaxNumSpans) { + maxNumSpans := v.GetInt(cfg.namespace + suffixMaxNumSpans) + cfg.MaxDocCount = int(math.Min(float64(maxNumSpans), float64(cfg.MaxDocCount))) } // TODO: Need to figure out a better way for do this.