Close #566. Add some timing data to the logs

pull/600/merge
Edward Muller 2014-05-21 17:57:57 -03:00 committed by John Shahid
parent a047866420
commit ad85345e3e
1 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import (
"regexp"
"strings"
"sync"
"time"
log "code.google.com/p/log4go"
)
@ -65,7 +66,10 @@ func NewCoordinatorImpl(config *configuration.Configuration, raftServer ClusterC
}
func (self *CoordinatorImpl) RunQuery(user common.User, database string, queryString string, seriesWriter SeriesWriter) (err error) {
log.Info("Query: db: %s, u: %s, q: %s", database, user.GetName(), queryString)
log.Info("Start Query: db: %s, u: %s, q: %s", database, user.GetName(), queryString)
defer func(t time.Time) {
log.Debug("End Query: db: %s, u: %s, q: %s, t: %f", database, user.GetName(), queryString, time.Now().Sub(t))
}(time.Now())
// don't let a panic pass beyond RunQuery
defer common.RecoverFunc(database, queryString, nil)