Commit 5af81b97 by Torkel Ödegaard

mysql: graph showing

parent a7babfb7
......@@ -7,3 +7,6 @@ mysql:
MYSQL_PASSWORD: password
ports:
- "3306:3306"
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
......@@ -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
})
......
......@@ -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
......
<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>
......
......@@ -14,6 +14,7 @@
}
},
"alerting": true,
"annotations": true,
"metrics": true
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment