Skip to content

Commit

Permalink
Merge branch 'master' into remove-jaeger.tags-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro committed Feb 1, 2021
2 parents 1be7051 + 9e5acac commit 59cd913
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 44 deletions.
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))

* Remove deprecated flag `--jaeger.tags`, please use `--agent.tags` ([#2753](https://github.com/jaegertracing/jaeger/pull/2753), [@yurishkuro](https://github.com/yurishkuro))

#### New Features
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

0 comments on commit 59cd913

Please sign in to comment.