From ad01a13d52d0e6c5a3b55c330fb175c97d458cfd Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Tue, 13 Aug 2024 18:52:12 +0800 Subject: [PATCH] polish review --- cmd/esmapping-generator/app/flags.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/esmapping-generator/app/flags.go b/cmd/esmapping-generator/app/flags.go index fc69f15f77e..be4bc3deec5 100644 --- a/cmd/esmapping-generator/app/flags.go +++ b/cmd/esmapping-generator/app/flags.go @@ -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, @@ -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") @@ -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