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
c80eadcd
Commit
c80eadcd
authored
Dec 06, 2017
by
Sven Klemm
Committed by
Daniel Lee
Dec 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle native postgres datetime types in annotation queries (#9986)
parent
373389c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
pkg/tsdb/postgres/postgres.go
+18
-0
No files found.
pkg/tsdb/postgres/postgres.go
View file @
c80eadcd
...
...
@@ -78,6 +78,15 @@ func (e PostgresQueryEndpoint) transformToTable(query *tsdb.Query, rows *core.Ro
rowLimit
:=
1000000
rowCount
:=
0
timeIndex
:=
-
1
// check if there is a column named time
for
i
,
col
:=
range
columnNames
{
switch
col
{
case
"time"
:
timeIndex
=
i
}
}
for
;
rows
.
Next
();
rowCount
++
{
if
rowCount
>
rowLimit
{
...
...
@@ -89,6 +98,15 @@ func (e PostgresQueryEndpoint) transformToTable(query *tsdb.Query, rows *core.Ro
return
err
}
// convert column named time to unix timestamp to make
// native datetime postgres types work in annotation queries
if
timeIndex
!=
-
1
{
switch
value
:=
values
[
timeIndex
]
.
(
type
)
{
case
time
.
Time
:
values
[
timeIndex
]
=
float64
(
value
.
UnixNano
()
/
1e9
)
}
}
table
.
Rows
=
append
(
table
.
Rows
,
values
)
}
...
...
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