mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 04:17:51 +00:00
Config option for diagnostics interval. Default to 1 hour
This commit is contained in:
parent
e48ade4a9e
commit
722e73d305
4 changed files with 14 additions and 4 deletions
11
config.go
11
config.go
|
|
@ -43,6 +43,9 @@ const (
|
|||
|
||||
// DefaultMaxWritesPerRequest is the default number of writes per request.
|
||||
DefaultMaxWritesPerRequest = 5000
|
||||
|
||||
// DefaultDiagnosticsInterval is the default sync frequency diagnostic metrics.
|
||||
DefaultDiagnosticsInterval = 1 * time.Hour
|
||||
)
|
||||
|
||||
// ClusterTypes set of cluster types.
|
||||
|
|
@ -88,9 +91,10 @@ type Config struct {
|
|||
LogPath string `toml:"log-path"`
|
||||
|
||||
Metric struct {
|
||||
Service string `toml:"service"`
|
||||
Host string `toml:"host"`
|
||||
PollInterval Duration `toml:"poll-interval"`
|
||||
Service string `toml:"service"`
|
||||
Host string `toml:"host"`
|
||||
PollInterval Duration `toml:"poll-interval"`
|
||||
DiagnosticInterval Duration `toml:"diagnostics"`
|
||||
} `toml:"metric"`
|
||||
|
||||
TLS TLSConfig
|
||||
|
|
@ -108,6 +112,7 @@ func NewConfig() *Config {
|
|||
c.Cluster.Hosts = []string{}
|
||||
c.AntiEntropy.Interval = Duration(DefaultAntiEntropyInterval)
|
||||
c.Metric.Service = DefaultMetrics
|
||||
c.Metric.DiagnosticInterval = Duration(DefaultDiagnosticsInterval)
|
||||
c.TLS = TLSConfig{}
|
||||
return c
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) {
|
|||
flags.StringVarP(&srv.Config.Cluster.Type, "cluster.type", "", "gossip", "Determine how the cluster handles membership and state sharing. Choose from [static, gossip]")
|
||||
flags.StringVarP(&srv.Config.Metric.Service, "metric.service", "", "nop", "Default URI on which pilosa should listen.")
|
||||
flags.StringVarP(&srv.Config.Metric.Host, "metric.host", "", "", "Default URI to send metrics.")
|
||||
flags.DurationVarP((*time.Duration)(&srv.Config.Metric.DiagnosticInterval), "metric.diagnostics", "", time.Hour*1, "Diagnostic reporting interval back to Pilosa.")
|
||||
flags.DurationVarP((*time.Duration)(&srv.Config.Metric.PollInterval), "metric.poll-interval", "", time.Minute*0, "Polling interval metrics.")
|
||||
SetTLSConfig(flags, &srv.Config.TLS.CertificatePath, &srv.Config.TLS.CertificateKeyPath, &srv.Config.TLS.SkipVerify)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ func NewServer() *Server {
|
|||
AntiEntropyInterval: DefaultAntiEntropyInterval,
|
||||
PollingInterval: DefaultPollingInterval,
|
||||
MetricInterval: 0,
|
||||
DiagnosticInterval: diagnostics.DefaultDiagnosticsInterval,
|
||||
DiagnosticInterval: 0,
|
||||
|
||||
LogOutput: os.Stderr,
|
||||
}
|
||||
|
|
@ -522,6 +522,8 @@ func (s *Server) monitorDiagnostics() {
|
|||
|
||||
s.diagnostics.SetLogger(s.LogOutput)
|
||||
s.diagnostics.SetVersion(Version)
|
||||
s.diagnostics.SetInterval(s.DiagnosticInterval)
|
||||
s.diagnostics.Open()
|
||||
s.diagnostics.Set("Host", s.URI.host)
|
||||
s.diagnostics.Set("Cluster", strings.Join(s.Cluster.NodeSetHosts(), ","))
|
||||
s.diagnostics.Set("NumNodes", len(s.Cluster.Nodes))
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import (
|
|||
"time"
|
||||
|
||||
"crypto/tls"
|
||||
|
||||
"github.com/pilosa/pilosa"
|
||||
"github.com/pilosa/pilosa/gossip"
|
||||
"github.com/pilosa/pilosa/statsd"
|
||||
|
|
@ -143,6 +144,7 @@ func (m *Command) SetupServer() error {
|
|||
m.Server.Holder.Path = m.Config.DataDir
|
||||
m.Server.MetricInterval = time.Duration(m.Config.Metric.PollInterval)
|
||||
m.Server.Holder.Stats, err = NewStatsClient(m.Config.Metric.Service, m.Config.Metric.Host)
|
||||
m.Server.DiagnosticInterval = time.Duration(m.Config.Metric.DiagnosticInterval)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue