influxdb/cmd/influxd/main.go

53 lines
1.1 KiB
Go
Raw Normal View History

package main
import (
"context"
"fmt"
_ "net/http/pprof"
"os"
"time"
"github.com/influxdata/flux"
"github.com/influxdata/influxdb/v2"
"github.com/influxdata/influxdb/v2/cmd/influxd/launcher"
2020-08-26 17:46:47 +00:00
_ "github.com/influxdata/influxdb/v2/tsdb/engine/tsm1"
_ "github.com/influxdata/influxdb/v2/tsdb/index/tsi1"
"github.com/spf13/cobra"
)
var (
version = "dev"
commit = "none"
date = ""
)
func main() {
if len(date) == 0 {
date = time.Now().UTC().Format(time.RFC3339)
}
influxdb.SetBuildInfo(version, commit, date)
rootCmd := launcher.NewInfluxdCommand(context.Background(),
2020-04-24 16:47:22 +00:00
// FIXME
//generate.Command,
//restore.Command,
&cobra.Command{
Use: "version",
Short: "Print the influxd server version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("InfluxDB %s (git: %s) build_date: %s\n", version, commit, date)
},
},
)
// TODO: this should be removed in the future: https://github.com/influxdata/influxdb/issues/16220
if os.Getenv("QUERY_TRACING") == "1" {
flux.EnableExperimentalTracing()
}
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}