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
5af81b97
Commit
5af81b97
authored
Mar 31, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql: graph showing
parent
a7babfb7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
13 deletions
+16
-13
docker/blocks/mysql/fig
+3
-0
pkg/services/sqlstore/sql_test_data.go
+7
-0
pkg/tsdb/mysql/mysql.go
+4
-12
public/app/plugins/datasource/mysql/partials/query.editor.html
+1
-1
public/app/plugins/datasource/mysql/plugin.json
+1
-0
No files found.
docker/blocks/mysql/fig
View file @
5af81b97
...
...
@@ -7,3 +7,6 @@ mysql:
MYSQL_PASSWORD: password
ports:
- "3306:3306"
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
pkg/services/sqlstore/sql_test_data.go
View file @
5af81b97
...
...
@@ -58,6 +58,13 @@ func InsertSqlTestData(cmd *m.InsertSqlTestDataCommand) error {
sqlog
.
Info
(
"SQL TestData: Truncate done"
,
"rows"
,
rows
)
sqlRandomWalk
(
"server1"
,
"frontend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server2"
,
"frontend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server3"
,
"frontend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server1"
,
"backend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server2"
,
"backend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server3"
,
"backend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"db-server1"
,
"backend"
,
100
,
1.123
,
sess
)
return
err
})
...
...
pkg/tsdb/mysql/mysql.go
View file @
5af81b97
...
...
@@ -93,20 +93,15 @@ func (e *MysqlExecutor) Execute(ctx context.Context, queries tsdb.QuerySlice, co
rows
,
err
:=
db
.
Query
(
rawSql
)
if
err
!=
nil
{
result
.
Error
=
err
return
result
result
.
QueryResults
[
query
.
RefId
]
=
&
tsdb
.
QueryResult
{
Error
:
err
}
continue
}
defer
rows
.
Close
()
result
.
QueryResults
[
query
.
RefId
]
=
e
.
TransformToTimeSeries
(
query
,
rows
)
}
for
_
,
value
:=
range
result
.
QueryResults
{
if
value
.
Error
!=
nil
{
e
.
log
.
Error
(
"error"
,
"error"
,
value
.
Error
)
}
}
return
result
}
...
...
@@ -190,7 +185,6 @@ func (s *stringStringScan) Update(rows *sql.Rows) error {
for
i
:=
0
;
i
<
s
.
columnCount
;
i
++
{
if
rb
,
ok
:=
s
.
rowPtrs
[
i
]
.
(
*
sql
.
RawBytes
);
ok
{
s
.
rowValues
[
i
]
=
string
(
*
rb
)
fmt
.
Printf
(
"column %s = %s"
,
s
.
columnNames
[
i
],
s
.
rowValues
[
i
])
switch
s
.
columnNames
[
i
]
{
case
"time_sec"
:
...
...
@@ -202,9 +196,7 @@ func (s *stringStringScan) Update(rows *sql.Rows) error {
s
.
value
=
null
.
FloatFrom
(
value
)
}
case
"metric"
:
if
value
,
err
:=
strconv
.
ParseFloat
(
s
.
rowValues
[
i
],
64
);
err
==
nil
{
s
.
value
=
null
.
FloatFrom
(
value
)
}
s
.
metric
=
s
.
rowValues
[
i
]
}
*
rb
=
nil
// reset pointer to discard current value to avoid a bug
...
...
public/app/plugins/datasource/mysql/partials/query.editor.html
View file @
5af81b97
<query-editor-row
query-ctrl=
"ctrl"
can-collapse=
"false"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form gf-form--grow"
>
<textarea
rows=
"6"
class=
"gf-form-input"
ng-model=
"ctrl.target.rawSql"
spellcheck=
"false"
placeholder=
"query expression"
data-min-length=
0
data-items=
100
ng-model-onblur
ng-change=
"ctrl.
refreshMetricData
()"
></textarea>
<textarea
rows=
"6"
class=
"gf-form-input"
ng-model=
"ctrl.target.rawSql"
spellcheck=
"false"
placeholder=
"query expression"
data-min-length=
0
data-items=
100
ng-model-onblur
ng-change=
"ctrl.
panelCtrl.refresh
()"
></textarea>
</div>
</div>
...
...
public/app/plugins/datasource/mysql/plugin.json
View file @
5af81b97
...
...
@@ -14,6 +14,7 @@
}
},
"alerting"
:
true
,
"annotations"
:
true
,
"metrics"
:
true
}
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