[APM] NP Migration - Moves plugin server files out of legacy#57532
[APM] NP Migration - Moves plugin server files out of legacy#57532ogupte merged 10 commits intoelastic:masterfrom
Conversation
0b888d4 to
6698349
Compare
There was a problem hiding this comment.
getApmIndices() no longer requires a saved objects client to be passed in.
x-pack/plugins/apm/kibana.json
Outdated
There was a problem hiding this comment.
added usageCollection plugin as an optional dependency for service telemetry
There was a problem hiding this comment.
uses the savedObjectsClient directly rather than obtaining a new instance from the legacy kibana server
There was a problem hiding this comment.
smaller helper function to get the internal saved objects client from the core setup object since we do this in a few places.
There was a problem hiding this comment.
I changed this to a scoped saved object client, which used to be internal before. i tested it with the apm read user and it was able to persist the index pattern for discover/kuery bar/etc.
There was a problem hiding this comment.
the reference to Object.fromEntries produced a typescript error (maybe it's not fully supported?) so i just converted it to a reduce.
x-pack/plugins/apm/server/plugin.ts
Outdated
There was a problem hiding this comment.
the usage collector is now registered from the plugin setup, but it can't block setup since it depends on core start services, so it uses regular old Promise API.
There was a problem hiding this comment.
it was necessary to add a catch here since the CI test saw an unresolved promise when there was a failure to persist telemetry attributes and failed CI.
There was a problem hiding this comment.
@watson I recall that you added this check (throw on unresolved promise) to the test runner. Did you also enable it at runtime in dev mode?
There was a problem hiding this comment.
when i ran the api integration tests locally, the same unresolved promise error shows in the server log, but the test runner did not mark it as a failure
There was a problem hiding this comment.
I was just thinking whether this also would throw during normal development and not just when running tests
There was a problem hiding this comment.
Yes, the check was added in #51431.
For CI the magic is here:
kibana/src/dev/ci_setup/setup_env.sh
Line 17 in 5bb2481
In dev-mode (when running yarn start), the magic is here:
Line 56 in 5bb2481
I intended it to run during dev-mode, so that developers would not be surprised by weird errors in CI that they might as well catch early on in development.
Note that if you manually run node scripts/kibana it will not throw on deprecations.
There was a problem hiding this comment.
Btw, normally I would think that you should pass the error on to the UI so that the user could be notified that something went wrong instead of just logging it to STDERR. But I'm not sure what this code does and if it makes sense to do one or the other in this case. Just be sure you thought it through 🙂
There was a problem hiding this comment.
normally I would think that you should pass the error on to the UI so that the user could be notified that something went wrong instead of just logging it to STDERR.
Agree! However, the operation in this case is a background job which is implicitly initiated by the user but the response of the API doesn't rely on it.
@ogupte I think we talked about adding a comment to make this more obvious
There was a problem hiding this comment.
not sure how this was valid before
6698349 to
3ec54f2
Compare
x-pack/legacy/plugins/apm/public/components/app/ServiceMap/Popover/ServiceMetricList.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Why is it forbidden to import from the server folder?
There was a problem hiding this comment.
Actually, I think the linter has a point: range_filter should be moved to common if it's consumed by something from common.
There was a problem hiding this comment.
Thanks for fixing the casing everywhere 👍
There was a problem hiding this comment.
No biggie but any reason not to async/await like everywhere else?
const [coreStart] = await core.getStartServices()
return coreStart.savedObjects.createInternalRepository();fdcdb8d to
d6b6314
Compare
|
Removed myself from the reviewers list since it looks like this doesn't touch the Maps app. Feel free to re-add me if I'm mistaken! |
d6b6314 to
7074e7b
Compare
and context scoped clients exposed in the new platform core setup
…ndices, and uses the internal saved objects client when creating apm index pattern, so that any user who navigates to apm can trigger it
7074e7b to
b150999
Compare
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
|
cla/trigger |
…#57532) * Closes @56832 Migrates uses of the saved objects client to the internal and context scoped clients exposed in the new platform core setup * moves apm server, common, and typings dirs to the new plugin directory * fixes path imports and type errors * fixes some lint errors * fixes CI failure. Use internal saved objects client like before. * uses the context-scoped saved objects client for saving runtime APM indices, and uses the internal saved objects client when creating apm index pattern, so that any user who navigates to apm can trigger it * fixes the type check error by updating import paths * renamed files and directories to snake_case to pass scripts/check_file_casing * rebase fixes and commit filename case changes * moves get_indices_privileges.ts out of legacy path
…#58074) * Closes @56832 Migrates uses of the saved objects client to the internal and context scoped clients exposed in the new platform core setup * moves apm server, common, and typings dirs to the new plugin directory * fixes path imports and type errors * fixes some lint errors * fixes CI failure. Use internal saved objects client like before. * uses the context-scoped saved objects client for saving runtime APM indices, and uses the internal saved objects client when creating apm index pattern, so that any user who navigates to apm can trigger it * fixes the type check error by updating import paths * renamed files and directories to snake_case to pass scripts/check_file_casing * rebase fixes and commit filename case changes * moves get_indices_privileges.ts out of legacy path
* master: (136 commits) [Visualize] Remove legacy appState in visualize (elastic#57330) Use static time for tsvb rollup test (elastic#57701) [SIEM] Fix ResizeObserver polyfill (elastic#58046) [SIEM][Detection Engine] Fixes return codes where some were rule_id instead of id skip flaky suite (elastic#56816) skip flaky suite (elastic#58059) skip flaky suite (elastic#45348) migrates notification server routes to NP (elastic#57906) Moved all of the show/hide toggles outside of ordered lists. (elastic#57163) [APM] NP Migration - Moves plugin server files out of legacy (elastic#57532) [Maps][Telemetry] Migrate Maps telemetry to NP (elastic#55055) Embeddable add panel examples (elastic#57319) Fix useRequest to support query change (elastic#57723) Allow custom paths in plugin generator (elastic#57766) [SIEM][Case] Merge header components (elastic#57816) [ML] New Platform server shim: update job audit messages routes (elastic#57925) [kbn/optimizer] emit success event from reducer when all bundles cached (elastic#57945) [APM] Don’t include UI filters when fetching a specific transaction (elastic#57934) Upgrade yargs (elastic#57720) skip flaky suite (elastic#57762) (elastic#57997) (elastic#57998) ... # Conflicts: # src/plugins/advanced_settings/public/management_app/components/field/__snapshots__/field.test.tsx.snap # src/plugins/advanced_settings/public/management_app/components/field/field.tsx # x-pack/plugins/translations/translations/ja-JP.json # x-pack/plugins/translations/translations/zh-CN.json
Closes #56830
Move server files of the APM plugin from
x-pack/legacy/plugins/apm->x-pack/plugins/apm. This still initializes legacy plugin, but it allows us to very easily switch over to the new platform when we fully migrate the client app.Also Closes #56832
Migrates uses of the saved objects client API from the legacy references to those exposed on the CoreStart object. It removes the requirement to pass in a saved objects client to the
getApmIndices()function exposed on the APM plugin.