mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-10 15:01:03 +00:00
simplifying the diagnostics client. Using circuit breaker to manage the diagnostics http connection.
This commit is contained in:
parent
f575605bbe
commit
3b4892f926
2 changed files with 5 additions and 21 deletions
|
|
@ -565,12 +565,6 @@ func (s *Server) monitorDiagnostics() {
|
|||
|
||||
// monitorRuntime periodically polls the Go runtime metrics.
|
||||
func (s *Server) monitorRuntime() {
|
||||
s.Holder.Stats.Set("Host", s.Host, 1.0)
|
||||
s.Holder.Stats.Set("Cluster", strings.Join(s.Cluster.NodeSetHosts(), ","), 1.0)
|
||||
s.Holder.Stats.Set("NumNodes", strconv.Itoa(len(s.Cluster.Nodes)), 1.0)
|
||||
s.Holder.Stats.Set("NumCPU", strconv.Itoa(runtime.NumCPU()), 1.0)
|
||||
// TODO should we force this to run for diagnostics?
|
||||
|
||||
// Disable metrics when poll interval is zero.
|
||||
if s.MetricInterval <= 0 {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
|
||||
"crypto/tls"
|
||||
"github.com/pilosa/pilosa"
|
||||
"github.com/pilosa/pilosa/diagnostics"
|
||||
"github.com/pilosa/pilosa/gossip"
|
||||
"github.com/pilosa/pilosa/statsd"
|
||||
)
|
||||
|
|
@ -42,8 +41,7 @@ func init() {
|
|||
|
||||
const (
|
||||
// DefaultDataDir is the default data directory.
|
||||
DefaultDataDir = "~/.pilosa"
|
||||
DefaultDiagnosticServer = "https://requestb.in/w3uukzw3"
|
||||
DefaultDataDir = "~/.pilosa"
|
||||
)
|
||||
|
||||
// Command represents the state of the pilosa server command.
|
||||
|
|
@ -247,20 +245,12 @@ 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":
|
||||
ms = append(ms, pilosa.NewExpvarStatsClient())
|
||||
return pilosa.NewExpvarStatsClient(), nil
|
||||
case "statsd":
|
||||
r, err := statsd.NewStatsClient(host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ms = append(ms, r)
|
||||
return statsd.NewStatsClient(host)
|
||||
default:
|
||||
return pilosa.NopStatsClient, nil
|
||||
}
|
||||
return ms, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue