parent
18e2e5e6b6
commit
45c3d682c4
|
@ -7,6 +7,14 @@
|
|||
|
||||
bind-address = "0.0.0.0"
|
||||
|
||||
# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com
|
||||
# The data includes raft name (random 8 bytes), os, arch and version
|
||||
# We don't track ip addresses of servers reporting. This is only used
|
||||
# to track the number of instances running and the versions which
|
||||
# is very helpful for us.
|
||||
# Change this option to true to disable reporting.
|
||||
reporting-disabled = false
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -79,6 +79,7 @@ type GraphiteConfig struct {
|
|||
Database string
|
||||
UdpEnabled bool `toml:"udp_enabled"`
|
||||
}
|
||||
|
||||
type UdpInputConfig struct {
|
||||
Enabled bool
|
||||
Port int
|
||||
|
@ -189,18 +190,19 @@ type InputPlugins struct {
|
|||
}
|
||||
|
||||
type TomlConfiguration struct {
|
||||
Admin AdminConfig
|
||||
HttpApi ApiConfig `toml:"api"`
|
||||
InputPlugins InputPlugins `toml:"input_plugins"`
|
||||
Raft RaftConfig
|
||||
Storage StorageConfig
|
||||
Cluster ClusterConfig
|
||||
Logging LoggingConfig
|
||||
LevelDb LevelDbConfiguration
|
||||
Hostname string
|
||||
BindAddress string `toml:"bind-address"`
|
||||
Sharding ShardingDefinition `toml:"sharding"`
|
||||
WalConfig WalConfig `toml:"wal"`
|
||||
Admin AdminConfig
|
||||
HttpApi ApiConfig `toml:"api"`
|
||||
InputPlugins InputPlugins `toml:"input_plugins"`
|
||||
Raft RaftConfig
|
||||
Storage StorageConfig
|
||||
Cluster ClusterConfig
|
||||
Logging LoggingConfig
|
||||
LevelDb LevelDbConfiguration
|
||||
Hostname string
|
||||
BindAddress string `toml:"bind-address"`
|
||||
ReportingDisabled bool `toml:"reporting-disabled"`
|
||||
Sharding ShardingDefinition `toml:"sharding"`
|
||||
WalConfig WalConfig `toml:"wal"`
|
||||
}
|
||||
|
||||
type Configuration struct {
|
||||
|
@ -249,7 +251,9 @@ type Configuration struct {
|
|||
PerServerWriteBufferSize int
|
||||
ClusterMaxResponseBufferSize int
|
||||
ConcurrentShardQueryLimit int
|
||||
ReportingDisabled bool
|
||||
Version string
|
||||
InfluxDBVersion string
|
||||
}
|
||||
|
||||
func LoadConfiguration(fileName string) *Configuration {
|
||||
|
@ -344,6 +348,7 @@ func parseTomlConfiguration(filename string) (*Configuration, error) {
|
|||
LogLevel: tomlConfiguration.Logging.Level,
|
||||
Hostname: tomlConfiguration.Hostname,
|
||||
BindAddress: tomlConfiguration.BindAddress,
|
||||
ReportingDisabled: tomlConfiguration.ReportingDisabled,
|
||||
LevelDbMaxOpenFiles: tomlConfiguration.LevelDb.MaxOpenFiles,
|
||||
LevelDbLruCacheSize: int(tomlConfiguration.LevelDb.LruCacheSize.int64),
|
||||
LevelDbMaxOpenShards: tomlConfiguration.LevelDb.MaxOpenShards,
|
||||
|
|
|
@ -87,6 +87,7 @@ func main() {
|
|||
}
|
||||
|
||||
config.Version = version
|
||||
config.InfluxDBVersion = version
|
||||
|
||||
setupLogging(config.LogLevel, config.LogFile)
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
bind-address = "0.0.0.0"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
hostname = "localhost"
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "info"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# that can be resovled here.
|
||||
# hostname = ""
|
||||
|
||||
reporting-disabled = true
|
||||
|
||||
[logging]
|
||||
# logging level can be one of "debug", "info", "warn" or "error"
|
||||
level = "debug"
|
||||
|
|
|
@ -9,10 +9,12 @@ import (
|
|||
"configuration"
|
||||
"coordinator"
|
||||
"datastore"
|
||||
"runtime"
|
||||
"time"
|
||||
"wal"
|
||||
|
||||
log "code.google.com/p/log4go"
|
||||
influxdb "github.com/influxdb/influxdb-go"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
|
@ -156,6 +158,11 @@ func (self *Server) ListenAndServe() error {
|
|||
go server.ListenAndServe()
|
||||
}
|
||||
|
||||
log.Debug("ReportingDisabled: %s", self.Config.ReportingDisabled)
|
||||
if !self.Config.ReportingDisabled {
|
||||
self.startReportingLoop()
|
||||
}
|
||||
|
||||
// start processing continuous queries
|
||||
self.RaftServer.StartProcessingContinuousQueries()
|
||||
|
||||
|
@ -165,6 +172,52 @@ func (self *Server) ListenAndServe() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (self *Server) startReportingLoop() chan struct{} {
|
||||
quit := make(chan struct{})
|
||||
|
||||
log.Debug("Starting Reporting Loop")
|
||||
self.reportStats()
|
||||
|
||||
ticker := time.NewTicker(24 * time.Hour)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
self.reportStats()
|
||||
case <-quit:
|
||||
ticker.Stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return quit
|
||||
}
|
||||
|
||||
func (self *Server) reportStats() {
|
||||
client, err := influxdb.NewClient(&influxdb.ClientConfig{
|
||||
Database: "reporting",
|
||||
Host: "m.influxdb.com:8086",
|
||||
Username: "reporter",
|
||||
Password: "influxdb",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Error("Couldn't create client for reporting: %s", err)
|
||||
} else {
|
||||
series := &influxdb.Series{
|
||||
Name: "reports",
|
||||
Columns: []string{"os", "arch", "id", "version"},
|
||||
Points: [][]interface{}{
|
||||
[]interface{}{runtime.GOOS, runtime.GOARCH, self.RaftServer.GetRaftName(), self.Config.InfluxDBVersion},
|
||||
},
|
||||
}
|
||||
|
||||
log.Info("Reporting stats: %s", series)
|
||||
client.WriteSeries([]*influxdb.Series{series})
|
||||
}
|
||||
}
|
||||
|
||||
func (self *Server) Stop() {
|
||||
if self.stopped {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue