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
37a73b6b
Unverified
Commit
37a73b6b
authored
Feb 11, 2019
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure graphite takes dashboard timezone into consideration
parent
8f6ccce1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
public/app/plugins/datasource/graphite/datasource.ts
+16
-16
No files found.
public/app/plugins/datasource/graphite/datasource.ts
View file @
37a73b6b
...
@@ -31,8 +31,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -31,8 +31,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
this
.
query
=
function
(
options
)
{
this
.
query
=
function
(
options
)
{
const
graphOptions
=
{
const
graphOptions
=
{
from
:
this
.
translateTime
(
options
.
rangeRaw
.
from
,
false
),
from
:
this
.
translateTime
(
options
.
rangeRaw
.
from
,
false
,
options
.
timezone
),
until
:
this
.
translateTime
(
options
.
rangeRaw
.
to
,
true
),
until
:
this
.
translateTime
(
options
.
rangeRaw
.
to
,
true
,
options
.
timezone
),
targets
:
options
.
targets
,
targets
:
options
.
targets
,
format
:
options
.
format
,
format
:
options
.
format
,
cacheTimeout
:
options
.
cacheTimeout
||
this
.
cacheTimeout
,
cacheTimeout
:
options
.
cacheTimeout
||
this
.
cacheTimeout
,
...
@@ -165,9 +165,9 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -165,9 +165,9 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
method
:
'GET'
,
method
:
'GET'
,
url
:
url
:
'/events/get_data?from='
+
'/events/get_data?from='
+
this
.
translateTime
(
options
.
range
.
from
,
false
)
+
this
.
translateTime
(
options
.
range
.
from
,
false
,
options
.
timezone
)
+
'&until='
+
'&until='
+
this
.
translateTime
(
options
.
range
.
to
,
true
)
+
this
.
translateTime
(
options
.
range
.
to
,
true
,
options
.
timezone
)
+
tags
,
tags
,
});
});
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -179,7 +179,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -179,7 +179,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
return
templateSrv
.
variableExists
(
target
.
target
);
return
templateSrv
.
variableExists
(
target
.
target
);
};
};
this
.
translateTime
=
(
date
,
roundUp
)
=>
{
this
.
translateTime
=
(
date
,
roundUp
,
timezone
)
=>
{
if
(
_
.
isString
(
date
))
{
if
(
_
.
isString
(
date
))
{
if
(
date
===
'now'
)
{
if
(
date
===
'now'
)
{
return
'now'
;
return
'now'
;
...
@@ -189,7 +189,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -189,7 +189,7 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
date
=
date
.
replace
(
'M'
,
'mon'
);
date
=
date
.
replace
(
'M'
,
'mon'
);
return
date
;
return
date
;
}
}
date
=
dateMath
.
parse
(
date
,
roundUp
);
date
=
dateMath
.
parse
(
date
,
roundUp
,
timezone
);
}
}
// graphite' s from filter is exclusive
// graphite' s from filter is exclusive
...
@@ -255,8 +255,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -255,8 +255,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
};
};
if
(
options
.
range
)
{
if
(
options
.
range
)
{
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
);
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
,
options
.
timezone
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
,
options
.
timezone
);
}
}
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
...
@@ -280,8 +280,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -280,8 +280,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
};
};
if
(
options
.
range
)
{
if
(
options
.
range
)
{
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
);
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
,
options
.
timezone
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
,
options
.
timezone
);
}
}
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
...
@@ -305,8 +305,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -305,8 +305,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
};
};
if
(
options
.
range
)
{
if
(
options
.
range
)
{
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
);
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
,
options
.
timezone
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
,
options
.
timezone
);
}
}
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
...
@@ -343,8 +343,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -343,8 +343,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
httpOptions
.
params
.
limit
=
options
.
limit
;
httpOptions
.
params
.
limit
=
options
.
limit
;
}
}
if
(
options
.
range
)
{
if
(
options
.
range
)
{
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
);
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
,
options
.
timezone
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
,
options
.
timezone
);
}
}
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
...
@@ -379,8 +379,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
...
@@ -379,8 +379,8 @@ export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv,
httpOptions
.
params
.
limit
=
options
.
limit
;
httpOptions
.
params
.
limit
=
options
.
limit
;
}
}
if
(
options
.
range
)
{
if
(
options
.
range
)
{
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
);
httpOptions
.
params
.
from
=
this
.
translateTime
(
options
.
range
.
from
,
false
,
options
.
timezone
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
);
httpOptions
.
params
.
until
=
this
.
translateTime
(
options
.
range
.
to
,
true
,
options
.
timezone
);
}
}
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
return
this
.
doGraphiteRequest
(
httpOptions
).
then
(
results
=>
{
...
...
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