MCPcopy Create free account
hub / github.com/cortexproject/cortex / RegisterFlags

Method RegisterFlags

pkg/cortex/cortex.go:138–185  ·  view source on GitHub ↗

RegisterFlags registers flag.

(f *flag.FlagSet)

Source from the content-addressed store, hash-verified

136
137// RegisterFlags registers flag.
138func (c *Config) RegisterFlags(f *flag.FlagSet) {
139 c.Server.MetricsNamespace = "cortex"
140 c.Server.ExcludeRequestInLog = true
141 c.Server.MetricsNativeHistogramFactor = 1.1
142
143 // Set the default module list to 'all'
144 c.Target = []string{All}
145
146 f.Var(&c.Target, "target", "Comma-separated list of Cortex modules to load. "+
147 "The alias 'all' can be used in the list to load a number of core modules and will enable single-binary mode. "+
148 "Use '-modules' command line flag to get a list of available modules, and to see which modules are included in 'all'.")
149
150 f.BoolVar(&c.AuthEnabled, "auth.enabled", true, "Set to false to disable auth.")
151 _ = c.NameValidationScheme.Set(model.LegacyValidation.String())
152 f.Var(&c.NameValidationScheme, "name-validation-scheme", fmt.Sprintf("Name validation scheme for metric names and label names, Support values are: %s.", strings.Join([]string{model.LegacyValidation.String(), model.UTF8Validation.String()}, ", ")))
153 f.BoolVar(&c.PrintConfig, "print.config", false, "Print the config and exit.")
154 f.StringVar(&c.HTTPPrefix, "http.prefix", "/api/prom", "HTTP path prefix for Cortex API.")
155
156 c.API.RegisterFlags(f)
157 c.registerServerFlagsWithChangedDefaultValues(f)
158 c.Distributor.RegisterFlags(f)
159 c.Querier.RegisterFlags(f)
160 c.IngesterClient.RegisterFlags(f)
161 c.Ingester.RegisterFlags(f)
162 c.Flusher.RegisterFlags(f)
163 c.Storage.RegisterFlags(f)
164 c.LimitsConfig.RegisterFlags(f)
165 c.Prealloc.RegisterFlags(f)
166 c.Worker.RegisterFlags(f)
167 c.Frontend.RegisterFlags(f)
168 c.QueryRange.RegisterFlags(f)
169 c.BlocksStorage.RegisterFlags(f)
170 c.Compactor.RegisterFlags(f)
171 c.ParquetConverter.RegisterFlags(f)
172 c.StoreGateway.RegisterFlags(f)
173 c.TenantFederation.RegisterFlags(f)
174 c.ResourceMonitor.RegisterFlags(f)
175
176 c.Ruler.RegisterFlags(f)
177 c.RulerStorage.RegisterFlags(f)
178 c.Configs.RegisterFlags(f)
179 c.Alertmanager.RegisterFlags(f)
180 c.AlertmanagerStorage.RegisterFlags(f)
181 c.RuntimeConfig.RegisterFlags(f)
182 c.MemberlistKV.RegisterFlags(f)
183 c.QueryScheduler.RegisterFlags(f)
184 c.Tracing.RegisterFlags(f)
185}
186
187// Validate the cortex config and returns an error if the validation
188// doesn't pass

Callers 2

newDefaultConfigFunction · 0.95
TestFlagDefaultsFunction · 0.95

Calls 5

JoinMethod · 0.80
SetMethod · 0.65
StringMethod · 0.65
RegisterFlagsMethod · 0.65

Tested by 1

TestFlagDefaultsFunction · 0.76