From 5413597998f87f209f6016b6669d8c58c195bac2 Mon Sep 17 00:00:00 2001 From: Alan Bernstein Date: Mon, 24 Apr 2017 15:20:08 -0500 Subject: [PATCH] Move LongQueryTime option to cluster section of config file --- config.go | 6 +++--- handler.go | 1 + server/server.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config.go b/config.go index b0c0b9ee5..dcceb370e 100644 --- a/config.go +++ b/config.go @@ -13,9 +13,8 @@ const ( // Config represents the configuration for the command. type Config struct { - DataDir string `toml:"data-dir"` - Host string `toml:"host"` - LongQueryTime Duration `toml:"long-query-time"` + DataDir string `toml:"data-dir"` + Host string `toml:"host"` Cluster struct { ReplicaN int `toml:"replicas"` @@ -25,6 +24,7 @@ type Config struct { PollingInterval Duration `toml:"polling-interval"` InternalPort string `toml:"internal-port"` GossipSeed string `toml:"gossip-seed"` + LongQueryTime Duration `toml:"long-query-time"` } `toml:"cluster"` Plugins struct { diff --git a/handler.go b/handler.go index d75a60290..0c85d71d3 100644 --- a/handler.go +++ b/handler.go @@ -117,6 +117,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Handle some stats tagging statsTags := make([]string, 0, 3) + fmt.Printf("long query time: %v\n", h.Cluster.LongQueryTime) if h.Cluster.LongQueryTime > 0 && dif > h.Cluster.LongQueryTime { h.logger().Printf("%s %s %.03fs", r.Method, r.URL.String(), float64(dif)) statsTags = append(statsTags, "slow_query") diff --git a/server/server.go b/server/server.go index 88ac54296..6914b49ff 100644 --- a/server/server.go +++ b/server/server.go @@ -174,7 +174,7 @@ func (m *Command) SetupServer() error { // Set configuration options. m.Server.AntiEntropyInterval = time.Duration(m.Config.AntiEntropy.Interval) - m.Server.Cluster.LongQueryTime = time.Duration(m.Config.LongQueryTime) + m.Server.Cluster.LongQueryTime = time.Duration(m.Config.Cluster.LongQueryTime) return nil }