Server now requires build information
Version is worth special-casing here, since the build information is pretty important, and make components need it. Fixes issue #2958.pull/2969/head
parent
23a7896182
commit
d5fda01c2a
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue