@@ -44,10 +44,17 @@ import (
44
44
storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics"
45
45
)
46
46
47
+ type TemplateOptions struct {
48
+ Priority int64 `mapstructure:"priority"`
49
+ NumShards int64 `mapstructure:"num_shards"`
50
+ NumReplicas int64 `mapstructure:"num_replicas"`
51
+ }
52
+
47
53
// IndexOptions describes the index format and rollover frequency
48
54
type IndexOptions struct {
49
- DateLayout string `mapstructure:"date_layout"`
50
- RolloverFrequency string `mapstructure:"rollover_frequency"`
55
+ DateLayout string `mapstructure:"date_layout"`
56
+ RolloverFrequency string `mapstructure:"rollover_frequency"`
57
+ TemplateOptions TemplateOptions `mapstructure:"template"`
51
58
}
52
59
53
60
// Indices describes different configuration options for each index type
@@ -60,40 +67,35 @@ type Indices struct {
60
67
61
68
// Configuration describes the configuration properties needed to connect to an ElasticSearch cluster
62
69
type Configuration struct {
63
- Servers []string `mapstructure:"server_urls" valid:"required,url"`
64
- RemoteReadClusters []string `mapstructure:"remote_read_clusters"`
65
- Username string `mapstructure:"username"`
66
- Password string `mapstructure:"password" json:"-"`
67
- TokenFilePath string `mapstructure:"token_file"`
68
- PasswordFilePath string `mapstructure:"password_file"`
69
- AllowTokenFromContext bool `mapstructure:"-"`
70
- Sniffer bool `mapstructure:"sniffer"` // https://github.com/olivere/elastic/wiki/Sniffing
71
- SnifferTLSEnabled bool `mapstructure:"sniffer_tls_enabled"`
72
- MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query
73
- MaxSpanAge time.Duration `mapstructure:"-"` // configures the maximum lookback on span reads
74
- NumShards int64 `mapstructure:"num_shards"`
75
- NumReplicas int64 `mapstructure:"num_replicas"`
76
- PrioritySpanTemplate int64 `mapstructure:"priority_span_template"`
77
- PriorityServiceTemplate int64 `mapstructure:"priority_service_template"`
78
- PriorityDependenciesTemplate int64 `mapstructure:"priority_dependencies_template"`
79
- Timeout time.Duration `mapstructure:"-"`
80
- BulkSize int `mapstructure:"-"`
81
- BulkWorkers int `mapstructure:"-"`
82
- BulkActions int `mapstructure:"-"`
83
- BulkFlushInterval time.Duration `mapstructure:"-"`
84
- IndexPrefix string `mapstructure:"index_prefix"`
85
- Indices Indices `mapstructure:"indices"`
86
- ServiceCacheTTL time.Duration `mapstructure:"service_cache_ttl"`
87
- AdaptiveSamplingLookback time.Duration `mapstructure:"-"`
88
- Tags TagsAsFields `mapstructure:"tags_as_fields"`
89
- Enabled bool `mapstructure:"-"`
90
- TLS tlscfg.Options `mapstructure:"tls"`
91
- UseReadWriteAliases bool `mapstructure:"use_aliases"`
92
- CreateIndexTemplates bool `mapstructure:"create_mappings"`
93
- UseILM bool `mapstructure:"use_ilm"`
94
- Version uint `mapstructure:"version"`
95
- LogLevel string `mapstructure:"log_level"`
96
- SendGetBodyAs string `mapstructure:"send_get_body_as"`
70
+ Servers []string `mapstructure:"server_urls" valid:"required,url"`
71
+ RemoteReadClusters []string `mapstructure:"remote_read_clusters"`
72
+ Username string `mapstructure:"username"`
73
+ Password string `mapstructure:"password" json:"-"`
74
+ TokenFilePath string `mapstructure:"token_file"`
75
+ PasswordFilePath string `mapstructure:"password_file"`
76
+ AllowTokenFromContext bool `mapstructure:"-"`
77
+ Sniffer bool `mapstructure:"sniffer"` // https://github.com/olivere/elastic/wiki/Sniffing
78
+ SnifferTLSEnabled bool `mapstructure:"sniffer_tls_enabled"`
79
+ MaxDocCount int `mapstructure:"-"` // Defines maximum number of results to fetch from storage per query
80
+ MaxSpanAge time.Duration `mapstructure:"-"` // configures the maximum lookback on span reads
81
+ Timeout time.Duration `mapstructure:"-"`
82
+ BulkSize int `mapstructure:"-"`
83
+ BulkWorkers int `mapstructure:"-"`
84
+ BulkActions int `mapstructure:"-"`
85
+ BulkFlushInterval time.Duration `mapstructure:"-"`
86
+ IndexPrefix string `mapstructure:"index_prefix"`
87
+ Indices Indices `mapstructure:"indices"`
88
+ ServiceCacheTTL time.Duration `mapstructure:"service_cache_ttl"`
89
+ AdaptiveSamplingLookback time.Duration `mapstructure:"-"`
90
+ Tags TagsAsFields `mapstructure:"tags_as_fields"`
91
+ Enabled bool `mapstructure:"-"`
92
+ TLS tlscfg.Options `mapstructure:"tls"`
93
+ UseReadWriteAliases bool `mapstructure:"use_aliases"`
94
+ CreateIndexTemplates bool `mapstructure:"create_mappings"`
95
+ UseILM bool `mapstructure:"use_ilm"`
96
+ Version uint `mapstructure:"version"`
97
+ LogLevel string `mapstructure:"log_level"`
98
+ SendGetBodyAs string `mapstructure:"send_get_body_as"`
97
99
}
98
100
99
101
// TagsAsFields holds configuration for tag schema.
@@ -246,20 +248,20 @@ func (c *Configuration) ApplyDefaults(source *Configuration) {
246
248
if c .AdaptiveSamplingLookback == 0 {
247
249
c .AdaptiveSamplingLookback = source .AdaptiveSamplingLookback
248
250
}
249
- if c .NumShards == 0 {
250
- c .NumShards = source .NumShards
251
+ if c .Indices . Dependencies . TemplateOptions . NumShards == 0 {
252
+ c .Indices . Dependencies . TemplateOptions . NumShards = source . Indices . Dependencies . TemplateOptions .NumShards
251
253
}
252
- if c .NumReplicas == 0 {
253
- c .NumReplicas = source .NumReplicas
254
+ if c .Indices . Dependencies . TemplateOptions . NumReplicas == 0 {
255
+ c .Indices . Dependencies . TemplateOptions . NumReplicas = source . Indices . Dependencies . TemplateOptions .NumReplicas
254
256
}
255
- if c .PrioritySpanTemplate == 0 {
256
- c .PrioritySpanTemplate = source .PrioritySpanTemplate
257
+ if c .Indices . Spans . TemplateOptions . Priority == 0 {
258
+ c .Indices . Spans . TemplateOptions . Priority = source .Indices . Spans . TemplateOptions . Priority
257
259
}
258
- if c .PriorityServiceTemplate == 0 {
259
- c .PriorityServiceTemplate = source .PriorityServiceTemplate
260
+ if c .Indices . Services . TemplateOptions . Priority == 0 {
261
+ c .Indices . Services . TemplateOptions . Priority = source .Indices . Services . TemplateOptions . Priority
260
262
}
261
- if c .PrioritySpanTemplate == 0 {
262
- c .PriorityDependenciesTemplate = source .PriorityDependenciesTemplate
263
+ if c .Indices . Dependencies . TemplateOptions . Priority == 0 {
264
+ c .Indices . Dependencies . TemplateOptions . Priority = source .Indices . Dependencies . TemplateOptions . Priority
263
265
}
264
266
if c .BulkSize == 0 {
265
267
c .BulkSize = source .BulkSize
0 commit comments