mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
added a setbit counter
This commit is contained in:
parent
5c29733285
commit
71ece5fe6b
2 changed files with 13 additions and 4 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue