-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sum, Avg, Min and Max bucket pipeline aggregation #10070
Conversation
7dffa74
to
7322bd0
Compare
7322bd0
to
1eeba3e
Compare
import { makeNestedLabel } from './lib/make_nested_label'; | ||
import SiblingPipelineAggHelperProvider from './lib/sibling_pipeline_agg_helper'; | ||
|
||
export default function AggTypeMetricDerivativeProvider(Private) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These names should match how they are being imported. E.g. AggTypesMetricsBucketAvgProvider
. This is why I like named exports, it forces you to use consistent naming. :) Here and other bucket_* files
return function ($scope) { | ||
|
||
$scope.aggType = type; | ||
//$scope.aggParam = $scope.agg.params[type]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented out line (and below)
name: 'avg_bucket', | ||
title: 'Average Bucket', | ||
makeLabel: agg => makeNestedLabel(agg, 'overall average'), | ||
group: 'Pipeline Aggregations', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The string "Pipeline Aggregations" is repeated in many places. What about creating a metrics_constants file to put it in? Then if we want to change the string we only have to do it in one spot.
$scope.aggType = type; | ||
//$scope.aggParam = $scope.agg.params[type]; | ||
$scope.aggTitle = type === 'customMetric' ? 'Metric' : 'Bucket'; | ||
$scope.aggGroup = type === 'customMetric' ? 'metrics' : 'buckets'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is aggGroup
and also agg.group
and they mean different things. I'm not sure I have a suggestion on the naming, but it'd be nice if they could be distinguished better.
Almost seems like maybe typeName would be more fitting? I think I tracked this down to being used here:
aggTypes.byType[$scope.groupName];
Though that might be too far reaching to change it in this PR since that name already exists and group is the new name.
I think something else that would be worthwhile as a separate PR would be moving metrics
and buckets
to constants too. That would be easier to understand the importance of these strings and where else they are being referenced. Then you could do something like:
export const AggTypes = {
METRICS: 'metrics',
BUCKETS: 'buckets'
}
Food for thought mostly, I understand if you prefer to leave as is for lack of a better alternative at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i renamed agg.group to agg.subtype
$scope.aggGroup = type === 'customMetric' ? 'metrics' : 'buckets'; | ||
$scope.safeMakeLabel = safeMakeLabel; | ||
|
||
$scope.rejectAgg = function (agg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used at all? I'm a little confused at the interaction and differences between rejectAgg and the aggFilter. Since the aggFilter already contains all these, if I select for example Top Hits
, I don't see any of the sibling drop downs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, this is not used here great find!... to much copy pasting from parent pipeline agg :)
@stacey-gammon the reason for error was sorting on bucket metric in your terms bucket. i updated it so its not allowed anymore. i also addressed your other comments. thanks a lot for your super fast response ! |
906c227
to
b3bf1fb
Compare
@ppisljar A couple of quick comments:
|
@ppisljar A couple of other problems I ran into... Do we allow pipeline agg of a pipeline or should that be disabled in the vis editor? |
@tanya seems i forgot to push some things .... i'll fix this tomorrow |
i updated and rebased ....
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't have much to say about this one, given the incremental addition.
The metric-selection UI is getting top-heavy, so I would consider a few simplifications.
-
I would consider splitting parent/sibling into their own category in the selector. Not only to give some texture to the list in the dropdown, but also prime the user that metrics-selector are different for each (siblings allow a full bucket selections, while bucket aggregations only allows to select metrics).
-
we should consider hiding the "Custom metric" dropdown for parent aggregations, since there is only a single option.
@@ -16,7 +16,12 @@ export default function TermsAggDefinition(Private) { | |||
const createFilter = Private(AggTypesBucketsCreateFilterTermsProvider); | |||
const routeBasedNotifier = Private(routeBasedNotifierProvider); | |||
|
|||
const aggFilter = ['!top_hits', '!percentiles', '!median', '!std_dev', '!derivative']; | |||
const aggFilter = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve merge conflict
7be517b
to
47b7be7
Compare
thanks @thomasneirynck
|
jenkins, test this |
@stacey-gammon That's because of the nature of the bucket sum, in that particular configuration. It does an overall sum of the counts, which is identical for all those fields (given that the same docs are included in all those buckets-by-date). choose a metric other than count, and then you will see different results (e.g. min of bytes, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it's good!
FWIW, while playing around, I triggered an uncaught error. But I can no longer reproduce this, I forget the exact steps. Perhaps this is familiar?
:5601/xye/bundles/commons.bundle.js?v=8467:34823 TypeError: Cannot read property 'displayName' of undefined
at MetricAggType.makeLabel (https://localhost:5601/xye/bundles/kibana.bundle.js?v=8467:119764:52)
at AggConfigFactory.AggConfig.makeLabel (https://localhost:5601/xye/bundles/kibana.bundle.js?v=8467:120597:30)
at https://localhost:5601/xye/bundles/kibana.bundle.js?v=8467:158117:38
at Array.map (native)
at Object.fn (https://localhost:5601/xye/bundles/kibana.bundle.js?v=8467:158114:51)
at Scope.$digest (https://localhost:5601/xye/bundles/commons.bundle.js?v=8467:38172:30)
at Scope.$apply (https://localhost:5601/xye/bundles/commons.bundle.js?v=8467:38443:25)
at HTMLSelectElement.<anonymous> (https://localhost:5601/xye/bundles/commons.bundle.js?v=8467:50871:16)
at HTMLSelectElement.dispatch (https://localhost:5601/xye/bundles/commons.bundle.js?v=8467:17466:10)
at HTMLSelectElement.elemData.handle (https://localhost:5601/xye/bundles/commons.bundle.js?v=8467:17152:29)
47b7be7
to
eb2c7ba
Compare
@@ -0,0 +1,67 @@ | |||
// import React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sneak in by mistake? :)
eb2c7ba
to
5848c74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see some selenium tests for some of the bugs encountered along the way, but understanding our limited time availability, LGTM.
future improvements: #10633 |
Backports PR #10070 **Commit 1:** allow parent aggs to have sub aggs defined * Original sha: c8484e4 * Authored by ppisljar <[email protected]> on 2017-02-06T15:47:33Z **Commit 2:** adding bucket_sum aggregation * Original sha: aea3cbf * Authored by ppisljar <[email protected]> on 2017-02-06T16:12:36Z **Commit 3:** adding bucket_avg, bucket_min and bucket_max * Original sha: 7602ee1 * Authored by ppisljar <[email protected]> on 2017-02-07T08:49:58Z **Commit 4:** fixing based on UI review * Original sha: 8af734c * Authored by ppisljar <[email protected]> on 2017-02-15T11:57:40Z **Commit 5:** adding tests * Original sha: 690dc6b * Authored by ppisljar <[email protected]> on 2017-02-15T12:21:28Z **Commit 6:** disable terms sorting on pipeline aggs * Original sha: 7e3a32c * Authored by ppisljar <[email protected]> on 2017-02-16T09:11:54Z **Commit 7:** fixing based on Staceys review * Original sha: ad8b5b5 * Authored by ppisljar <[email protected]> on 2017-02-16T09:12:18Z **Commit 8:** adding defaults * Original sha: 0fb1d93 * Authored by ppisljar <[email protected]> on 2017-02-22T10:40:09Z **Commit 9:** updated based on review * Original sha: cc6c703 * Authored by ppisljar <[email protected]> on 2017-02-28T09:40:21Z **Commit 10:** fixing error with stacking * Original sha: 5848c74 * Authored by ppisljar <[email protected]> on 2017-03-01T14:17:28Z
Backports PR #10070 **Commit 1:** allow parent aggs to have sub aggs defined * Original sha: c8484e4 * Authored by ppisljar <[email protected]> on 2017-02-06T15:47:33Z **Commit 2:** adding bucket_sum aggregation * Original sha: aea3cbf * Authored by ppisljar <[email protected]> on 2017-02-06T16:12:36Z **Commit 3:** adding bucket_avg, bucket_min and bucket_max * Original sha: 7602ee1 * Authored by ppisljar <[email protected]> on 2017-02-07T08:49:58Z **Commit 4:** fixing based on UI review * Original sha: 8af734c * Authored by ppisljar <[email protected]> on 2017-02-15T11:57:40Z **Commit 5:** adding tests * Original sha: 690dc6b * Authored by ppisljar <[email protected]> on 2017-02-15T12:21:28Z **Commit 6:** disable terms sorting on pipeline aggs * Original sha: 7e3a32c * Authored by ppisljar <[email protected]> on 2017-02-16T09:11:54Z **Commit 7:** fixing based on Staceys review * Original sha: ad8b5b5 * Authored by ppisljar <[email protected]> on 2017-02-16T09:12:18Z **Commit 8:** adding defaults * Original sha: 0fb1d93 * Authored by ppisljar <[email protected]> on 2017-02-22T10:40:09Z **Commit 9:** updated based on review * Original sha: cc6c703 * Authored by ppisljar <[email protected]> on 2017-02-28T09:40:21Z **Commit 10:** fixing error with stacking * Original sha: 5848c74 * Authored by ppisljar <[email protected]> on 2017-03-01T14:17:28Z
@ppisljar Can you add a detailed description (with screenshots) of these features to this PR description? Whenever we make any progress on pipeline aggs, please also drop a comment on the pipeline agg ticket since a lot of people want to know about this. |
adds bucket_sum , bucket_avg, bucket_min and bucket_max sibling pipeline aggregations