add stats metric options to config

This commit is contained in:
Michael Baird 2017-04-19 16:51:55 -05:00
parent 8440bc8b3c
commit 20bc2396f8
3 changed files with 15 additions and 1 deletions

View file

@ -87,7 +87,9 @@ on the configured port.`,
flags.StringVarP(&Server.Config.Cluster.Type, "cluster.type", "", "static", "Determine how the cluster handles membership and state sharing. Choose from [static, http, gossip]")
flags.StringVarP(&Server.Config.Cluster.GossipSeed, "cluster.gossip-seed", "", "", "Host with which to seed the gossip membership.")
flags.StringVarP(&Server.Config.Cluster.InternalPort, "cluster.internal-port", "", "", "Port to which pilosa should bind for internal state sharing.")
flags.StringVarP(&Server.Config.Metric.Service, "metric.service", "", "noop", "Default URI on which pilosa should listen.")
flags.StringVarP(&Server.Config.Metric.Host, "metric.host", "", "", "Default URI to send metrics.")
flags.DurationVarP((*time.Duration)(&Server.Config.Metric.PollingInterval), "metric.poll-interval", "", time.Minute*0, "Polling interval metrics.")
return serveCmd
}

View file

@ -8,6 +8,7 @@ const (
DefaultPort = "10101"
DefaultClusterType = "static"
DefaultInternalPort = "14000"
DefaultMetrics = "noop"
)
// Config represents the configuration for the command.
@ -34,6 +35,12 @@ type Config struct {
} `toml:"anti-entropy"`
LogPath string `toml:"log-path"`
Metric struct {
Service string `toml:"service"`
Host string `toml:"host"`
PollingInterval Duration `toml:"interval"`
} `toml:"metrics"`
}
// NewConfig returns an instance of Config with default options.
@ -47,6 +54,7 @@ func NewConfig() *Config {
c.Cluster.Hosts = []string{}
c.Cluster.InternalHosts = []string{}
c.AntiEntropy.Interval = Duration(DefaultAntiEntropyInterval)
c.Metric.Service = DefaultMetrics
return c
}

View file

@ -37,6 +37,10 @@ bind = "localhost:10101"
[anti-entropy]
interval = "10m0s"
[metrics]
service = "statsd"
host = "127.0.0.1:8125"
[profile]
cpu = ""
cpu-time = "30s"