Skip to content

Commit

Permalink
polish review
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredTan95 committed Aug 13, 2024
1 parent 54e2590 commit ad01a13
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cmd/esmapping-generator/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const (

// AddFlags adds flags for esmapping-generator main program
func (o *Options) AddFlags(command *cobra.Command) {
var deprecatedNumShards, deprecatedReplicaShards int64
var deprecatedOptions config.IndexOptions
command.Flags().StringVar(
&o.Mapping,
mappingFlag,
Expand All @@ -56,12 +56,12 @@ func (o *Options) AddFlags(command *cobra.Command) {
7,
"The major Elasticsearch version")
command.Flags().Int64Var(
&deprecatedNumShards,
&deprecatedOptions.TemplateNumShards,
shardsFlag,
5,
"(deprecated, will be replaced with num-shards-span,num-shards-service,num-shards-sampling,num-shards-dependencies, if .num-shards set, it will be used as global settings for span,service,sampling,dependencies index) The number of shards per index in Elasticsearch")
command.Flags().Int64Var(
&deprecatedReplicaShards,
&deprecatedOptions.TemplateNumReplicas,
replicasFlag,
1,
"(deprecated, will be replaced with num-replicas-span,num-replicas-service,num-replicas-sampling,num-replicas-dependencies, if .num-replicas set, it will be used as global settings for span,service,sampling,dependencies index) The number of replicas per index in Elasticsearch")
Expand Down Expand Up @@ -122,20 +122,20 @@ func (o *Options) AddFlags(command *cobra.Command) {
"jaeger-ilm-policy",
"The name of the ILM policy to use if ILM is active")

if deprecatedNumShards > 0 {
if deprecatedOptions.TemplateNumShards > 0 {
log.Printf("using deprecated %s", shardsFlag)
o.Indices.Spans.TemplateNumShards = deprecatedNumShards
o.Indices.Services.TemplateNumShards = deprecatedNumShards
o.Indices.Dependencies.TemplateNumShards = deprecatedNumShards
o.Indices.Sampling.TemplateNumShards = deprecatedNumShards
o.Indices.Spans.TemplateNumShards = deprecatedOptions.TemplateNumShards
o.Indices.Services.TemplateNumShards = deprecatedOptions.TemplateNumShards
o.Indices.Dependencies.TemplateNumShards = deprecatedOptions.TemplateNumShards
o.Indices.Sampling.TemplateNumShards = deprecatedOptions.TemplateNumShards
}

if deprecatedReplicaShards > 0 {
if deprecatedOptions.TemplateNumReplicas > 0 {
log.Printf("using deprecated %s", replicasFlag)
o.Indices.Spans.TemplateNumReplicas = deprecatedReplicaShards
o.Indices.Services.TemplateNumReplicas = deprecatedReplicaShards
o.Indices.Dependencies.TemplateNumReplicas = deprecatedReplicaShards
o.Indices.Sampling.TemplateNumReplicas = deprecatedReplicaShards
o.Indices.Spans.TemplateNumReplicas = deprecatedOptions.TemplateNumReplicas
o.Indices.Services.TemplateNumReplicas = deprecatedOptions.TemplateNumReplicas
o.Indices.Dependencies.TemplateNumReplicas = deprecatedOptions.TemplateNumReplicas
o.Indices.Sampling.TemplateNumReplicas = deprecatedOptions.TemplateNumReplicas
}

// mark mapping flag as mandatory
Expand Down

0 comments on commit ad01a13

Please sign in to comment.