Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
05ed7811
Unverified
Commit
05ed7811
authored
Jun 22, 2020
by
Ryan McKinley
Committed by
GitHub
Jun 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InfluxDB: use released client 1.3.0 (#25725)
parent
b5b019df
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
14 deletions
+16
-14
go.mod
+1
-1
go.sum
+0
-0
pkg/tsdb/influxdb/flux/builder.go
+8
-8
pkg/tsdb/influxdb/flux/executor.go
+2
-2
pkg/tsdb/influxdb/flux/executor_test.go
+2
-1
pkg/tsdb/influxdb/flux/flux.go
+3
-2
No files found.
go.mod
View file @
05ed7811
...
...
@@ -35,7 +35,7 @@ require (
github.com/hashicorp/go-plugin v1.2.2
github.com/hashicorp/go-version v1.1.0
github.com/inconshreveable/log15 v0.0.0-20180818164646-67afb5ed74ec
github.com/influxdata/influxdb-client-go v1.
1.1-0.20200511153144-e63a28ffeba7
github.com/influxdata/influxdb-client-go v1.
3.0
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
github.com/jung-kurt/gofpdf v1.10.1
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
...
...
go.sum
View file @
05ed7811
This diff is collapsed.
Click to expand it.
pkg/tsdb/influxdb/flux/builder.go
View file @
05ed7811
...
...
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/grafana/grafana-plugin-sdk-go/data"
influxdb2
"github.com/influxdata/influxdb-client-go
"
"github.com/influxdata/influxdb-client-go/api/query
"
)
// Copied from: (Apache 2 license)
...
...
@@ -26,9 +26,9 @@ type columnInfo struct {
converter
*
data
.
FieldConverter
}
// This is an interface to help testing
//
FrameBuilder
This is an interface to help testing
type
FrameBuilder
struct
{
tableI
d
int64
tableI
D
int64
active
*
data
.
Frame
frames
[]
*
data
.
Frame
value
*
data
.
FieldConverter
...
...
@@ -72,10 +72,10 @@ func getConverter(t string) (*data.FieldConverter, error) {
// Init initializes the frame to be returned
// fields points at entries in the frame, and provides easier access
// names indexes the columns encountered
func
(
fb
*
FrameBuilder
)
Init
(
metadata
*
influxdb2
.
FluxTableMetadata
)
error
{
func
(
fb
*
FrameBuilder
)
Init
(
metadata
*
query
.
FluxTableMetadata
)
error
{
columns
:=
metadata
.
Columns
()
fb
.
frames
=
make
([]
*
data
.
Frame
,
0
)
fb
.
tableI
d
=
-
1
fb
.
tableI
D
=
-
1
fb
.
value
=
nil
fb
.
columns
=
make
([]
columnInfo
,
0
)
fb
.
isTimeSeries
=
false
...
...
@@ -120,9 +120,9 @@ func (fb *FrameBuilder) Init(metadata *influxdb2.FluxTableMetadata) error {
// Tags are appended as labels
// _measurement holds the dataframe name
// _field holds the field name.
func
(
fb
*
FrameBuilder
)
Append
(
record
*
influxdb2
.
FluxRecord
)
error
{
func
(
fb
*
FrameBuilder
)
Append
(
record
*
query
.
FluxRecord
)
error
{
table
,
ok
:=
record
.
ValueByKey
(
"table"
)
.
(
int64
)
if
ok
&&
table
!=
fb
.
tableI
d
{
if
ok
&&
table
!=
fb
.
tableI
D
{
fb
.
totalSeries
++
if
fb
.
totalSeries
>
fb
.
maxSeries
{
return
fmt
.
Errorf
(
"reached max series limit (%d)"
,
fb
.
maxSeries
)
...
...
@@ -153,7 +153,7 @@ func (fb *FrameBuilder) Append(record *influxdb2.FluxRecord) error {
}
fb
.
frames
=
append
(
fb
.
frames
,
fb
.
active
)
fb
.
tableI
d
=
table
fb
.
tableI
D
=
table
}
if
fb
.
isTimeSeries
{
...
...
pkg/tsdb/influxdb/flux/executor.go
View file @
05ed7811
...
...
@@ -6,7 +6,7 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
influxdb2
"github.com/influxdata/influxdb-client-go
"
"github.com/influxdata/influxdb-client-go/api
"
)
// ExecuteQuery runs a flux query using the QueryModel to interpolate the query and the runner to execute it.
...
...
@@ -45,7 +45,7 @@ func ExecuteQuery(ctx context.Context, query QueryModel, runner queryRunner, max
return
dr
}
func
readDataFrames
(
result
*
influxdb2
.
QueryTableResult
,
maxPoints
int
,
maxSeries
int
)
(
dr
backend
.
DataResponse
)
{
func
readDataFrames
(
result
*
api
.
QueryTableResult
,
maxPoints
int
,
maxSeries
int
)
(
dr
backend
.
DataResponse
)
{
dr
=
backend
.
DataResponse
{}
builder
:=
&
FrameBuilder
{
...
...
pkg/tsdb/influxdb/flux/executor_test.go
View file @
05ed7811
...
...
@@ -11,6 +11,7 @@ import (
"time"
influxdb2
"github.com/influxdata/influxdb-client-go"
"github.com/influxdata/influxdb-client-go/api"
)
//--------------------------------------------------------------
...
...
@@ -22,7 +23,7 @@ type MockRunner struct {
testDataPath
string
}
func
(
r
*
MockRunner
)
runQuery
(
ctx
context
.
Context
,
q
string
)
(
*
influxdb2
.
QueryTableResult
,
error
)
{
func
(
r
*
MockRunner
)
runQuery
(
ctx
context
.
Context
,
q
string
)
(
*
api
.
QueryTableResult
,
error
)
{
bytes
,
err
:=
ioutil
.
ReadFile
(
"./testdata/"
+
r
.
testDataPath
)
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/tsdb/influxdb/flux/flux.go
View file @
05ed7811
...
...
@@ -9,6 +9,7 @@ import (
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/tsdb"
influxdb2
"github.com/influxdata/influxdb-client-go"
"github.com/influxdata/influxdb-client-go/api"
)
var
(
...
...
@@ -53,11 +54,11 @@ type Runner struct {
// This is an interface to help testing
type
queryRunner
interface
{
runQuery
(
ctx
context
.
Context
,
q
string
)
(
*
influxdb2
.
QueryTableResult
,
error
)
runQuery
(
ctx
context
.
Context
,
q
string
)
(
*
api
.
QueryTableResult
,
error
)
}
// runQuery executes fluxQuery against the Runner's organization and returns an flux typed result.
func
(
r
*
Runner
)
runQuery
(
ctx
context
.
Context
,
fluxQuery
string
)
(
*
influxdb2
.
QueryTableResult
,
error
)
{
func
(
r
*
Runner
)
runQuery
(
ctx
context
.
Context
,
fluxQuery
string
)
(
*
api
.
QueryTableResult
,
error
)
{
return
r
.
client
.
QueryApi
(
r
.
org
)
.
Query
(
ctx
,
fluxQuery
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment