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
dc30b9d3
Commit
dc30b9d3
authored
Dec 16, 2015
by
carl bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(elastic): change concept to trim edges instead.
parent
37cfe2a3
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
17 deletions
+21
-17
public/app/plugins/datasource/elasticsearch/bucket_agg.js
+7
-2
public/app/plugins/datasource/elasticsearch/elastic_response.js
+6
-5
public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html
+7
-9
public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts
+1
-1
No files found.
public/app/plugins/datasource/elasticsearch/bucket_agg.js
View file @
dc30b9d3
...
...
@@ -96,8 +96,13 @@ 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'
;
if
(
settings
.
trimEdges
===
undefined
||
settings
.
trimEdges
<
0
)
{
settings
.
trimEdges
=
0
;
}
if
(
settings
.
trimEdges
&&
settings
.
trimEdges
>
0
)
{
settingsLinkText
+=
', Trim edges: '
+
settings
.
trimEdges
;
}
}
}
...
...
public/app/plugins/datasource/elasticsearch/elastic_response.js
View file @
dc30b9d3
...
...
@@ -269,15 +269,16 @@ function (_, queryDef) {
seriesList
.
push
(
series
);
};
ElasticResponse
.
prototype
.
dropFirstLast
=
function
(
aggregations
,
target
)
{
ElasticResponse
.
prototype
.
trimDatapoints
=
function
(
aggregations
,
target
)
{
var
histogram
=
_
.
findWhere
(
target
.
bucketAggs
,
{
type
:
'date_histogram'
});
var
shouldDropFirstAndLast
=
histogram
&&
histogram
.
settings
&&
histogram
.
settings
.
dropFirstLast
;
var
shouldDropFirstAndLast
=
histogram
&&
histogram
.
settings
&&
histogram
.
settings
.
trimEdges
;
if
(
shouldDropFirstAndLast
)
{
var
trim
=
histogram
.
settings
.
trimEdges
;
for
(
var
prop
in
aggregations
)
{
var
points
=
aggregations
[
prop
];
if
(
points
.
datapoints
.
length
>
2
)
{
points
.
datapoints
=
points
.
datapoints
.
slice
(
1
,
points
.
datapoints
.
length
-
1
);
if
(
points
.
datapoints
.
length
>
trim
*
2
)
{
points
.
datapoints
=
points
.
datapoints
.
slice
(
trim
,
points
.
datapoints
.
length
-
trim
);
}
}
}
...
...
@@ -303,7 +304,7 @@ function (_, queryDef) {
var
docs
=
[];
this
.
processBuckets
(
aggregations
,
target
,
tmpSeriesList
,
docs
,
{},
0
);
this
.
dropFirstLast
(
tmpSeriesList
,
target
);
this
.
trimDatapoints
(
tmpSeriesList
,
target
);
this
.
nameSeries
(
tmpSeriesList
,
target
);
for
(
var
y
=
0
;
y
<
tmpSeriesList
.
length
;
y
++
)
{
...
...
public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html
View file @
dc30b9d3
...
...
@@ -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: 1
4
0px"
>
<li
class=
"tight-form-item"
style=
"width: 1
7
0px"
>
Interval
</li>
<li>
...
...
@@ -48,7 +48,7 @@
</div>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 1
4
0px"
>
<li
class=
"tight-form-item"
style=
"width: 1
7
0px"
>
Min Doc Count
</li>
<li>
...
...
@@ -59,16 +59,14 @@
</div>
<div
class=
"tight-form last"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 1
4
0px"
>
Drop first
&
last valu
e
<li
class=
"tight-form-item"
style=
"width: 1
7
0px"
>
Trim edges on timeseri
e
</li>
<li
class=
"tight-form-item"
>
<input
class=
"cr1"
type=
"checkbox"
id=
"{{$id}}.dropFirstLast"
ng-model=
"agg.settings.dropFirstLast"
ng-checked=
"agg.settings.dropFirstLast"
ng-change=
"onChangeInternal()"
>
<label
for=
"{{$id}}.dropFirstLast"
class=
"cr1"
></label>
<li>
<input
class=
"tight-form-input"
type=
"number"
ng-model=
"agg.settings.trimEdges"
ng-change=
"onChangeInternal()"
>
</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>
<i
class=
"fa fa-question-circle"
bs-tooltip=
"'
Trim the edges on the timeserie x datapoints
'"
data-placement=
"right"
></i>
</li>
</ul>
<div
class=
"clearfix"
></div>
...
...
public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts
View file @
dc30b9d3
...
...
@@ -416,7 +416,7 @@ describe('ElasticResponse', function() {
targets
=
[{
refId
:
'A'
,
metrics
:
[{
type
:
'avg'
,
id
:
'1'
},
{
type
:
'count'
}],
bucketAggs
:
[{
id
:
'2'
,
type
:
'date_histogram'
,
field
:
'host'
,
settings
:
{
dropFirstLast
:
true
}
}],
bucketAggs
:
[{
id
:
'2'
,
type
:
'date_histogram'
,
field
:
'host'
,
settings
:
{
trimEdges
:
1
}
}],
}];
response
=
{
...
...
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