added a setbit counter

This commit is contained in:
Todd Gruben 2014-10-10 15:46:52 +00:00
parent 5c29733285
commit 71ece5fe6b
2 changed files with 13 additions and 4 deletions

View file

@ -267,6 +267,7 @@ func (self *FragmentContainer) SetBit(frag_id util.SUUID, bitmap_id uint64, pos
fragment.requestChan <- request
result := request.Response()
util.SendTimer("fragmant_container_SetBit", result.exec_time.Nanoseconds())
util.SendInc("fragmant_container_SetBit")
return result.answer.(bool), nil
}
return false, errors.New("Invalid Bitmap Handle")

View file

@ -14,12 +14,14 @@ type args struct {
}
var (
count chan args
timer chan args
count chan string
end chan bool
)
func init() {
count = make(chan args, 100)
timer = make(chan args, 100)
count = make(chan string, 100)
end = make(chan bool)
stat_config := config.GetStringDefault("statsd_server", "127.0.0.1:8125")
log.Println("New Stats", stat_config)
@ -27,8 +29,10 @@ func init() {
go func() {
for {
select {
case ci := <-count:
case ci := <-timer:
stats.Gauge(ci.stat, ci.delta, ci.rate)
case stat := <-count:
stats.Inc(stat, 1, 1.0)
case <-end:
log.Println("DONE Stats")
return
@ -40,7 +44,11 @@ func init() {
func SendTimer(stat string, delta int64) {
pstat := "pilosa." + stat
count <- args{pstat, delta, 1.0}
timer <- args{pstat, delta, 1.0}
}
func SendInc(stat string) {
pstat := "pilosa." + stat
count <- pstat
}
func ShutdownStats() {