Live: expose HTTP push endpoint that will read influx line protocol and publish to websocket (#32311)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Alexander Emelin
2021-04-05 19:04:46 +03:00
committed by GitHub
parent 7896c6a7b1
commit 54ad791c7e
25 changed files with 576 additions and 130 deletions

View File

@@ -402,6 +402,12 @@ func (hs *HTTPServer) registerRoutes() {
if hs.Live.IsEnabled() {
apiRoute.Post("/live/publish", bind(dtos.LivePublishCmd{}), routing.Wrap(hs.Live.HandleHTTPPublish))
// POST influx line protocol
apiRoute.Post("/live/push/:streamId", hs.LivePushGateway.Handle)
// List available streams and fields
apiRoute.Get("/live/list", routing.Wrap(hs.Live.HandleListHTTP))
}
// short urls

View File

@@ -35,6 +35,7 @@ import (
"github.com/grafana/grafana/pkg/services/hooks"
"github.com/grafana/grafana/pkg/services/librarypanels"
"github.com/grafana/grafana/pkg/services/live"
"github.com/grafana/grafana/pkg/services/live/push"
"github.com/grafana/grafana/pkg/services/login"
"github.com/grafana/grafana/pkg/services/provisioning"
"github.com/grafana/grafana/pkg/services/quota"
@@ -87,6 +88,7 @@ type HTTPServer struct {
SearchService *search.SearchService `inject:""`
ShortURLService *shorturls.ShortURLService `inject:""`
Live *live.GrafanaLive `inject:""`
LivePushGateway *push.Gateway `inject:""`
ContextHandler *contexthandler.ContextHandler `inject:""`
SQLStore *sqlstore.SQLStore `inject:""`
LibraryPanelService *librarypanels.LibraryPanelService `inject:""`