Update Flux query URL for v1 sources

Previously, a v1 source was configured with a `URL` and `fluxURL`. The
`URL` was used for querying InfluxQL data, while the `fluxURL` pointed
to a `fluxd` instance and was used for querying Flux data.  Since then,
`fluxd` has been subsumed by the InfluxDB 1.7 release, which supports
both InfluxQL and Flux.

This commit updates the source proxy query service to query Flux data
from a V1 source directly.
pull/10616/head
Christopher Henn 2018-11-09 07:07:16 -08:00 committed by Chris Henn
parent a935aced36
commit 0b5f7a01ca
4 changed files with 2 additions and 18 deletions

View File

@ -37,10 +37,6 @@ func (s *SourceProxyQueryService) Query(ctx context.Context, w io.Writer, req *q
}
func (s *SourceProxyQueryService) fluxQuery(ctx context.Context, w io.Writer, req *query.ProxyRequest) (int64, error) {
if len(s.FluxURL) == 0 {
return 0, fmt.Errorf("fluxURL from source cannot be empty if the compiler type is flux")
}
request := struct {
Spec *flux.Spec `json:"spec"`
Query string `json:"query"`
@ -70,7 +66,7 @@ func (s *SourceProxyQueryService) fluxQuery(ctx context.Context, w io.Writer, re
}
}
u, err := newURL(s.FluxURL, "/query")
u, err := newURL(s.URL, "/api/v2/query")
if err != nil {
return 0, err
}

View File

@ -4665,9 +4665,6 @@ components:
format: uri
defaultRP:
type: string
fluxURL:
type: string
format: uri
languages:
type: array
readOnly: true

View File

@ -42,7 +42,6 @@ type V1SourceFields struct {
SharedSecret string `json:"sharedSecret,omitempty"` // ShareSecret is the optional signing secret for Influx JWT authorization
MetaURL string `json:"metaUrl,omitempty"` // MetaURL is the url for the meta node
DefaultRP string `json:"defaultRP"` // DefaultRP is the default retention policy used in database queries to this source
FluxURL string `json:"fluxURL,omitempty"` // FluxURL is the url for a flux connected to a 1x source
}
// SourceFields is used to authorize against an influx 2.0 source.
@ -78,7 +77,6 @@ type SourceUpdate struct {
Password *string `json:"password,omitempty"`
SharedSecret *string `json:"sharedSecret,omitempty"`
MetaURL *string `json:"metaURL,omitempty"`
FluxURL *string `json:"fluxURL,omitempty"`
Role *string `json:"role,omitempty"`
DefaultRP *string `json:"defaultRP"`
}
@ -115,9 +113,6 @@ func (u SourceUpdate) Apply(s *Source) error {
if u.MetaURL != nil {
s.MetaURL = *u.MetaURL
}
if u.FluxURL != nil {
s.FluxURL = *u.FluxURL
}
if u.DefaultRP != nil {
s.DefaultRP = *u.DefaultRP
}

View File

@ -26,11 +26,7 @@ func NewQueryService(s *platform.Source) (query.ProxyQueryService, error) {
SourceFields: s.SourceFields,
}, nil
case platform.V1SourceType:
// This can be an influxdb or an influxdb + fluxd.
// If it is an influxdb alone it is just a source configured with the url of an influxdb
// and will only accept "influxql" compilers, if it has a fluxd it will also accept "flux" compilers.
// If the compiler used is "influxql" the proxy request will be made on the platform.URL directly.
// If the compiler used is "flux" the proxy request will be made on the platform.V1SourceFields.FluxURL
// This is an InfluxDB 1.7 source, which supports both InfluxQL and Flux queries
return &influxdb.SourceProxyQueryService{
InsecureSkipVerify: s.InsecureSkipVerify,
URL: s.URL,