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
1f74b298
Commit
1f74b298
authored
Jul 16, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove string casting for template variables in prometheus
parent
1efe34e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
public/app/features/panel/metrics_panel_ctrl.ts
+1
-1
public/app/plugins/datasource/prometheus/datasource.ts
+1
-1
public/app/plugins/datasource/prometheus/specs/datasource_specs.ts
+18
-18
No files found.
public/app/features/panel/metrics_panel_ctrl.ts
View file @
1f74b298
...
...
@@ -222,7 +222,7 @@ class MetricsPanelCtrl extends PanelCtrl {
// and add built in variables interval and interval_ms
var
scopedVars
=
Object
.
assign
({},
this
.
panel
.
scopedVars
,
{
__interval
:
{
text
:
this
.
interval
,
value
:
this
.
interval
},
__interval_ms
:
{
text
:
String
(
this
.
intervalMs
),
value
:
String
(
this
.
intervalMs
)
},
__interval_ms
:
{
text
:
this
.
intervalMs
,
value
:
this
.
intervalMs
},
});
var
metricsQuery
=
{
...
...
public/app/plugins/datasource/prometheus/datasource.ts
View file @
1f74b298
...
...
@@ -202,7 +202,7 @@ export class PrometheusDatasource {
interval = adjustedInterval;
scopedVars = Object.assign({}, options.scopedVars, {
__interval: { text: interval + '
s
', value: interval + '
s
' },
__interval_ms: { text:
String(interval * 1000), value: String(interval * 1000)
},
__interval_ms: { text:
interval * 1000, value: interval * 1000
},
});
}
query.step = interval;
...
...
public/app/plugins/datasource/prometheus/specs/datasource_specs.ts
View file @
1f74b298
...
...
@@ -452,7 +452,7 @@ describe('PrometheusDatasource', function() {
interval
:
'10s'
,
scopedVars
:
{
__interval
:
{
text
:
'10s'
,
value
:
'10s'
},
__interval_ms
:
{
text
:
String
(
10
*
1000
),
value
:
String
(
10
*
1000
)
},
__interval_ms
:
{
text
:
10
*
1000
,
value
:
10
*
1000
},
},
};
var
urlExpected
=
...
...
@@ -463,8 +463,8 @@ describe('PrometheusDatasource', function() {
expect
(
query
.
scopedVars
.
__interval
.
text
).
to
.
be
(
'10s'
);
expect
(
query
.
scopedVars
.
__interval
.
value
).
to
.
be
(
'10s'
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
String
(
10
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
String
(
10
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
10
*
1000
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
10
*
1000
);
});
it
(
'should be min interval when it is greater than auto interval'
,
function
()
{
var
query
=
{
...
...
@@ -479,7 +479,7 @@ describe('PrometheusDatasource', function() {
interval
:
'5s'
,
scopedVars
:
{
__interval
:
{
text
:
'5s'
,
value
:
'5s'
},
__interval_ms
:
{
text
:
String
(
5
*
1000
),
value
:
String
(
5
*
1000
)
},
__interval_ms
:
{
text
:
5
*
1000
,
value
:
5
*
1000
},
},
};
var
urlExpected
=
...
...
@@ -490,8 +490,8 @@ describe('PrometheusDatasource', function() {
expect
(
query
.
scopedVars
.
__interval
.
text
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval
.
value
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
5
*
1000
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
5
*
1000
);
});
it
(
'should account for intervalFactor'
,
function
()
{
var
query
=
{
...
...
@@ -507,7 +507,7 @@ describe('PrometheusDatasource', function() {
interval
:
'10s'
,
scopedVars
:
{
__interval
:
{
text
:
'10s'
,
value
:
'10s'
},
__interval_ms
:
{
text
:
String
(
10
*
1000
),
value
:
String
(
10
*
1000
)
},
__interval_ms
:
{
text
:
10
*
1000
,
value
:
10
*
1000
},
},
};
var
urlExpected
=
...
...
@@ -518,8 +518,8 @@ describe('PrometheusDatasource', function() {
expect
(
query
.
scopedVars
.
__interval
.
text
).
to
.
be
(
'10s'
);
expect
(
query
.
scopedVars
.
__interval
.
value
).
to
.
be
(
'10s'
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
String
(
10
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
String
(
10
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
10
*
1000
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
10
*
1000
);
});
it
(
'should be interval * intervalFactor when greater than min interval'
,
function
()
{
var
query
=
{
...
...
@@ -535,7 +535,7 @@ describe('PrometheusDatasource', function() {
interval
:
'5s'
,
scopedVars
:
{
__interval
:
{
text
:
'5s'
,
value
:
'5s'
},
__interval_ms
:
{
text
:
String
(
5
*
1000
),
value
:
String
(
5
*
1000
)
},
__interval_ms
:
{
text
:
5
*
1000
,
value
:
5
*
1000
},
},
};
var
urlExpected
=
...
...
@@ -546,8 +546,8 @@ describe('PrometheusDatasource', function() {
expect
(
query
.
scopedVars
.
__interval
.
text
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval
.
value
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
5
*
1000
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
5
*
1000
);
});
it
(
'should be min interval when greater than interval * intervalFactor'
,
function
()
{
var
query
=
{
...
...
@@ -563,7 +563,7 @@ describe('PrometheusDatasource', function() {
interval
:
'5s'
,
scopedVars
:
{
__interval
:
{
text
:
'5s'
,
value
:
'5s'
},
__interval_ms
:
{
text
:
String
(
5
*
1000
),
value
:
String
(
5
*
1000
)
},
__interval_ms
:
{
text
:
5
*
1000
,
value
:
5
*
1000
},
},
};
var
urlExpected
=
...
...
@@ -574,8 +574,8 @@ describe('PrometheusDatasource', function() {
expect
(
query
.
scopedVars
.
__interval
.
text
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval
.
value
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
5
*
1000
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
5
*
1000
);
});
it
(
'should be determined by the 11000 data points limit, accounting for intervalFactor'
,
function
()
{
var
query
=
{
...
...
@@ -590,7 +590,7 @@ describe('PrometheusDatasource', function() {
interval
:
'5s'
,
scopedVars
:
{
__interval
:
{
text
:
'5s'
,
value
:
'5s'
},
__interval_ms
:
{
text
:
String
(
5
*
1000
),
value
:
String
(
5
*
1000
)
},
__interval_ms
:
{
text
:
5
*
1000
,
value
:
5
*
1000
},
},
};
var
end
=
7
*
24
*
60
*
60
;
...
...
@@ -609,8 +609,8 @@ describe('PrometheusDatasource', function() {
expect
(
query
.
scopedVars
.
__interval
.
text
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval
.
value
).
to
.
be
(
'5s'
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
String
(
5
*
1000
)
);
expect
(
query
.
scopedVars
.
__interval_ms
.
text
).
to
.
be
(
5
*
1000
);
expect
(
query
.
scopedVars
.
__interval_ms
.
value
).
to
.
be
(
5
*
1000
);
});
});
});
...
...
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