influxdb/cmd/influxd/main.go

331 lines
8.7 KiB
Go
Raw Normal View History

package main
import (
"context"
"fmt"
"io"
nethttp "net/http"
_ "net/http/pprof"
"os"
"os/signal"
"os/user"
"path/filepath"
"runtime"
"syscall"
"time"
"go.uber.org/zap"
influxlogger "github.com/influxdata/influxdb/logger"
"github.com/influxdata/platform"
"github.com/influxdata/platform/bolt"
"github.com/influxdata/platform/chronograf/server"
"github.com/influxdata/platform/http"
"github.com/influxdata/platform/kit/prom"
"github.com/influxdata/platform/nats"
"github.com/influxdata/platform/query"
2018-08-07 22:51:33 +00:00
_ "github.com/influxdata/platform/query/builtin"
"github.com/influxdata/platform/query/control"
"github.com/influxdata/platform/query/execute"
feat(platform): add uniform query endpoint for sources Using query request struct to query resources Signed-off-by: Lorenzo Fontana <lo@linux.com> Use query.ProxyRequest instead query.Request Signed-off-by: Lorenzo Fontana <lo@linux.com> Proxy request from idpd Signed-off-by: Lorenzo Fontana <lo@linux.com> Comments about the desired results Signed-off-by: Lorenzo Fontana <lo@linux.com> V1 endpoints working with flux Signed-off-by: Lorenzo Fontana <lo@linux.com> Influxql working for v1 Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> V2 influxql query endpoint working Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Signed-off-by: Lorenzo Fontana <lo@linux.com> V2 Flux compiler support Co-authored-by: Michael De Sa <mjdesa@gmail.com> Signed-off-by: Lorenzo Fontana <lo@linux.com> Improve comments in bolt sources and give error on self Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Review tests failing Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Avoid type casts for compiler types Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Using nil instead of dbrp mapping service for influxql v1 Signed-off-by: Lorenzo Fontana <lo@linux.com> Check if compiler types are valid for influxql Signed-off-by: Lorenzo Fontana <lo@linux.com> Organization as query param in the flux external handler Signed-off-by: Lorenzo Fontana <lo@linux.com> feat(http): update swagger documentation for flux query endpoint feat(http): document query endpoint design The code documented does not currently work. It is indended that this will be implemented in follow up PRs. feat(platform): move source to platform package The source Query endpoint implements what's in the query swagger docs Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> feat(platform): allow for encoding and decoding of csv dialects feat(platform): specify dialect in flux page Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com>
2018-08-28 19:53:20 +00:00
"github.com/influxdata/platform/source"
"github.com/influxdata/platform/task"
taskbackend "github.com/influxdata/platform/task/backend"
taskbolt "github.com/influxdata/platform/task/backend/bolt"
"github.com/influxdata/platform/task/backend/coordinator"
taskexecutor "github.com/influxdata/platform/task/backend/executor"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func main() {
Execute()
}
const (
// NatsSubject is the subject that subscribers and publishers use for writing and consuming line protocol
NatsSubject = "ingress"
// IngressGroup is the Nats Streaming Subscriber group, allowing multiple subscribers to distribute work
IngressGroup = "ingress"
)
var (
httpBindAddress string
authorizationPath string
boltPath string
walPath string
)
func influxDir() (string, error) {
var dir string
// By default, store meta and data files in current users home directory
u, err := user.Current()
if err == nil {
dir = u.HomeDir
} else if os.Getenv("HOME") != "" {
dir = os.Getenv("HOME")
} else {
wd, err := os.Getwd()
if err != nil {
return "", err
}
dir = wd
}
dir = filepath.Join(dir, ".influxdbv2")
return dir, nil
}
func init() {
viper.SetEnvPrefix("INFLUX")
platformCmd.Flags().StringVar(&httpBindAddress, "http-bind-address", ":9999", "bind address for the rest http api")
viper.BindEnv("HTTP_BIND_ADDRESS")
if h := viper.GetString("HTTP_BIND_ADDRESS"); h != "" {
httpBindAddress = h
}
platformCmd.Flags().StringVar(&authorizationPath, "authorizationPath", "", "path to a bootstrap token")
viper.BindEnv("TOKEN_PATH")
if h := viper.GetString("TOKEN_PATH"); h != "" {
authorizationPath = h
}
platformCmd.Flags().StringVar(&boltPath, "bolt-path", "influxd.bolt", "path to boltdb database")
viper.BindEnv("BOLT_PATH")
if h := viper.GetString("BOLT_PATH"); h != "" {
boltPath = h
}
dir, err := influxDir()
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to determine influx directory: %v", err)
os.Exit(1)
}
platformCmd.Flags().StringVar(&walPath, "wal-path", filepath.Join(dir, "wal"), "path to persistent WAL files")
viper.BindEnv("WAL_PATH")
if h := viper.GetString("WAL_PATH"); h != "" {
walPath = h
}
}
var platformCmd = &cobra.Command{
Use: "influxd",
Short: "influxdata platform",
Run: platformF,
}
func platformF(cmd *cobra.Command, args []string) {
// Create top level logger
logger := influxlogger.New(os.Stdout)
reg := prom.NewRegistry()
reg.MustRegister(prometheus.NewGoCollector())
reg.WithLogger(logger)
c := bolt.NewClient()
c.Path = boltPath
if err := c.Open(context.TODO()); err != nil {
logger.Error("failed opening bolt", zap.Error(err))
os.Exit(1)
}
defer c.Close()
var authSvc platform.AuthorizationService
{
feat(platform): add boltdb implementation of services feat(platform): add id to authorization feat(platform): add user arg to CreateAuthorization method on auth svc migrate(platform): move idp command to platform directory This comit did not move the ifql command as it depends on the query service which has yet to be migrated. feat(platform): add optional user name to authorization struct feat(platform): add organization name to bucket struct Additionally allow filtering buckets by organization name. feat(prom): ensure that prom auth svc implement base interface feat(prometheus): add user to create authorization method feat(prom): drop user string from create authorization feat(zap): ensure that zap auth svc implements base service interface feat(zap): add user to create authorization method feat(zap): drop user string from create authorization feat(http): add ids to authorization service feat(http): ensure that http authoriztaion service implements auth svc interface feat(http): use authorization ids in authorization handler squash(http): add check for http status accepted in authorization service feat(http): clean up authorization service and handlers feat(http): drop user string from create authorization fix(http): normalize the http authorization service feat(http): normalize bucket service and handler methods Additonally, we added support for DELETE bucket feat(http): add delete user handler Additionally, there was a bit of general cleanup feat(http): add delete route for organization handler and service Did a bit of additional cleanup of the http code. test(testing): add service conformance tests test(testing): add organization service conformance tests test(testing): add conformance test for orgs service Additionally, there was a bit of cleanup in the users service tests test(testing): add conformance test for authorizations service test(testing): update auth tests to validate that user exists test(testing): update authorization conformance tests with user name test(testing): update bucket conformance tests to include organizations feat(bolt): add bolt implementation services feat(bolt): add bolt implementation of organization service feat(bolt): add bolt implementation of users service feat(bolt): add bolt implementation of authorization service feat(bolt): add user to create authorization method feat(bolt): drop user string from create authorization fix(bolt): set user name on authorization after put feat(bolt): update bucket servie to include organizations feat(bolt): add dependent destroy of resources feat(cmd/idpd): use bolt services in platform server feat(cmd/idpd): use bolt organization service in platform server feat(cmd/idpd): use bolt users service in plaform server feat(cmd/idpd): use bolt client as authorization service feat(cmd/idp): show user name in output of auth sub command feat(cmd/idp): clean up bucket subcommand of idp command fix(cmd/idp): normalize idp command output for users fix(cmd/idp): normalize auth subcommand output feat(cmd/idp): add support for delete organiztion command migrate(idp): move ifql subcommand of idp to platform
2018-05-16 18:59:35 +00:00
authSvc = c
}
var bucketSvc platform.BucketService
{
bucketSvc = c
}
var orgSvc platform.OrganizationService
{
feat(platform): add boltdb implementation of services feat(platform): add id to authorization feat(platform): add user arg to CreateAuthorization method on auth svc migrate(platform): move idp command to platform directory This comit did not move the ifql command as it depends on the query service which has yet to be migrated. feat(platform): add optional user name to authorization struct feat(platform): add organization name to bucket struct Additionally allow filtering buckets by organization name. feat(prom): ensure that prom auth svc implement base interface feat(prometheus): add user to create authorization method feat(prom): drop user string from create authorization feat(zap): ensure that zap auth svc implements base service interface feat(zap): add user to create authorization method feat(zap): drop user string from create authorization feat(http): add ids to authorization service feat(http): ensure that http authoriztaion service implements auth svc interface feat(http): use authorization ids in authorization handler squash(http): add check for http status accepted in authorization service feat(http): clean up authorization service and handlers feat(http): drop user string from create authorization fix(http): normalize the http authorization service feat(http): normalize bucket service and handler methods Additonally, we added support for DELETE bucket feat(http): add delete user handler Additionally, there was a bit of general cleanup feat(http): add delete route for organization handler and service Did a bit of additional cleanup of the http code. test(testing): add service conformance tests test(testing): add organization service conformance tests test(testing): add conformance test for orgs service Additionally, there was a bit of cleanup in the users service tests test(testing): add conformance test for authorizations service test(testing): update auth tests to validate that user exists test(testing): update authorization conformance tests with user name test(testing): update bucket conformance tests to include organizations feat(bolt): add bolt implementation services feat(bolt): add bolt implementation of organization service feat(bolt): add bolt implementation of users service feat(bolt): add bolt implementation of authorization service feat(bolt): add user to create authorization method feat(bolt): drop user string from create authorization fix(bolt): set user name on authorization after put feat(bolt): update bucket servie to include organizations feat(bolt): add dependent destroy of resources feat(cmd/idpd): use bolt services in platform server feat(cmd/idpd): use bolt organization service in platform server feat(cmd/idpd): use bolt users service in plaform server feat(cmd/idpd): use bolt client as authorization service feat(cmd/idp): show user name in output of auth sub command feat(cmd/idp): clean up bucket subcommand of idp command fix(cmd/idp): normalize idp command output for users fix(cmd/idp): normalize auth subcommand output feat(cmd/idp): add support for delete organiztion command migrate(idp): move ifql subcommand of idp to platform
2018-05-16 18:59:35 +00:00
orgSvc = c
}
var userSvc platform.UserService
{
feat(platform): add boltdb implementation of services feat(platform): add id to authorization feat(platform): add user arg to CreateAuthorization method on auth svc migrate(platform): move idp command to platform directory This comit did not move the ifql command as it depends on the query service which has yet to be migrated. feat(platform): add optional user name to authorization struct feat(platform): add organization name to bucket struct Additionally allow filtering buckets by organization name. feat(prom): ensure that prom auth svc implement base interface feat(prometheus): add user to create authorization method feat(prom): drop user string from create authorization feat(zap): ensure that zap auth svc implements base service interface feat(zap): add user to create authorization method feat(zap): drop user string from create authorization feat(http): add ids to authorization service feat(http): ensure that http authoriztaion service implements auth svc interface feat(http): use authorization ids in authorization handler squash(http): add check for http status accepted in authorization service feat(http): clean up authorization service and handlers feat(http): drop user string from create authorization fix(http): normalize the http authorization service feat(http): normalize bucket service and handler methods Additonally, we added support for DELETE bucket feat(http): add delete user handler Additionally, there was a bit of general cleanup feat(http): add delete route for organization handler and service Did a bit of additional cleanup of the http code. test(testing): add service conformance tests test(testing): add organization service conformance tests test(testing): add conformance test for orgs service Additionally, there was a bit of cleanup in the users service tests test(testing): add conformance test for authorizations service test(testing): update auth tests to validate that user exists test(testing): update authorization conformance tests with user name test(testing): update bucket conformance tests to include organizations feat(bolt): add bolt implementation services feat(bolt): add bolt implementation of organization service feat(bolt): add bolt implementation of users service feat(bolt): add bolt implementation of authorization service feat(bolt): add user to create authorization method feat(bolt): drop user string from create authorization fix(bolt): set user name on authorization after put feat(bolt): update bucket servie to include organizations feat(bolt): add dependent destroy of resources feat(cmd/idpd): use bolt services in platform server feat(cmd/idpd): use bolt organization service in platform server feat(cmd/idpd): use bolt users service in plaform server feat(cmd/idpd): use bolt client as authorization service feat(cmd/idp): show user name in output of auth sub command feat(cmd/idp): clean up bucket subcommand of idp command fix(cmd/idp): normalize idp command output for users fix(cmd/idp): normalize auth subcommand output feat(cmd/idp): add support for delete organiztion command migrate(idp): move ifql subcommand of idp to platform
2018-05-16 18:59:35 +00:00
userSvc = c
}
var dashboardSvc platform.DashboardService
{
dashboardSvc = c
}
feat(platform): move chronogaf v2 dashboards to platform test(testing): add tests for dashboards and cells test(bolt): all conformance tests for dashbaords and cells fix(bolt): rename dashboardV2Bucket to dashboardBucket feat(chronograf): introduce v2 dashboards Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): add tests for v2 dashboard reducer Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): create dashboard from dashboard index Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): move tests to same level of heirarchy as file tested chronograf(chore): implement import dashboard with v2 api chore(chronograf): delete dashboards from v2 api chore(chronograf): add source health handler chore(chronograf): move sources reducer to sources dir chore(chronograf): remove stutter in notify WIP stop namespacing by sourceID chore(chronograf): no longer namespace routes under sources/:sourceID WIP move dashtimeV1 to ranges WIP remove CEO chrore(chronograf): WIP Remove CEO and QueryMaker chore(chronograf): introduce updateDashboard v2 chore(chronograf): Change cell to view A dashboard's cell object now only contains positional information for the cell in it's grid and a reference to the cell's view data. A cell's view contains all necessary information for the cell's visualization. Add react-grid-layout types chore(chronograf): introduce add cell chore(chronograf): fix type errors Not on DashboardPage feat(platform): add cell methods to dashboard service interface feat(mock): update dashboard service with cell methods feat(testing): add cell methods to testing package feat(bolt): add dashboard cell methods to bolt dashbaord service feat(http): add cell routes to dashbaord handler feat(platform): add dependent create/destroy of views from cells chore(chronograf): introduce update dashboard cells endpoint WIP update cells FE fix(http): rename Cells to cells on dashboard cells response chore(chronograf): re-introduce dashboard cell dragging feat(platform): add copy dashboard cell to dashboard service chore(platform): rename cell to view across codebase feat(bolt): add replace dashboard tests Move Layouts to Cells Introduce delete cell Fix broken test fix(platform): update route for copying a a dashboard cell UI for delete cell Introduce copy cell feat(platform): add copy view options to AddDashboardCell feat(bolt): delete views when dashboard is removed. Cleanup Fix type errors Fix links not updating Remove annotations from RefreshingGraph Sources and types work fix(platform): add TODO.go files back fix(view): rename visualizationType to type in view JSON Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> fix(dashboardTime): change dashboardID to string Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> feat(http): add dashboard api to swagger documentation review(http): fix comments and function naming feat(http): update sources swagger documentation review(http): update the swagger to reflect the implementation feat(platform): add usingView options to POST /dashboard/:id/cells
2018-08-07 20:10:05 +00:00
var cellSvc platform.ViewService
{
cellSvc = c
}
var sourceSvc platform.SourceService
{
sourceSvc = c
}
var queryService query.QueryService
{
// TODO(lh): this is temporary until query endpoint is added here.
config := control.Config{
ExecutorDependencies: make(execute.Dependencies),
ConcurrencyQuota: runtime.NumCPU() * 2,
MemoryBytesQuota: 0,
Verbose: false,
}
queryService = query.QueryServiceBridge{
AsyncQueryService: control.New(config),
}
}
var taskSvc platform.TaskService
{
boltStore, err := taskbolt.New(c.DB(), "tasks")
if err != nil {
2018-08-07 22:51:33 +00:00
logger.Fatal("failed opening task bolt", zap.Error(err))
}
executor := taskexecutor.NewQueryServiceExecutor(logger, queryService, boltStore)
// TODO(lh): Replace NopLogWriter with real log writer
scheduler := taskbackend.NewScheduler(boltStore, executor, taskbackend.NopLogWriter{}, time.Now().UTC().Unix())
// TODO(lh): Replace NopLogReader with real log reader
taskSvc = task.PlatformAdapter(coordinator.New(scheduler, boltStore), taskbackend.NopLogReader{})
// TODO(lh): Add in `taskSvc = task.NewValidator(taskSvc)` once we have Authentication coming in the context.
// see issue #563
}
chronografSvc, err := server.NewServiceV2(context.TODO(), c.DB())
if err != nil {
logger.Error("failed creating chronograf service", zap.Error(err))
os.Exit(1)
}
errc := make(chan error)
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGTERM, os.Interrupt)
// NATS streaming server
natsServer := nats.NewServer(nats.Config{FilestoreDir: walPath})
if err := natsServer.Open(); err != nil {
logger.Error("failed to start nats streaming server", zap.Error(err))
os.Exit(1)
}
publisher := nats.NewAsyncPublisher("nats-publisher")
if err := publisher.Open(); err != nil {
logger.Error("failed to connect to streaming server", zap.Error(err))
os.Exit(1)
}
// TODO(jm): this is an example of using a subscriber to consume from the channel. It should be removed.
subscriber := nats.NewQueueSubscriber("nats-subscriber")
if err := subscriber.Open(); err != nil {
logger.Error("failed to connect to streaming server", zap.Error(err))
os.Exit(1)
}
if err := subscriber.Subscribe(NatsSubject, IngressGroup, &nats.LogHandler{Logger: logger}); err != nil {
logger.Error("failed to create nats subscriber", zap.Error(err))
os.Exit(1)
}
httpServer := &nethttp.Server{
Addr: httpBindAddress,
}
// HTTP server
go func() {
bucketHandler := http.NewBucketHandler()
bucketHandler.BucketService = bucketSvc
orgHandler := http.NewOrgHandler()
orgHandler.OrganizationService = orgSvc
userHandler := http.NewUserHandler()
userHandler.UserService = userSvc
dashboardHandler := http.NewDashboardHandler()
dashboardHandler.DashboardService = dashboardSvc
feat(platform): move chronogaf v2 dashboards to platform test(testing): add tests for dashboards and cells test(bolt): all conformance tests for dashbaords and cells fix(bolt): rename dashboardV2Bucket to dashboardBucket feat(chronograf): introduce v2 dashboards Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): add tests for v2 dashboard reducer Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): create dashboard from dashboard index Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): move tests to same level of heirarchy as file tested chronograf(chore): implement import dashboard with v2 api chore(chronograf): delete dashboards from v2 api chore(chronograf): add source health handler chore(chronograf): move sources reducer to sources dir chore(chronograf): remove stutter in notify WIP stop namespacing by sourceID chore(chronograf): no longer namespace routes under sources/:sourceID WIP move dashtimeV1 to ranges WIP remove CEO chrore(chronograf): WIP Remove CEO and QueryMaker chore(chronograf): introduce updateDashboard v2 chore(chronograf): Change cell to view A dashboard's cell object now only contains positional information for the cell in it's grid and a reference to the cell's view data. A cell's view contains all necessary information for the cell's visualization. Add react-grid-layout types chore(chronograf): introduce add cell chore(chronograf): fix type errors Not on DashboardPage feat(platform): add cell methods to dashboard service interface feat(mock): update dashboard service with cell methods feat(testing): add cell methods to testing package feat(bolt): add dashboard cell methods to bolt dashbaord service feat(http): add cell routes to dashbaord handler feat(platform): add dependent create/destroy of views from cells chore(chronograf): introduce update dashboard cells endpoint WIP update cells FE fix(http): rename Cells to cells on dashboard cells response chore(chronograf): re-introduce dashboard cell dragging feat(platform): add copy dashboard cell to dashboard service chore(platform): rename cell to view across codebase feat(bolt): add replace dashboard tests Move Layouts to Cells Introduce delete cell Fix broken test fix(platform): update route for copying a a dashboard cell UI for delete cell Introduce copy cell feat(platform): add copy view options to AddDashboardCell feat(bolt): delete views when dashboard is removed. Cleanup Fix type errors Fix links not updating Remove annotations from RefreshingGraph Sources and types work fix(platform): add TODO.go files back fix(view): rename visualizationType to type in view JSON Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> fix(dashboardTime): change dashboardID to string Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> feat(http): add dashboard api to swagger documentation review(http): fix comments and function naming feat(http): update sources swagger documentation review(http): update the swagger to reflect the implementation feat(platform): add usingView options to POST /dashboard/:id/cells
2018-08-07 20:10:05 +00:00
cellHandler := http.NewViewHandler()
cellHandler.ViewService = cellSvc
authHandler := http.NewAuthorizationHandler()
authHandler.AuthorizationService = authSvc
authHandler.Logger = logger.With(zap.String("handler", "auth"))
assetHandler := http.NewAssetHandler()
fluxLangHandler := http.NewFluxLangHandler()
sourceHandler := http.NewSourceHandler()
sourceHandler.SourceService = sourceSvc
feat(platform): add uniform query endpoint for sources Using query request struct to query resources Signed-off-by: Lorenzo Fontana <lo@linux.com> Use query.ProxyRequest instead query.Request Signed-off-by: Lorenzo Fontana <lo@linux.com> Proxy request from idpd Signed-off-by: Lorenzo Fontana <lo@linux.com> Comments about the desired results Signed-off-by: Lorenzo Fontana <lo@linux.com> V1 endpoints working with flux Signed-off-by: Lorenzo Fontana <lo@linux.com> Influxql working for v1 Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> V2 influxql query endpoint working Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Signed-off-by: Lorenzo Fontana <lo@linux.com> V2 Flux compiler support Co-authored-by: Michael De Sa <mjdesa@gmail.com> Signed-off-by: Lorenzo Fontana <lo@linux.com> Improve comments in bolt sources and give error on self Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Review tests failing Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Avoid type casts for compiler types Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> Using nil instead of dbrp mapping service for influxql v1 Signed-off-by: Lorenzo Fontana <lo@linux.com> Check if compiler types are valid for influxql Signed-off-by: Lorenzo Fontana <lo@linux.com> Organization as query param in the flux external handler Signed-off-by: Lorenzo Fontana <lo@linux.com> feat(http): update swagger documentation for flux query endpoint feat(http): document query endpoint design The code documented does not currently work. It is indended that this will be implemented in follow up PRs. feat(platform): move source to platform package The source Query endpoint implements what's in the query swagger docs Signed-off-by: Lorenzo Fontana <lo@linux.com> Co-authored-by: Michael De Sa <mjdesa@gmail.com> feat(platform): allow for encoding and decoding of csv dialects feat(platform): specify dialect in flux page Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com>
2018-08-28 19:53:20 +00:00
sourceHandler.NewBucketService = source.NewBucketService
sourceHandler.NewQueryService = source.NewQueryService
taskHandler := http.NewTaskHandler(logger)
taskHandler.TaskService = taskSvc
publishFn := func(r io.Reader) error {
return publisher.Publish(NatsSubject, r)
}
writeHandler := http.NewWriteHandler(publishFn)
writeHandler.AuthorizationService = authSvc
writeHandler.OrganizationService = orgSvc
writeHandler.BucketService = bucketSvc
writeHandler.Logger = logger.With(zap.String("handler", "write"))
// TODO(desa): what to do about idpe.
chronografHandler := http.NewChronografHandler(chronografSvc)
platformHandler := &http.PlatformHandler{
BucketHandler: bucketHandler,
OrgHandler: orgHandler,
UserHandler: userHandler,
AuthorizationHandler: authHandler,
DashboardHandler: dashboardHandler,
AssetHandler: assetHandler,
FluxLangHandler: fluxLangHandler,
ChronografHandler: chronografHandler,
SourceHandler: sourceHandler,
TaskHandler: taskHandler,
feat(platform): move chronogaf v2 dashboards to platform test(testing): add tests for dashboards and cells test(bolt): all conformance tests for dashbaords and cells fix(bolt): rename dashboardV2Bucket to dashboardBucket feat(chronograf): introduce v2 dashboards Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): add tests for v2 dashboard reducer Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): create dashboard from dashboard index Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> chore(chronograf): move tests to same level of heirarchy as file tested chronograf(chore): implement import dashboard with v2 api chore(chronograf): delete dashboards from v2 api chore(chronograf): add source health handler chore(chronograf): move sources reducer to sources dir chore(chronograf): remove stutter in notify WIP stop namespacing by sourceID chore(chronograf): no longer namespace routes under sources/:sourceID WIP move dashtimeV1 to ranges WIP remove CEO chrore(chronograf): WIP Remove CEO and QueryMaker chore(chronograf): introduce updateDashboard v2 chore(chronograf): Change cell to view A dashboard's cell object now only contains positional information for the cell in it's grid and a reference to the cell's view data. A cell's view contains all necessary information for the cell's visualization. Add react-grid-layout types chore(chronograf): introduce add cell chore(chronograf): fix type errors Not on DashboardPage feat(platform): add cell methods to dashboard service interface feat(mock): update dashboard service with cell methods feat(testing): add cell methods to testing package feat(bolt): add dashboard cell methods to bolt dashbaord service feat(http): add cell routes to dashbaord handler feat(platform): add dependent create/destroy of views from cells chore(chronograf): introduce update dashboard cells endpoint WIP update cells FE fix(http): rename Cells to cells on dashboard cells response chore(chronograf): re-introduce dashboard cell dragging feat(platform): add copy dashboard cell to dashboard service chore(platform): rename cell to view across codebase feat(bolt): add replace dashboard tests Move Layouts to Cells Introduce delete cell Fix broken test fix(platform): update route for copying a a dashboard cell UI for delete cell Introduce copy cell feat(platform): add copy view options to AddDashboardCell feat(bolt): delete views when dashboard is removed. Cleanup Fix type errors Fix links not updating Remove annotations from RefreshingGraph Sources and types work fix(platform): add TODO.go files back fix(view): rename visualizationType to type in view JSON Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> fix(dashboardTime): change dashboardID to string Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com> Co-authored-by: Michael Desa <mjdesa@gmail.com> feat(http): add dashboard api to swagger documentation review(http): fix comments and function naming feat(http): update sources swagger documentation review(http): update the swagger to reflect the implementation feat(platform): add usingView options to POST /dashboard/:id/cells
2018-08-07 20:10:05 +00:00
ViewHandler: cellHandler,
WriteHandler: writeHandler,
}
reg.MustRegister(platformHandler.PrometheusCollectors()...)
h := http.NewHandlerFromRegistry("platform", reg)
h.Handler = platformHandler
httpServer.Handler = h
logger.Info("listening", zap.String("transport", "http"), zap.String("addr", httpBindAddress))
errc <- httpServer.ListenAndServe()
}()
select {
case <-sigs:
case err := <-errc:
logger.Fatal("unable to start platform", zap.Error(err))
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
httpServer.Shutdown(ctx)
}
// Execute executes the idped command
func Execute() {
if err := platformCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}