Move LongQueryTime option to cluster section of config file

This commit is contained in:
Alan Bernstein 2017-04-24 15:20:08 -05:00
parent bbffc8f500
commit 5413597998
3 changed files with 5 additions and 4 deletions

View file

@ -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 {

View file

@ -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")

View file

@ -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
}