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
d882af9f
Commit
d882af9f
authored
Dec 16, 2015
by
carl bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'es_drop_first_last' of
https://github.com/Qtax/grafana
into Qtax-es_drop_first_last
parents
48539c85
bf41eb82
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
12 deletions
+32
-12
public/app/plugins/datasource/elasticsearch/bucket_agg.js
+3
-0
public/app/plugins/datasource/elasticsearch/elastic_response.js
+9
-8
public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html
+20
-4
No files found.
public/app/plugins/datasource/elasticsearch/bucket_agg.js
View file @
d882af9f
...
...
@@ -96,6 +96,9 @@ function (angular, _, queryDef) {
$scope
.
agg
.
field
=
$scope
.
target
.
timeField
;
settingsLinkText
=
'Interval: '
+
settings
.
interval
;
settingsLinkText
+=
', Min Doc Count: '
+
settings
.
min_doc_count
;
if
(
settings
.
dropFirstLast
)
{
settingsLinkText
+=
', Drop first & last value'
;
}
}
}
...
...
public/app/plugins/datasource/elasticsearch/elastic_response.js
View file @
d882af9f
...
...
@@ -10,8 +10,9 @@ function (_, queryDef) {
this
.
response
=
response
;
}
ElasticResponse
.
prototype
.
processMetrics
=
function
(
esAgg
,
target
,
seriesList
,
props
)
{
ElasticResponse
.
prototype
.
processMetrics
=
function
(
esAgg
,
target
,
seriesList
,
props
,
dropFirstLast
)
{
var
metric
,
y
,
i
,
newSeries
,
bucket
,
value
;
dropFirstLast
=
dropFirstLast
?
1
:
0
;
for
(
y
=
0
;
y
<
target
.
metrics
.
length
;
y
++
)
{
metric
=
target
.
metrics
[
y
];
...
...
@@ -22,7 +23,7 @@ function (_, queryDef) {
switch
(
metric
.
type
)
{
case
'count'
:
{
newSeries
=
{
datapoints
:
[],
metric
:
'count'
,
props
:
props
};
for
(
i
=
0
;
i
<
esAgg
.
buckets
.
length
;
i
++
)
{
for
(
i
=
dropFirstLast
;
i
<
esAgg
.
buckets
.
length
-
dropFirstLast
;
i
++
)
{
bucket
=
esAgg
.
buckets
[
i
];
value
=
bucket
.
doc_count
;
newSeries
.
datapoints
.
push
([
value
,
bucket
.
key
]);
...
...
@@ -31,17 +32,17 @@ function (_, queryDef) {
break
;
}
case
'percentiles'
:
{
if
(
esAgg
.
buckets
.
length
==
=
0
)
{
if
(
esAgg
.
buckets
.
length
-
dropFirstLast
*
2
<
=
0
)
{
break
;
}
var
firstBucket
=
esAgg
.
buckets
[
0
];
var
firstBucket
=
esAgg
.
buckets
[
dropFirstLast
];
var
percentiles
=
firstBucket
[
metric
.
id
].
values
;
for
(
var
percentileName
in
percentiles
)
{
newSeries
=
{
datapoints
:
[],
metric
:
'p'
+
percentileName
,
props
:
props
,
field
:
metric
.
field
};
for
(
i
=
0
;
i
<
esAgg
.
buckets
.
length
;
i
++
)
{
for
(
i
=
dropFirstLast
;
i
<
esAgg
.
buckets
.
length
-
dropFirstLast
;
i
++
)
{
bucket
=
esAgg
.
buckets
[
i
];
var
values
=
bucket
[
metric
.
id
].
values
;
newSeries
.
datapoints
.
push
([
values
[
percentileName
],
bucket
.
key
]);
...
...
@@ -59,7 +60,7 @@ function (_, queryDef) {
newSeries
=
{
datapoints
:
[],
metric
:
statName
,
props
:
props
,
field
:
metric
.
field
};
for
(
i
=
0
;
i
<
esAgg
.
buckets
.
length
;
i
++
)
{
for
(
i
=
dropFirstLast
;
i
<
esAgg
.
buckets
.
length
-
dropFirstLast
;
i
++
)
{
bucket
=
esAgg
.
buckets
[
i
];
var
stats
=
bucket
[
metric
.
id
];
...
...
@@ -77,7 +78,7 @@ function (_, queryDef) {
}
default
:
{
newSeries
=
{
datapoints
:
[],
metric
:
metric
.
type
,
field
:
metric
.
field
,
props
:
props
};
for
(
i
=
0
;
i
<
esAgg
.
buckets
.
length
;
i
++
)
{
for
(
i
=
dropFirstLast
;
i
<
esAgg
.
buckets
.
length
-
dropFirstLast
;
i
++
)
{
bucket
=
esAgg
.
buckets
[
i
];
value
=
bucket
[
metric
.
id
];
...
...
@@ -158,7 +159,7 @@ function (_, queryDef) {
if
(
depth
===
maxDepth
)
{
if
(
aggDef
.
type
===
'date_histogram'
)
{
this
.
processMetrics
(
esAgg
,
target
,
seriesList
,
props
);
this
.
processMetrics
(
esAgg
,
target
,
seriesList
,
props
,
aggDef
.
settings
&&
aggDef
.
settings
.
dropFirstLast
);
}
else
{
this
.
processAggregationDocs
(
esAgg
,
aggDef
,
target
,
docs
,
props
);
}
...
...
public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html
View file @
d882af9f
...
...
@@ -37,7 +37,7 @@
<div
class=
"tight-form-inner-box"
ng-if=
"agg.type === 'date_histogram'"
>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width:
94
px"
>
<li
class=
"tight-form-item"
style=
"width:
140
px"
>
Interval
</li>
<li>
...
...
@@ -46,13 +46,29 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form
last
"
>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width:
94
px"
>
<li
class=
"tight-form-item"
style=
"width:
140
px"
>
Min Doc Count
</li>
<li>
<input
type=
"number"
class=
"tight-form-input"
ng-model=
"agg.settings.min_doc_count"
ng-blur=
"onChangeInternal()"
></input>
<input
type=
"number"
class=
"tight-form-input"
ng-model=
"agg.settings.min_doc_count"
ng-blur=
"onChangeInternal()"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form last"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 140px"
>
Drop first
&
last value
</li>
<li
class=
"tight-form-item"
>
<input
class=
"cr1"
type=
"checkbox"
id=
"agg[{{agg.id}}].settings.dropFirstLast"
ng-model=
"agg.settings.dropFirstLast"
ng-checked=
"agg.settings.dropFirstLast"
ng-change=
"onChangeInternal()"
>
<label
for=
"agg[{{agg.id}}].settings.dropFirstLast"
class=
"cr1"
></label>
</li>
<li
class=
"tight-form-item last"
>
<i
class=
"fa fa-question-circle"
bs-tooltip=
"'Ignore the first and last values of the dataset'"
data-placement=
"right"
></i>
</li>
</ul>
<div
class=
"clearfix"
></div>
...
...
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