mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Move LongQueryTime to Cluster
This commit is contained in:
parent
6a162c4be2
commit
615c830ecc
3 changed files with 6 additions and 7 deletions
|
|
@ -3,6 +3,7 @@ package pilosa
|
|||
import (
|
||||
"encoding/binary"
|
||||
"hash/fnv"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -97,6 +98,9 @@ type Cluster struct {
|
|||
|
||||
// The number of replicas a partition has.
|
||||
ReplicaN int
|
||||
|
||||
// Threshold for logging long-running queries
|
||||
LongQueryTime time.Duration
|
||||
}
|
||||
|
||||
// NewCluster returns a new instance of Cluster with defaults.
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ type Handler struct {
|
|||
|
||||
// The writer for any logging.
|
||||
LogOutput io.Writer
|
||||
|
||||
// Threshold for logging long-running queries
|
||||
LongQueryTime time.Duration
|
||||
}
|
||||
|
||||
// externalPrefixFlag denotes endpoints that are intended to be exposed to clients.
|
||||
|
|
@ -120,9 +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.LongQueryTime)
|
||||
|
||||
if h.LongQueryTime > 0 && dif > h.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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ func (m *Command) SetupServer() error {
|
|||
|
||||
// Set configuration options.
|
||||
m.Server.AntiEntropyInterval = time.Duration(m.Config.AntiEntropy.Interval)
|
||||
m.Server.Handler.LongQueryTime = time.Duration(m.Config.LongQueryTime)
|
||||
m.Server.Cluster.LongQueryTime = time.Duration(m.Config.LongQueryTime)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue