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
3c41d047
Commit
3c41d047
authored
Jun 08, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/mk-dhia/grafana
into mk-dhia-master
parents
c5d5d7ac
7c1dc244
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
8 deletions
+26
-8
public/app/plugins/datasource/elasticsearch/metric_agg.js
+4
-3
public/app/plugins/datasource/elasticsearch/partials/metric_agg.html
+5
-0
public/app/plugins/datasource/elasticsearch/query_builder.js
+7
-4
public/app/plugins/datasource/elasticsearch/specs/query_builder_specs.ts
+10
-1
No files found.
public/app/plugins/datasource/elasticsearch/metric_agg.js
View file @
3c41d047
...
...
@@ -67,7 +67,6 @@ function (angular, _, queryDef) {
}
else
if
(
!
$scope
.
agg
.
field
)
{
$scope
.
agg
.
field
=
'select field'
;
}
switch
(
$scope
.
agg
.
type
)
{
case
'cardinality'
:
{
var
precision_threshold
=
$scope
.
agg
.
settings
.
precision_threshold
||
''
;
...
...
@@ -103,12 +102,14 @@ function (angular, _, queryDef) {
break
;
}
case
'raw_document'
:
{
$scope
.
target
.
metrics
=
[
$scope
.
agg
];
$scope
.
agg
.
settings
.
size
=
$scope
.
agg
.
settings
.
size
||
500
;
$scope
.
settingsLinkText
=
'Size: '
+
$scope
.
agg
.
settings
.
size
;
$scope
.
target
.
metrics
.
splice
(
0
,
$scope
.
target
.
metrics
.
length
,
$scope
.
agg
);
$scope
.
target
.
bucketAggs
=
[];
break
;
}
}
if
(
$scope
.
aggDef
.
supportsInlineScript
)
{
// I know this stores the inline script twice
// but having it like this simplifes the query_builder
...
...
public/app/plugins/datasource/elasticsearch/partials/metric_agg.html
View file @
3c41d047
...
...
@@ -72,6 +72,11 @@
<label
class=
"gf-form-label width-10"
>
Percentiles
</label>
<input
type=
"text"
class=
"gf-form-input max-width-12"
ng-model=
"agg.settings.percents"
array-join
ng-blur=
"onChange()"
></input>
</div>
<div
class=
"gf-form offset-width-7"
ng-if=
"agg.type === 'raw_document'"
>
<label
class=
"gf-form-label width-10"
>
Size
</label>
<input
type=
"number"
class=
"gf-form-input max-width-12"
ng-model=
"agg.settings.size"
ng-blur=
"onChange()"
></input>
</div>
<div
class=
"gf-form offset-width-7"
ng-if=
"agg.type === 'cardinality'"
>
<label
class=
"gf-form-label width-10"
>
Precision threshold
</label>
...
...
public/app/plugins/datasource/elasticsearch/query_builder.js
View file @
3c41d047
...
...
@@ -109,8 +109,8 @@ function (queryDef) {
return
filterObj
;
};
ElasticQueryBuilder
.
prototype
.
documentQuery
=
function
(
query
)
{
query
.
size
=
500
;
ElasticQueryBuilder
.
prototype
.
documentQuery
=
function
(
query
,
size
)
{
query
.
size
=
size
===
undefined
?
500
:
size
;
query
.
sort
=
{};
query
.
sort
[
this
.
timeField
]
=
{
order
:
'desc'
,
unmapped_type
:
'boolean'
};
...
...
@@ -194,9 +194,12 @@ function (queryDef) {
if
(
target
.
bucketAggs
.
length
===
0
)
{
metric
=
target
.
metrics
[
0
];
if
(
metric
&&
metric
.
type
!==
'raw_document'
)
{
throw
{
message
:
'Invalid query'
};
target
.
bucketAggs
=
[{
type
:
'date_histogram'
,
id
:
'2'
,
settings
:
{
interval
:
'auto'
}}];
}
else
{
var
size
=
metric
&&
metric
.
hasOwnProperty
(
"settings"
)
&&
metric
.
settings
.
hasOwnProperty
(
"size"
)
&&
metric
.
settings
[
"size"
]
!==
null
?
metric
.
settings
[
"size"
]
:
500
;
return
this
.
documentQuery
(
query
,
size
);
}
return
this
.
documentQuery
(
query
,
target
);
}
nestedAggs
=
query
;
...
...
public/app/plugins/datasource/elasticsearch/specs/query_builder_specs.ts
View file @
3c41d047
...
...
@@ -156,13 +156,22 @@ describe('ElasticQueryBuilder', function() {
it
(
'with raw_document metric'
,
function
()
{
var
query
=
builder
.
build
({
metrics
:
[{
type
:
'raw_document'
,
id
:
'1'
}],
metrics
:
[{
type
:
'raw_document'
,
id
:
'1'
,
settings
:
{}
}],
timeField
:
'@timestamp'
,
bucketAggs
:
[],
});
expect
(
query
.
size
).
to
.
be
(
500
);
});
it
(
'with raw_document metric size set'
,
function
()
{
var
query
=
builder
.
build
({
metrics
:
[{
type
:
'raw_document'
,
id
:
'1'
,
settings
:
{
size
:
1337
}}],
timeField
:
'@timestamp'
,
bucketAggs
:
[],
});
expect
(
query
.
size
).
to
.
be
(
1337
);
});
it
(
'with moving average'
,
function
()
{
var
query
=
builder
.
build
({
...
...
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