-
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
[data.search.aggs] Remove service getters from agg types #61628
Conversation
@@ -100,6 +102,10 @@ export class DataPublicPlugin implements Plugin<DataPublicPluginSetup, DataPubli | |||
|
|||
expressions.registerFunction(esaggs); | |||
|
|||
const getInternalStartServices: getInternalStartServicesFn = () => ({ | |||
fieldFormats: getFieldFormats(), |
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.
In the future, we can remove getters/setters
altogether, but now using this approach we can save support of two ways for passing dependencies and refactor all places without any rush.
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
👍 This approach makes sense to me & feels like an improvement over what we have now Even if we end up with a different solution in the long run, this has the advantage of consolidating all of the service getters so that we aren't importing from |
@lizozom @ppisljar @streamich Could you please also review it and give your opinion. If you don't have any objections probably we can start to use this approach |
@elasticmachine merge upstream |
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.
Code changes LGTM; did some smoke tests locally (Chrome macOS), and things seem to be working as expected.
I do think we should eventually consider passing specific services to each agg type rather than all of getInternalStartServices
, however since more work will need to be done to prepare aggs to be available on the server anyway, I'm comfortable addressing this later.
Either way this PR is IMHO an improvement on what we had previously, because:
- It consolidates usage of service getters to one place, making them easy to swap out down the road.
- It updates the plumbing of each of the agg types so that dependencies are passed down rather than imported via a
./services
module.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* [data.search.aggs] Remove service getters from agg types Part of elastic#60333 * new portion of changes * pass dependencies to MetricAgg Type through constructor * update docs * refactoring buckets * remove unused mockDataServices * Remove service getters from metrics * Some fixes * remove temporary code * moved notifications to the getInternalStartServices * fixed karma lock * update docs * Fixed tests * fix broken CI * fix PR comment * fix typo Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Uladzislau Lasitsa <[email protected]>
…2762) * [data.search.aggs] Remove service getters from agg types Part of #60333 * new portion of changes * pass dependencies to MetricAgg Type through constructor * update docs * refactoring buckets * remove unused mockDataServices * Remove service getters from metrics * Some fixes * remove temporary code * moved notifications to the getInternalStartServices * fixed karma lock * update docs * Fixed tests * fix broken CI * fix PR comment * fix typo Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Uladzislau Lasitsa <[email protected]> Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Uladzislau Lasitsa <[email protected]>
* master: (36 commits) [data.search.aggs] Remove service getters from agg types (elastic#61628) fixing APM internationalization (elastic#62757) fix: 🐛 correctly create error on no_matching_indices (elastic#61257) [Lens] Remove all legacy imports (elastic#62596) Add label for ace editor (elastic#62588) [ML] Show better file structure finder explanations (elastic#62316) Fix old pathes in eslintrc (elastic#62580) [Uptime] Improve Telemetry test (elastic#62428) [SIEM] Adds sort rules Cypress test (elastic#62700) [Uptime]Abstracted 'access:uptime-read' tag into a wrapper for… (elastic#62576) fixing bug (elastic#62577) [Maps] Allow updating requestType for ESGeoGridSource (elastic#62365) [Maps] do not show circle border when symbol size is zero (elastic#62644) [Maps] Always show current zoom level (elastic#62684) bc5 siem rules merge (elastic#62679) Revert "[Monitoring] Cluster state watch to Kibana alerting (elastic#61685)" Fix visual tests (elastic#62660) [Telemetry] update crypto packages (elastic#62469) [DOCS] Removed references to left (elastic#60807) [Maps] Move layers to np maps (elastic#61877) ...
Part of #60333
Checklist
Delete any items that are not applicable to this PR.
For maintainers