Skip to content

Commit

Permalink
add check-config flag
Browse files Browse the repository at this point in the history
Signed-off-by: glightfoot <glightfoot@rsglab.com>
  • Loading branch information
glightfoot committed Feb 7, 2021
1 parent f20b87a commit 90bfd24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/graphite_exporter/main.go
Expand Up @@ -45,6 +45,7 @@ var (
cacheSize = kingpin.Flag("graphite.cache-size", "Maximum size of your metric mapping cache. Relies on least recently used replacement policy if max size is reached.").Default("1000").Int()
cacheType = kingpin.Flag("graphite.cache-type", "Metric mapping cache type. Valid options are \"lru\" and \"random\"").Default("lru").Enum("lru", "random")
dumpFSMPath = kingpin.Flag("debug.dump-fsm", "The path to dump internal FSM generated for glob matching as Dot file.").Default("").String()
checkConfig = kingpin.Flag("check-config", "Check configuration and exit.").Default("false").Bool()
)

func init() {
Expand Down Expand Up @@ -96,6 +97,11 @@ func main() {
metricMapper.InitCache(*cacheSize, cacheOption)
}

if *checkConfig {
level.Info(logger).Log("msg", "Configuration check successful, exiting")
return
}

if *dumpFSMPath != "" {
err := dumpFSM(metricMapper, *dumpFSMPath, logger)
if err != nil {
Expand Down

0 comments on commit 90bfd24

Please sign in to comment.