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
9d84e6f3
Unverified
Commit
9d84e6f3
authored
Apr 10, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mssql: fix precision for time columns in time series query mode
parent
0317ecbf
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
347 additions
and
51 deletions
+347
-51
docker/blocks/mssql_tests/dashboard.json
+123
-26
pkg/tsdb/mssql/mssql.go
+8
-7
pkg/tsdb/mssql/mssql_test.go
+216
-18
No files found.
docker/blocks/mssql_tests/dashboard.json
View file @
9d84e6f3
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
"gnetId"
:
null
,
"gnetId"
:
null
,
"graphTooltip"
:
0
,
"graphTooltip"
:
0
,
"id"
:
null
,
"id"
:
null
,
"iteration"
:
152
1715844826
,
"iteration"
:
152
3320861623
,
"links"
:
[],
"links"
:
[],
"panels"
:
[
"panels"
:
[
{
{
...
@@ -443,7 +443,11 @@
...
@@ -443,7 +443,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -522,7 +526,11 @@
...
@@ -522,7 +526,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -601,7 +609,11 @@
...
@@ -601,7 +609,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -680,7 +692,11 @@
...
@@ -680,7 +692,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -759,7 +775,11 @@
...
@@ -759,7 +775,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -838,7 +858,11 @@
...
@@ -838,7 +858,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -927,7 +951,11 @@
...
@@ -927,7 +951,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1026,7 +1054,11 @@
...
@@ -1026,7 +1054,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1115,7 +1147,11 @@
...
@@ -1115,7 +1147,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1196,7 +1232,11 @@
...
@@ -1196,7 +1232,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1285,7 +1325,11 @@
...
@@ -1285,7 +1325,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1366,7 +1410,11 @@
...
@@ -1366,7 +1410,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1455,7 +1503,11 @@
...
@@ -1455,7 +1503,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1536,7 +1588,11 @@
...
@@ -1536,7 +1588,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1619,7 +1675,11 @@
...
@@ -1619,7 +1675,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1702,7 +1762,11 @@
...
@@ -1702,7 +1762,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1792,7 +1856,11 @@
...
@@ -1792,7 +1856,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1875,7 +1943,11 @@
...
@@ -1875,7 +1943,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -1965,7 +2037,11 @@
...
@@ -1965,7 +2037,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -2048,7 +2124,11 @@
...
@@ -2048,7 +2124,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -2138,7 +2218,11 @@
...
@@ -2138,7 +2218,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -2221,7 +2305,11 @@
...
@@ -2221,7 +2305,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -2311,7 +2399,11 @@
...
@@ -2311,7 +2399,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
},
},
{
{
"aliasColors"
:
{},
"aliasColors"
:
{},
...
@@ -2394,7 +2486,11 @@
...
@@ -2394,7 +2486,11 @@
"min"
:
null
,
"min"
:
null
,
"show"
:
true
"show"
:
true
}
}
]
],
"yaxis"
:
{
"align"
:
false
,
"alignLevel"
:
null
}
}
}
],
],
"refresh"
:
false
,
"refresh"
:
false
,
...
@@ -2504,5 +2600,5 @@
...
@@ -2504,5 +2600,5 @@
"timezone"
:
""
,
"timezone"
:
""
,
"title"
:
"Microsoft SQL Server Data Source Test"
,
"title"
:
"Microsoft SQL Server Data Source Test"
,
"uid"
:
"GlAqcPgmz"
,
"uid"
:
"GlAqcPgmz"
,
"version"
:
5
7
"version"
:
5
8
}
}
\ No newline at end of file
pkg/tsdb/mssql/mssql.go
View file @
9d84e6f3
...
@@ -8,8 +8,6 @@ import (
...
@@ -8,8 +8,6 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"time"
"math"
"math"
_
"github.com/denisenkom/go-mssqldb"
_
"github.com/denisenkom/go-mssqldb"
...
@@ -231,15 +229,18 @@ func (e MssqlQueryEndpoint) transformToTimeSeries(query *tsdb.Query, rows *core.
...
@@ -231,15 +229,18 @@ func (e MssqlQueryEndpoint) transformToTimeSeries(query *tsdb.Query, rows *core.
return
err
return
err
}
}
// converts column named time to unix timestamp in milliseconds to make
// native mysql datetime types and epoch dates work in
// annotation and table queries.
tsdb
.
ConvertSqlTimeColumnToEpochMs
(
values
,
timeIndex
)
switch
columnValue
:=
values
[
timeIndex
]
.
(
type
)
{
switch
columnValue
:=
values
[
timeIndex
]
.
(
type
)
{
case
int64
:
case
int64
:
timestamp
=
float64
(
columnValue
*
1000
)
timestamp
=
float64
(
columnValue
)
case
float64
:
case
float64
:
timestamp
=
columnValue
*
1000
timestamp
=
columnValue
case
time
.
Time
:
timestamp
=
(
float64
(
columnValue
.
Unix
())
*
1000
)
+
float64
(
columnValue
.
Nanosecond
()
/
1e6
)
// in case someone is trying to map times beyond 2262 :D
default
:
default
:
return
fmt
.
Errorf
(
"Invalid type for column time, must be of type timestamp or unix timestamp
"
)
return
fmt
.
Errorf
(
"Invalid type for column time, must be of type timestamp or unix timestamp
, got: %T %v"
,
columnValue
,
columnValue
)
}
}
if
metricIndex
>=
0
{
if
metricIndex
>=
0
{
...
...
pkg/tsdb/mssql/mssql_test.go
View file @
9d84e6f3
This diff is collapsed.
Click to expand it.
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