Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Make command-line arguments namespaced and consistent
Browse files Browse the repository at this point in the history
This changes the command-line args to use a dot-separated namespace
prefix to be consistent with common practices in other projects
and dependencies.
  • Loading branch information
erimatnor committed Mar 19, 2018
1 parent 511e8d5 commit b0b911e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func parseFlags() *config {

pgprometheus.ParseFlags(&cfg.pgPrometheusConfig)

flag.DurationVar(&cfg.remoteTimeout, "send-timeout", 30*time.Second, "The timeout to use when sending samples to the remote storage.")
flag.DurationVar(&cfg.remoteTimeout, "adapter.send-timeout", 30*time.Second, "The timeout to use when sending samples to the remote storage.")
flag.StringVar(&cfg.listenAddr, "web.listen-address", ":9201", "Address to listen on for web endpoints.")
flag.StringVar(&cfg.telemetryPath, "web.telemetry-path", "/metrics", "Address to listen on for web endpoints.")
flag.StringVar(&cfg.logLevel, "log.level", "debug", "The log level to use [ \"error\", \"warn\", \"info\", \"debug\" ].")
Expand Down
30 changes: 15 additions & 15 deletions postgresql/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ type Config struct {

// ParseFlags parses the configuration flags specific to PostgreSQL and TimescaleDB
func ParseFlags(cfg *Config) *Config {
flag.StringVar(&cfg.host, "pg-host", "localhost", "The PostgreSQL host")
flag.IntVar(&cfg.port, "pg-port", 5432, "The PostgreSQL port")
flag.StringVar(&cfg.user, "pg-user", "postgres", "The PostgreSQL user")
flag.StringVar(&cfg.password, "pg-password", "", "The PostgreSQL password")
flag.StringVar(&cfg.database, "pg-database", "postgres", "The PostgreSQL database")
flag.StringVar(&cfg.schema, "pg-schema", "", "The PostgreSQL schema")
flag.StringVar(&cfg.sslMode, "pg-ssl-mode", "disable", "The PostgreSQL connection ssl mode")
flag.StringVar(&cfg.table, "pg-table", "metrics", "The PostgreSQL table")
flag.StringVar(&cfg.copyTable, "pg-copy-table", "metrics_copy", "The PostgreSQL table")
flag.IntVar(&cfg.maxOpenConns, "pg-max-open-conns", 50, "The max number of open connections to the database")
flag.IntVar(&cfg.maxIdleConns, "pg-max-idle-conns", 10, "The max number of idle connections to the database")
flag.BoolVar(&cfg.pgPrometheusNormalize, "pg-prometheus-normalized-schema", true, "Insert metric samples into normalized schema")
flag.BoolVar(&cfg.pgPrometheusLogSamples, "pg-prometheus-log-samples", false, "Log raw samples to stdout")
flag.DurationVar(&cfg.pgPrometheusChunkInterval, "pg-prometheus-chunk-interval", time.Hour*12, "The size of a time-partition chunk in TimescaleDB")
flag.BoolVar(&cfg.useTimescaleDb, "pg-use-timescaledb", true, "Use timescaleDB")
flag.StringVar(&cfg.host, "pg.host", "localhost", "The PostgreSQL host")
flag.IntVar(&cfg.port, "pg.port", 5432, "The PostgreSQL port")
flag.StringVar(&cfg.user, "pg.user", "postgres", "The PostgreSQL user")
flag.StringVar(&cfg.password, "pg.password", "", "The PostgreSQL password")
flag.StringVar(&cfg.database, "pg.database", "postgres", "The PostgreSQL database")
flag.StringVar(&cfg.schema, "pg.schema", "", "The PostgreSQL schema")
flag.StringVar(&cfg.sslMode, "pg.ssl-mode", "disable", "The PostgreSQL connection ssl mode")
flag.StringVar(&cfg.table, "pg.table", "metrics", "The PostgreSQL table")
flag.StringVar(&cfg.copyTable, "pg.copy-table", "metrics_copy", "The PostgreSQL table")
flag.IntVar(&cfg.maxOpenConns, "pg.max-open-conns", 50, "The max number of open connections to the database")
flag.IntVar(&cfg.maxIdleConns, "pg.max-idle-conns", 10, "The max number of idle connections to the database")
flag.BoolVar(&cfg.pgPrometheusNormalize, "pg.prometheus-normalized-schema", true, "Insert metric samples into normalized schema")
flag.BoolVar(&cfg.pgPrometheusLogSamples, "pg.prometheus-log-samples", false, "Log raw samples to stdout")
flag.DurationVar(&cfg.pgPrometheusChunkInterval, "pg.prometheus-chunk-interval", time.Hour*12, "The size of a time-partition chunk in TimescaleDB")
flag.BoolVar(&cfg.useTimescaleDb, "pg.use-timescaledb", true, "Use timescaleDB")
return cfg
}

Expand Down

0 comments on commit b0b911e

Please sign in to comment.