Skip to content

Commit

Permalink
Remove deprecated es.max-num-spans
Browse files Browse the repository at this point in the history
Signed-off-by: Bernard Tolosa <[email protected]>
  • Loading branch information
BernardTolosajr committed Sep 18, 2020
1 parent 0c3eb68 commit 0932061
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
13 changes: 0 additions & 13 deletions plugin/storage/es/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package es

import (
"flag"
"math"
"strings"
"time"

Expand All @@ -36,7 +35,6 @@ const (
suffixTokenPath = ".token-file"
suffixServerURLs = ".server-urls"
suffixMaxSpanAge = ".max-span-age"
suffixMaxNumSpans = ".max-num-spans" // deprecated
suffixNumShards = ".num-shards"
suffixNumReplicas = ".num-replicas"
suffixBulkSize = ".bulk.size"
Expand Down Expand Up @@ -176,12 +174,6 @@ func addFlags(flagSet *flag.FlagSet, nsConfig *namespaceConfig) {
nsConfig.namespace+suffixMaxSpanAge,
nsConfig.MaxSpanAge,
"The maximum lookback for spans in Elasticsearch")
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. "+
"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,
Expand Down Expand Up @@ -292,11 +284,6 @@ func initFromViper(cfg *namespaceConfig, v *viper.Viper) {

cfg.MaxDocCount = v.GetInt(cfg.namespace + suffixMaxDocCount)

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.
cfg.AllowTokenFromContext = v.GetBool(spanstore.StoragePropagationKey)
cfg.TLS = cfg.getTLSFlagsConfig().InitFromViper(v)
Expand Down
4 changes: 0 additions & 4 deletions plugin/storage/es/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ func TestMaxDocCount(t *testing.T) {
wantMaxDocCount int
}{
{"neither defined", []string{}, 10_000},
{"max-num-spans only", []string{"--es.max-num-spans=1000"}, 1000},
{"max-doc-count only", []string{"--es.max-doc-count=1000"}, 1000},
{"max-num-spans == max-doc-count", []string{"--es.max-num-spans=1000", "--es.max-doc-count=1000"}, 1000},
{"max-num-spans < max-doc-count", []string{"--es.max-num-spans=999", "--es.max-doc-count=1000"}, 999},
{"max-num-spans > max-doc-count", []string{"--es.max-num-spans=1000", "--es.max-doc-count=999"}, 999},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
Expand Down

0 comments on commit 0932061

Please sign in to comment.