Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated es.max-num-spans #2482

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Changes by Version

* Remove deprecated flags `--health-check-http-port` & `--admin-http-port`, please use `--admin.http.host-port` ([#2752](https://github.com/jaegertracing/jaeger/pull/2752), [@pradeepnnv](https://github.com/pradeepnnv))

* Remove deprecated flag `--es.max-num-spans`, please use `--es.max-doc-count` ([#2482](https://github.com/jaegertracing/jaeger/pull/2482),[@BernardTolosajr](https://github.com/BernardTolosajr))

#### New Features

* Add TLS Support for GRPC and HTTP endpoints of the Query server ([#2337](https://github.com/jaegertracing/jaeger/pull/2337), [@rjs211](https://github.com/rjs211))
Expand Down
13 changes: 0 additions & 13 deletions plugin/storage/es/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package es
import (
"flag"
"fmt"
"math"
"strings"
"time"

Expand All @@ -37,7 +36,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 @@ -180,12 +178,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 "+nsConfig.namespace+".max-doc-count). "+
"The maximum number of spans to fetch at a time per query in Elasticsearch. "+
"The lesser of "+nsConfig.namespace+".max-num-spans and "+nsConfig.namespace+".max-doc-count will be used if both are set.")
flagSet.Int64(
nsConfig.namespace+suffixNumShards,
nsConfig.NumShards,
Expand Down Expand Up @@ -301,11 +293,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
31 changes: 0 additions & 31 deletions plugin/storage/es/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,45 +100,14 @@ func TestOptionsWithFlags(t *testing.T) {
assert.Equal(t, "2006.01.02", aux.IndexDateLayout)
}

func TestMaxNumSpansUsage(t *testing.T) {
testCases := []struct {
namespace string
wantUsage string
}{
{
namespace: "es",
wantUsage: "(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.",
},
{
namespace: "es-archive",
wantUsage: "(deprecated, will be removed in release v1.21.0. Please use es-archive.max-doc-count). " +
"The maximum number of spans to fetch at a time per query in Elasticsearch. " +
"The lesser of es-archive.max-num-spans and es-archive.max-doc-count will be used if both are set.",
},
}
for _, tc := range testCases {
t.Run(tc.namespace, func(t *testing.T) {
opts := NewOptions(tc.namespace)
_, command := config.Viperize(opts.AddFlags)
assert.Equal(t, tc.wantUsage, command.Flag(tc.namespace+".max-num-spans").Usage)
})
}
}

func TestMaxDocCount(t *testing.T) {
testCases := []struct {
name string
flags []string
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