-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
derivative metric aggregation #10020
Conversation
jenkins, test this |
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.
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.
-
Anyway we can slightly indent the derivate-form? This is especially relevant for second-order derivatives.
-
I don't think we need the Custom Label option for derivative (?). This probably need to be completely rewritten at each step. E.g. Distance->Velocity->Acceleration. We only care about acceleration since that's the only one that will get displayed.
Metric combo box: yeah, as you might select an existing metric. This follows the same pattern you see if you choose Term bucket agg and look at order by combo box. You can select a pre-existing metric or you could add a custom metric. I will update that design also matches that. i think that would address your 1) point. regarding 2), i would maybe just leave it like that, for the sake of simplicity first and because it matches the pattern seen in other parts (like the order by in terms agg mentioned above). I agree that's not the best, but i would fix that in separate PR and in every place where it applies. |
import VisAggConfigProvider from 'ui/vis/agg_config'; | ||
import VisSchemasProvider from 'ui/vis/schemas'; | ||
|
||
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.
Switch to a named export?
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.
every other agg type is using default export ... what do you think would be better? keeping this similar to other aggs ? or going with named export ? (which wont be used as this is only exporting a single thing)
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.
It's in our style guide, but I see your point. Up to you.
import VisSchemasProvider from 'ui/vis/schemas'; | ||
|
||
export default function AggTypeMetricDerivativeProvider(Private) { | ||
const DerivativeAggType = Private(AggTypesMetricsMetricAggTypeProvider); |
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 think this name is confusing - it's not a DerivativeAggType but a MetricAggType. The way it is named now, it looks like a subclass of MetricAggType, but if that was the case, you wouldn't have to pass in all the options to specialize the metric for a derivative type.
return new DerivativeAggType({ | ||
name: 'derivative', | ||
title: 'Derivative', | ||
makeLabel: function (aggConfig) { |
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 this function could be pulled out into a separate file and then tested separately?
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 mean makeLabel ? I would argue that it would be less readable after. I usually look at the following:
- can the code be reused by something else ? if yes, separate out in a new file
- is the original file too complex or long ? if yes, separate out
- is it impossible to test ? if yes, separate out
but i think on all above the answer is no (i can test, the file is not really long, and this seems specific to just this agg, wont be reused elsewhere)
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 suppose I disagree on the second point, I think this file would be more readable with less LOC. The more focused functions are, the more I can concentrate on what it is doing, and switch to other focus areas as a follow up. This file has a whole controller in it, which could also probably be split out. It also becomes tough to follow with a lot of indentation.
For instance, the creation of the params argument is a bit confusing for me to follow. It looks like the object parameters are later translated into classes based on the type and/or name field of the object. I got a little lost however because there are two agg_params.js files. More functions generally mean more comments, or barring that, self documenting code using the function name.
I also look at this file and wonder if we can separate the business logic from the angular portions. makeLabel has nothing angular specific about it, but this file has a reference to $scope and Private, which is angular specific.
Anyway, I'm fine if you leave as is, just expressing my opinion. This is the first I've looked at the visualize code, so trying to follow the logic is a bit tough.
regarding labels .... As @thomasneirynck pointed out above custom labels on intermediate levels don't make much sense, and i would prefer to solve that in separate PR, as similar issue already exists in visualize, hence i would like to fix it everywhere and its not only related to this PR. |
regarding the error, i can't see what buckets have you selected ... clould you paste whole request ?
|
tests are failing on |
Here is the request that caused the error. I didn't select anything for the x-axis, I guess that is the issue.
|
dfa35dd
to
35029c5
Compare
@stacey-gammon I extracted the functions to new files, also the error should be fixed now. |
Nice, thanks! So it's a bit confusing now where the error is coming from when not using the historgram for x-axis. I guess there is nothing we can do about that since we dont' support tooltips on that error icon? I think I ran across another bug. If I first select |
you rock @stacey-gammon ! regarding errors ... yeah they suck at the moment ... but I plan to start working on that shortly (in a separate PR) |
the bug is fixed (seems i introduced it during moving of makelabels function). |
jenkins, test this |
01d66dd
to
188cccb
Compare
@stacey-gammon thanks ! it should be fixed now, also i fixed the tests (selenium ones are still failing due to tile map issue). can you take another look ? |
c8eda0d
to
4dc6af6
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 like the new error messaging in place. It's useful, and would work better than an app-wide toast IMHO.
@alexfrancoeur I think the second example is better than the first one, since it grabs your attention more. It would be good to style these errors consistently, and then we can update their design en masse. |
@ppisljar I also like the new error handling in the context of what we're trying to do. It's consistent with the other place where we signal something about agg ordering (pie chart), and I think it gives the user something actionable to react to when the aggregations are incorrectly ordered for derivative. I have a minor tweak proposed for help text:
|
Backports PR #10020 **Commit 1:** updating agg_config to allow adding parent aggregations * Original sha: f83a3af * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:05:04Z **Commit 2:** derivative metric aggregation * Original sha: c04b6c9 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:05:51Z **Commit 3:** disable on metric and tagcloud * Original sha: 0698336 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:06:13Z **Commit 4:** fixing point series to correctly handle missing y values * Original sha: 69a5329 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:06:39Z **Commit 5:** adding unit tests * Original sha: 85c0b46 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:07:01Z **Commit 6:** fix broken ui * Original sha: 20ae746 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-24T19:21:59Z **Commit 7:** removing percentile ranks * Original sha: 7402c6c * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-24T20:11:45Z **Commit 8:** updating based on review * Original sha: 40af4a3 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-25T07:14:21Z **Commit 9:** fixing bug and adding make_nested_label tests * Original sha: 1d5e0c3 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-27T09:55:22Z **Commit 10:** fixing error * Original sha: affdef6 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T09:56:51Z **Commit 11:** fixing test * Original sha: b043ce1 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T09:59:35Z **Commit 12:** fixing based on last review * Original sha: 8b321d6 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T16:49:42Z **Commit 13:** fixing based on thomas review * Original sha: 32e75cc * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T17:13:29Z **Commit 14:** allow nested aggs * Original sha: 1754424 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T17:25:51Z **Commit 15:** prevent sorting on derivative metric * Original sha: ea7c055 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T18:33:08Z **Commit 16:** updating based on last review * Original sha: acb11d8 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-07T09:10:56Z **Commit 17:** adding error message when histogram is not the last bucket * Original sha: 4dc6af6 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-13T12:10:36Z **Commit 18:** fixing test * Original sha: ff4777f * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-13T13:09:03Z **Commit 19:** updating error message * Original sha: dc1133b * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-13T18:37:33Z
Backports PR #10020 **Commit 1:** updating agg_config to allow adding parent aggregations * Original sha: f83a3af * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:05:04Z **Commit 2:** derivative metric aggregation * Original sha: c04b6c9 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:05:51Z **Commit 3:** disable on metric and tagcloud * Original sha: 0698336 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:06:13Z **Commit 4:** fixing point series to correctly handle missing y values * Original sha: 69a5329 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:06:39Z **Commit 5:** adding unit tests * Original sha: 85c0b46 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-23T21:07:01Z **Commit 6:** fix broken ui * Original sha: 20ae746 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-24T19:21:59Z **Commit 7:** removing percentile ranks * Original sha: 7402c6c * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-24T20:11:45Z **Commit 8:** updating based on review * Original sha: 40af4a3 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-25T07:14:21Z **Commit 9:** fixing bug and adding make_nested_label tests * Original sha: 1d5e0c3 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-01-27T09:55:22Z **Commit 10:** fixing error * Original sha: affdef6 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T09:56:51Z **Commit 11:** fixing test * Original sha: b043ce1 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T09:59:35Z **Commit 12:** fixing based on last review * Original sha: 8b321d6 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T16:49:42Z **Commit 13:** fixing based on thomas review * Original sha: 32e75cc * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T17:13:29Z **Commit 14:** allow nested aggs * Original sha: 1754424 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T17:25:51Z **Commit 15:** prevent sorting on derivative metric * Original sha: ea7c055 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-06T18:33:08Z **Commit 16:** updating based on last review * Original sha: acb11d8 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-07T09:10:56Z **Commit 17:** adding error message when histogram is not the last bucket * Original sha: 4dc6af6 * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-13T12:10:36Z **Commit 18:** fixing test * Original sha: ff4777f * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-13T13:09:03Z **Commit 19:** updating error message * Original sha: dc1133b * Authored by ppisljar <peter.pisljar@gmail.com> on 2017-02-13T18:37:33Z
Summary
(Note: See this PR also in combination with #10070 and #10033).
Kibana Visualizations like line, bar, area charts now support the majority of Elasticsearch's pipeline aggregations. These include the majority of parent and sibling aggregations . These aggregations give you a new look into their data. For example, the moving average aggregations allows users to smooth over outlier data points over time, or the derivative enables users to display rate of change.
derivative metric aggregation - cant find existing issue