mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Using MultiStatsClient add Diagnostics
This commit is contained in:
parent
c80b959d0d
commit
539c4bc14e
1 changed files with 15 additions and 5 deletions
|
|
@ -31,6 +31,7 @@ import (
|
|||
|
||||
"crypto/tls"
|
||||
"github.com/pilosa/pilosa"
|
||||
"github.com/pilosa/pilosa/diagnostics"
|
||||
"github.com/pilosa/pilosa/gossip"
|
||||
"github.com/pilosa/pilosa/statsd"
|
||||
)
|
||||
|
|
@ -41,7 +42,8 @@ func init() {
|
|||
|
||||
const (
|
||||
// DefaultDataDir is the default data directory.
|
||||
DefaultDataDir = "~/.pilosa"
|
||||
DefaultDataDir = "~/.pilosa"
|
||||
DefaultDiagnosticServer = "https://requestb.in/w3uukzw3"
|
||||
)
|
||||
|
||||
// Command represents the state of the pilosa server command.
|
||||
|
|
@ -245,12 +247,20 @@ func (m *Command) Close() error {
|
|||
|
||||
// NewStatsClient creates a stats client from the config
|
||||
func NewStatsClient(name string, host string) (pilosa.StatsClient, error) {
|
||||
ms := make(pilosa.MultiStatsClient, 1)
|
||||
d := diagnostics.New(DefaultDiagnosticServer)
|
||||
d.SetVersion(pilosa.Version)
|
||||
ms[0] = d
|
||||
|
||||
switch name {
|
||||
case "expvar":
|
||||
return pilosa.NewExpvarStatsClient(), nil
|
||||
ms = append(ms, pilosa.NewExpvarStatsClient())
|
||||
case "statsd":
|
||||
return statsd.NewStatsClient(host)
|
||||
default:
|
||||
return pilosa.NopStatsClient, nil
|
||||
r, err := statsd.NewStatsClient(host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ms = append(ms, r)
|
||||
}
|
||||
return ms, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue