mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 07:41:02 +00:00
more logging and stats updats
This commit is contained in:
parent
170fe96661
commit
7b9472bffe
5 changed files with 20 additions and 8 deletions
|
|
@ -16,6 +16,7 @@ var (
|
|||
)
|
||||
|
||||
func main() {
|
||||
defer log.Flush()
|
||||
exitStatus, err := panicwrap.BasicWrap(panicHandler)
|
||||
if err != nil {
|
||||
// Something went wrong setting up the panic wrapper. Unlikely,
|
||||
|
|
@ -46,6 +47,6 @@ func main() {
|
|||
func panicHandler(output string) {
|
||||
// output contains the full output (including stack traces) of the
|
||||
// panic. Put it in a file or something.
|
||||
log.Warn("The child panicked:\n\n", output)
|
||||
log.Critical("The child panicked:\n\n", output)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
|||
10
core/etcd.go
10
core/etcd.go
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
log "github.com/cihub/seelog"
|
||||
"os"
|
||||
"pilosa/config"
|
||||
"pilosa/db"
|
||||
"pilosa/util"
|
||||
|
|
@ -31,10 +32,12 @@ func (self *TopologyMapper) Setup() {
|
|||
if ok && ee.ErrorCode == 100 { // node does not exist
|
||||
resp, err = self.service.Etcd.CreateDir(db_path, 0)
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
log.Critical(err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
} else {
|
||||
log.Warn(err)
|
||||
log.Critical(err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
//need to lock the world
|
||||
|
|
@ -395,7 +398,8 @@ func (self *ProcessMapper) getnode(u *util.GUID) *Node {
|
|||
|
||||
func crash_on_error(err error) {
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
log.Critical(err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,11 +93,14 @@ func (service *Service) init_id() {
|
|||
id = util.RandomUUID()
|
||||
if err != nil {
|
||||
log.Critical("problem generating uuid")
|
||||
os.Exit(-1)
|
||||
|
||||
}
|
||||
} else {
|
||||
id, err = util.ParseGUID(id_string)
|
||||
if err != nil {
|
||||
log.Critical("Service id not valid:", id_string)
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
service.Id = &id
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
log "github.com/cihub/seelog"
|
||||
"net"
|
||||
"os"
|
||||
"pilosa/config"
|
||||
"pilosa/core"
|
||||
"pilosa/db"
|
||||
|
|
@ -130,7 +131,8 @@ func (self *TcpTransport) listen() {
|
|||
port_string := fmt.Sprintf(":%d", self.port)
|
||||
l, e := net.Listen("tcp", port_string)
|
||||
if e != nil {
|
||||
log.Warn("Cannot bind to port! ", self.port)
|
||||
log.Critical("Cannot bind to port! ", self.port)
|
||||
os.Exit(-1)
|
||||
}
|
||||
for {
|
||||
conn, err := l.Accept()
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
timer = make(chan args, 100)
|
||||
count = make(chan string, 100)
|
||||
timer = make(chan args, 32768)
|
||||
count = make(chan string, 32768)
|
||||
end = make(chan bool)
|
||||
stat_config := config.GetStringDefault("statsd_server", "127.0.0.1:8125")
|
||||
log.Warn("New Stats", stat_config)
|
||||
|
|
@ -31,6 +31,7 @@ func init() {
|
|||
select {
|
||||
case ci := <-timer:
|
||||
stats.Gauge(ci.stat, ci.delta, ci.rate)
|
||||
stats.Timing(ci.stat, ci.delta, ci.rate)
|
||||
case stat := <-count:
|
||||
stats.Inc(stat, 1, 1.0)
|
||||
case <-end:
|
||||
|
|
@ -44,7 +45,8 @@ func init() {
|
|||
|
||||
func SendTimer(stat string, delta int64) {
|
||||
pstat := "pilosa." + stat
|
||||
timer <- args{pstat, delta, 1.0}
|
||||
milli := delta / time.Millisecond
|
||||
timer <- args{pstat, milli, 1.0}
|
||||
}
|
||||
func SendInc(stat string) {
|
||||
pstat := "pilosa." + stat
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue