-
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
[APM] Move chartsSelector transformation to backend #26117
[APM] Move chartsSelector transformation to backend #26117
Conversation
Move apmTimeseries to backend Fix tests
6ec7c2d
to
632f40b
Compare
💚 Build Succeeded |
💚 Build Succeeded |
💚 Build Succeeded |
})); | ||
|
||
return ( | ||
<AreaSeries | ||
<VerticalRectSeries |
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 line might be the biggest change in this PR: going from AreaSeries to RectSeries.
An AreaSeries take points like { x, y0, y }
- so no horisontal width. To set the horisontal width I used to add a starting point, an ending point, and then padded with a null
point to avoid connecting the area with the following area (if there are no null values between them two points will be connected with a line). Pretty hacky:
kibana/x-pack/plugins/apm/public/store/selectors/chartSelectors.ts
Lines 223 to 237 in 54f1a73
acc.push({ x: p.x, y: 1 }); | |
if (nextPoint.x == null || nextPoint.x > endX) { | |
acc.push( | |
{ | |
x: endX, | |
y: 1 | |
}, | |
{ | |
x: getX(p.x, 2) | |
} | |
); | |
} | |
return acc; | |
}, []); |
RectSeries
take points like { x0, x, y0, y }
. So the hacky stuff can go away.
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.
As best I can tell this LGTM, although I'm not sure if we can guarantee that all the transforms that were happening on the front-end are accurately recreated on the back-end without some kind of end to end test that I don't think we have. That said, I'm happy to have moved all the transformations to one place...
Agree. We should really have e2e tests for this. |
…[APM] Get rid of `pre` middleware (#26256) (#26328) * [APM] Move chartsSelector transformation to backend (#26117) * [APM] Move ML anomaly transformation to backend Move apmTimeseries to backend Fix tests * Update default values * Fix bug * [APM] Get rid of `pre` middleware (#26256) Rename apmIndexPattern to apmIndexPatternTitle and narrow down search query Fix tests Remove unused aggregation Revert "Rename apmIndexPattern to apmIndexPatternTitle and narrow down search query" This reverts commit 5aa86744a0b360ceb75a59ebc8a0a084b24fbe50.
This builds on top of #25848 and is the final refactor for now. Trust me :)
Excluding tests and snapshots the actual diff is: +456 (additions) and -424 (deletions). If you wonder how I got those numbers check out this gist.
On a high level this moves a lot of the transformations previously done on the frontend in chartSelectors to the backend.
This is because we already do a lot of transformations on the backend, and some things were actually duplicated due to this. Now all of the data transformations happen on the backend, and the new chartSelectors is all about presentation data (legend title, color etc.)
This has been thoroughly manually tested by side-by-side comparing it to the current implementation on cloud.