live: add ws endpoint to push into pipeline (#41534)

This commit is contained in:
Alexander Emelin
2021-11-15 12:43:18 +03:00
committed by GitHub
parent f3f441f4ec
commit 1700b2c2f3
9 changed files with 334 additions and 213 deletions
+3 -7
View File
@@ -96,9 +96,8 @@ func (g *Gateway) Handle(ctx *models.ReqContext) {
}
}
func (g *Gateway) HandlePath(ctx *models.ReqContext) {
streamID := web.Params(ctx.Req)[":streamId"]
path := web.Params(ctx.Req)[":path"]
func (g *Gateway) HandlePipelinePush(ctx *models.ReqContext) {
channelID := web.Params(ctx.Req)["*"]
body, err := io.ReadAll(ctx.Req.Body)
if err != nil {
@@ -108,13 +107,10 @@ func (g *Gateway) HandlePath(ctx *models.ReqContext) {
}
logger.Debug("Live channel push request",
"protocol", "http",
"streamId", streamID,
"path", path,
"channel", channelID,
"bodyLength", len(body),
)
channelID := "stream/" + streamID + "/" + path
ruleFound, err := g.GrafanaLive.Pipeline.ProcessInput(ctx.Req.Context(), ctx.OrgId, channelID, body)
if err != nil {
logger.Error("Pipeline input processing error", "error", err, "body", string(body))