influxdb/http/source_proxy_service.go

120 lines
3.4 KiB
Go
Raw Normal View History

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
package http
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"github.com/influxdata/flux"
"github.com/influxdata/flux/lang"
platform "github.com/influxdata/influxdb"
2019-03-05 00:38:10 +00:00
"github.com/influxdata/influxdb/kit/tracing"
"github.com/influxdata/influxdb/query"
"github.com/influxdata/influxdb/query/influxql"
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
)
type SourceProxyQueryService struct {
Addr string
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
InsecureSkipVerify bool
platform.SourceFields
}
func (s *SourceProxyQueryService) Query(ctx context.Context, w io.Writer, req *query.ProxyRequest) (flux.Statistics, error) {
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
switch req.Request.Compiler.CompilerType() {
case influxql.CompilerType:
return s.queryInfluxQL(ctx, w, req)
case lang.FluxCompilerType:
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
return s.queryFlux(ctx, w, req)
}
return flux.Statistics{}, fmt.Errorf("compiler type not supported")
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
}
func (s *SourceProxyQueryService) queryFlux(ctx context.Context, w io.Writer, req *query.ProxyRequest) (flux.Statistics, error) {
2019-03-06 00:18:04 +00:00
span, ctx := tracing.StartSpanFromContext(ctx)
2019-03-05 00:38:10 +00:00
defer span.Finish()
u, err := newURL(s.Addr, "/api/v2/query")
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
if err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
var body bytes.Buffer
if err := json.NewEncoder(&body).Encode(req); err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
hreq, err := http.NewRequest("POST", u.String(), &body)
if err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
hreq.Header.Set("Authorization", fmt.Sprintf("Token %s", s.Token))
hreq.Header.Set("Content-Type", "application/json")
hreq = hreq.WithContext(ctx)
2019-03-05 00:38:10 +00:00
tracing.InjectToHTTPRequest(span, hreq)
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
hc := newClient(u.Scheme, s.InsecureSkipVerify)
resp, err := hc.Do(hreq)
if err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
defer resp.Body.Close()
if err := CheckError(resp); err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
if _, err = io.Copy(w, resp.Body); err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
}
return flux.Statistics{}, nil
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
}
func (s *SourceProxyQueryService) queryInfluxQL(ctx context.Context, w io.Writer, req *query.ProxyRequest) (flux.Statistics, error) {
2019-03-06 00:18:04 +00:00
span, ctx := tracing.StartSpanFromContext(ctx)
2019-03-05 00:38:10 +00:00
defer span.Finish()
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
compiler, ok := req.Request.Compiler.(*influxql.Compiler)
if !ok {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, fmt.Errorf("compiler is not of type 'influxql'"))
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
}
u, err := newURL(s.Addr, "/query")
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
if err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
body := url.Values{}
body.Add("db", compiler.DB)
body.Add("org", compiler.Cluster)
body.Add("q", compiler.Query)
body.Add("rp", compiler.RP)
hreq, err := http.NewRequest("POST", u.String(), strings.NewReader(body.Encode()))
if err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
hreq.Header.Set("Content-Type", "application/x-www-form-urlencoded")
hreq.Header.Set("Authorization", fmt.Sprintf("Token %s", s.Token))
hreq = hreq.WithContext(ctx)
hc := newClient(u.Scheme, s.InsecureSkipVerify)
resp, err := hc.Do(hreq)
if err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
defer resp.Body.Close()
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
if err := CheckError(resp); err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
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
}
if _, err = io.Copy(w, resp.Body); err != nil {
2019-03-05 00:38:10 +00:00
return flux.Statistics{}, tracing.LogError(span, err)
}
return flux.Statistics{}, nil
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
}