diff --git a/cmd/server.go b/cmd/server.go index 358793af3..4e5d96114 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -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 } diff --git a/config.go b/config.go index d5d725ece..a0b51a503 100644 --- a/config.go +++ b/config.go @@ -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 } diff --git a/ctl/config.go b/ctl/config.go index dbac574e7..3d940aff1 100644 --- a/ctl/config.go +++ b/ctl/config.go @@ -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"