mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 23:31:03 +00:00
Merge pull request #83 from codysoyland/expvar-compatibility
Initialize expvar lazily to prevent panic if importing both Pilosa v1 and v2
This commit is contained in:
commit
29f7448b89
1 changed files with 4 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ import (
|
|||
)
|
||||
|
||||
// Expvar global expvar map.
|
||||
var Expvar = expvar.NewMap("index")
|
||||
var Expvar *expvar.Map
|
||||
|
||||
// StatsClient represents a client to a stats server.
|
||||
type StatsClient interface {
|
||||
|
|
@ -90,6 +90,9 @@ type expvarStatsClient struct {
|
|||
// NewExpvarStatsClient returns a new instance of ExpvarStatsClient.
|
||||
// This client points at the root of the expvar index map.
|
||||
func NewExpvarStatsClient() *expvarStatsClient {
|
||||
if Expvar == nil {
|
||||
Expvar = expvar.NewMap("index")
|
||||
}
|
||||
return &expvarStatsClient{
|
||||
m: Expvar,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue