Skip to content
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

Merged
merged 10 commits into from
Mar 1, 2017

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Jan 25, 2017

adds bucket_sum , bucket_avg, bucket_min and bucket_max sibling pipeline aggregations

pipeline

screenshot-localhost-5601 2017-03-01 19-46-57

@epixa epixa added the Feature:Visualizations Generic visualization features (in case no more specific feature label is available) label Jan 26, 2017
@tbragin tbragin added the Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) label Feb 2, 2017
@thomasneirynck thomasneirynck self-assigned this Feb 14, 2017
@ppisljar ppisljar changed the title WIP: bucket_sum pipeline aggregation bucket_sum pipeline aggregation Feb 15, 2017
@ppisljar ppisljar changed the title bucket_sum pipeline aggregation Sum, Avg, Min and Max bucket pipeline aggregation Feb 15, 2017
import { makeNestedLabel } from './lib/make_nested_label';
import SiblingPipelineAggHelperProvider from './lib/sibling_pipeline_agg_helper';

export default function AggTypeMetricDerivativeProvider(Private) {
Copy link
Contributor

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];
Copy link
Contributor

@stacey-gammon stacey-gammon Feb 15, 2017

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',
Copy link
Contributor

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';
Copy link
Contributor

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.

Copy link
Member Author

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) {
Copy link
Contributor

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.

Copy link
Member Author

@ppisljar ppisljar Feb 16, 2017

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
Copy link
Contributor

Ran into an error using Sum Bucket and Terms agg:

screen shot 2017-02-15 at 11 12 41 am

@ppisljar
Copy link
Member Author

@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 !

@tbragin
Copy link
Contributor

tbragin commented Feb 21, 2017

@ppisljar A couple of quick comments:

  • I do love the dropdown calling out aggregation types, nice call @alexfrancoeur! However, instead of "Basic Aggregations" I think we should call them what ES documentation calls them, which is "Metrics Aggregations"

screen shot 2017-02-20 at 4 43 21 pm

  • I also think we should order bucket aggregations the same as metrics aggregations, with "Average" preceding "Sum".
  • It'd be nice if, once fully configured, switching between Sum, Average, Min, and Max Bucket Aggregations didn't wipe out the configuration below it. You'll see that Time Series Metric Visualizations  #9725 allows to switch between all these bucket aggs w/o user having to rebuild their config.
  • I got this error when selecting the following option

screen shot 2017-02-20 at 5 56 08 pm

  • You kind of do have to know what you're doing with Bucket aggregations in the context of Date Histogram -- it's certainly not for the faint-hearted. I think I finally figured out how to configure something SLA-like "bucket_average(max(bytes,1h),24h), split by OS" (see screenshots). Anything we can do to reduce the vertical amount of space needed for these configuration would improve the experience, imo. For one, I think we should prioritize removing unnecessary custom labels: custom label is not necessarry on order by custom metric #10217 (I would go so far to even say that it should be a blocker for 5.4 if we plan to ship pipeline aggs as part of that release). Secondarily, I wonder if additional levels of collapsing would be useful, though I'd imagine it's a harder endeavor.

screen shot 2017-02-20 at 6 10 38 pm

screen shot 2017-02-20 at 6 10 49 pm

  • Metric configuration is less staggering, since you can't split by anything, but superflous labels make it look convoluted as well.

screen shot 2017-02-20 at 7 09 23 pm

@tbragin
Copy link
Contributor

tbragin commented Feb 21, 2017

@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?

screen shot 2017-02-21 at 9 36 38 am

screen shot 2017-02-21 at 9 37 20 am

@ppisljar
Copy link
Member Author

@tanya seems i forgot to push some things .... i'll fix this tomorrow

@ppisljar
Copy link
Member Author

ppisljar commented Feb 22, 2017

i updated and rebased ....

  • sorting on buckets is not allowed (in terms)

  • buckets on derivative are not allowed

  • derivative on buckets IS allowed

  • removing the labels: i agree, but not sure if i would make it a blocker .... (the PR is ready and waiting review)

  • switching without rebuilding: this is gonna be hard at this point (for 5.4) unless we want to go forward with a hacky solution (i oppose). there is no mechanism in place at the moment to allow this. If you are ok with tracking this separately please open an issue and link it here.

@thomasneirynck
Copy link
Contributor

Could we split 'pipeline aggregations' up between parent and sibling aggregations? ie. have 3 sections iso 2.

image

The reason for this is that the metric configuration is different for each. It is a little confusing to see the UI form change.

Copy link
Contributor

@thomasneirynck thomasneirynck left a 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.

image

@@ -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 = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve merge conflict

@ppisljar
Copy link
Member Author

thanks @thomasneirynck

  • i split aggs in 3 sections

  • rebased on master

  • regarding custom metric dropdown ... it will have multiple values if you have more metrics. besides, thats out of scope of this pr (bucket pipeline aggs don't have the metrics dropdown)

@ppisljar
Copy link
Member Author

jenkins, test this

@stacey-gammon
Copy link
Contributor

My choices here don't seem to be updating the y axis at all. Is this a bug or am I doing something wrong? I'm trying to create a visualization like the person in that discuss ticket yesterday was hoping to create.

bucketshisto

@thomasneirynck
Copy link
Contributor

@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, ...)

Copy link
Contributor

@thomasneirynck thomasneirynck left a 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) 

@thomasneirynck thomasneirynck removed their assignment Feb 28, 2017
@@ -0,0 +1,67 @@
// import React from 'react';
Copy link
Contributor

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? :)

Copy link
Contributor

@stacey-gammon stacey-gammon left a 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.

@ppisljar
Copy link
Member Author

ppisljar commented Mar 1, 2017

future improvements: #10633

@ppisljar ppisljar merged commit 841a3d2 into elastic:master Mar 1, 2017
elastic-jasper added a commit that referenced this pull request Mar 1, 2017
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 pushed a commit that referenced this pull request Mar 1, 2017
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 ppisljar deleted the agg/pipeline_sum branch March 1, 2017 15:55
@epixa
Copy link
Contributor

epixa commented Mar 1, 2017

@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.

@tbragin tbragin mentioned this pull request May 4, 2017
@ppisljar ppisljar restored the agg/pipeline_sum branch September 26, 2018 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Aggregations Aggregation infrastructure (AggConfig, esaggs, ...) Feature:Visualizations Generic visualization features (in case no more specific feature label is available) review v5.4.0 v6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants