diff --git a/cmd/influxd/run/command.go b/cmd/influxd/run/command.go index 9264ab9b8c..edf3139a64 100644 --- a/cmd/influxd/run/command.go +++ b/cmd/influxd/run/command.go @@ -87,11 +87,10 @@ func (cmd *Command) Run(args ...string) error { } // Create server from config and start it. - s, err := NewServer(config) + s, err := NewServer(config, cmd.Version) if err != nil { return fmt.Errorf("create server: %s", err) } - s.Version = cmd.Version s.CPUProfile = options.CPUProfile s.MemProfile = options.MemProfile if err := s.Open(); err != nil { diff --git a/cmd/influxd/run/server.go b/cmd/influxd/run/server.go index 32dd158776..421439d8b2 100644 --- a/cmd/influxd/run/server.go +++ b/cmd/influxd/run/server.go @@ -33,7 +33,7 @@ import ( // It is built using a Config and it manages the startup and shutdown of all // services in the proper order. type Server struct { - Version string + version string // Build version err chan error closing chan struct{} @@ -64,9 +64,10 @@ type Server struct { } // NewServer returns a new instance of Server built from a config. -func NewServer(c *Config) (*Server, error) { +func NewServer(c *Config, version string) (*Server, error) { // Construct base meta store and data store. s := &Server{ + version: version, err: make(chan error), closing: make(chan struct{}), @@ -162,7 +163,7 @@ func (s *Server) appendHTTPDService(c httpd.Config) { srv.Handler.MetaStore = s.MetaStore srv.Handler.QueryExecutor = s.QueryExecutor srv.Handler.PointsWriter = s.PointsWriter - srv.Handler.Version = s.Version + srv.Handler.Version = s.version // If a ContinuousQuerier service has been started, attach it. for _, srvc := range s.Services { @@ -390,7 +391,7 @@ func (s *Server) reportServer() { "name":"reports", "columns":["os", "arch", "version", "server_id", "cluster_id", "num_series", "num_measurements", "num_databases"], "points":[["%s", "%s", "%s", "%x", "%x", "%d", "%d", "%d"]] - }]`, runtime.GOOS, runtime.GOARCH, s.Version, s.MetaStore.NodeID(), clusterID, numSeries, numMeasurements, numDatabases) + }]`, runtime.GOOS, runtime.GOARCH, s.version, s.MetaStore.NodeID(), clusterID, numSeries, numMeasurements, numDatabases) data := bytes.NewBufferString(json) diff --git a/cmd/influxd/run/server_helpers_test.go b/cmd/influxd/run/server_helpers_test.go index 51cd2480db..344156b61c 100644 --- a/cmd/influxd/run/server_helpers_test.go +++ b/cmd/influxd/run/server_helpers_test.go @@ -30,7 +30,7 @@ type Server struct { // NewServer returns a new instance of Server. func NewServer(c *run.Config) *Server { - srv, _ := run.NewServer(c) + srv, _ := run.NewServer(c, "testServer") s := Server{ Server: srv, Config: c,