commit
ca377f87d2
|
@ -19,6 +19,12 @@ import (
|
|||
"github.com/tylerb/graceful"
|
||||
)
|
||||
|
||||
var startTime time.Time
|
||||
|
||||
func init() {
|
||||
startTime = time.Now().UTC()
|
||||
}
|
||||
|
||||
// Server for the chronograf API
|
||||
type Server struct {
|
||||
Host string `long:"host" description:"the IP to listen on" default:"0.0.0.0" env:"HOST"`
|
||||
|
@ -37,7 +43,7 @@ type Server struct {
|
|||
TokenSecret string `short:"t" long:"token-secret" description:"Secret to sign tokens" env:"TOKEN_SECRET"`
|
||||
GithubClientID string `short:"i" long:"github-client-id" description:"Github Client ID for OAuth 2 support" env:"GH_CLIENT_ID"`
|
||||
GithubClientSecret string `short:"s" long:"github-client-secret" description:"Github Client Secret for OAuth 2 support" env:"GH_CLIENT_SECRET"`
|
||||
ReportingDisabled bool `short:"r" long:"reporting-disabled" description:"Disable reporting of usage stats (os,arch,version,cluster_id) once every 24hr" env:"REPORTING_DISABLED"`
|
||||
ReportingDisabled bool `short:"r" long:"reporting-disabled" description:"Disable reporting of usage stats (os,arch,version,cluster_id,uptime) once every 24hr" env:"REPORTING_DISABLED"`
|
||||
LogLevel string `short:"l" long:"log-level" value-name:"choice" choice:"debug" choice:"info" choice:"warn" choice:"error" choice:"fatal" choice:"panic" default:"info" description:"Set the logging level" env:"LOG_LEVEL"`
|
||||
|
||||
ShowVersion bool `short:"v" long:"version" description:"Show Chronograf version info"`
|
||||
|
@ -163,6 +169,7 @@ func reportUsageStats(bi BuildInfo, logger chronograf.Logger) {
|
|||
"arch": runtime.GOARCH,
|
||||
"version": bi.Version,
|
||||
"cluster_id": serverID,
|
||||
"uptime": time.Since(startTime).Seconds(),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -170,7 +177,7 @@ func reportUsageStats(bi BuildInfo, logger chronograf.Logger) {
|
|||
l := logger.WithField("component", "usage").
|
||||
WithField("reporting_addr", reporter.URL).
|
||||
WithField("freq", "24h").
|
||||
WithField("stats", "os,arch,version,cluster_id")
|
||||
WithField("stats", "os,arch,version,cluster_id,uptime")
|
||||
l.Info("Reporting usage stats")
|
||||
reporter.Save(u)
|
||||
|
||||
|
|
Loading…
Reference in New Issue