[Rollups] Server NP migration#55606
Conversation
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
aa7356c to
ed8e4e9
Compare
flash1293
left a comment
There was a problem hiding this comment.
TSVB and Visualize integrations still working fine 👍
| usageCollection, | ||
| metrics, | ||
| __LEGACY: { | ||
| route: server.route.bind(server), |
There was a problem hiding this comment.
Is this used anywhere? couldn't find a reference.
There was a problem hiding this comment.
Good catch. You're right, it's not needed anymore.
| const requests = request.body.map(({ index, query }: { index: string; query: any }) => | ||
| callWithRequest('rollup.search', { | ||
| index, | ||
| rest_total_hits_as_int: true, |
There was a problem hiding this comment.
Just as a side note - AFAIK rest_total_hits_as_int will get deprecated with 8.0, so this has to be handled differently in future.
There was a problem hiding this comment.
Thanks for the heads up! Do you know if there is an issue open somewhere to track this?
|
@elasticmachine merge upstream |
| return elasticsearchService.createClient('rollup', config); | ||
| }); | ||
|
|
||
| export const callWithRequestFactory = ( |
There was a problem hiding this comment.
Do we need this factory? In my PR, I've used it directly from the router context
There was a problem hiding this comment.
Thanks for sharing! I'm going to leave as is for now, but will consider changing this in my next PR.
| import { LICENSE_STATUS_VALID } from '../../../../../common/constants/license_status'; | ||
| import { ServerShim } from '../../types'; | ||
|
|
||
| export const licensePreRoutingFactory = ( |
There was a problem hiding this comment.
I wonder if we should first agree on the solution for this or if we should merge this PR and change it later.
I would think it would be good to first agree on a common pattern (probably a class exposed) to avoid copy/pasting this code + the tests in all our apps.
There was a problem hiding this comment.
I think that is a fair point. The logic for isEsError could probably be moved to a shared space too.
I don't think we need to block this PR though. This work will need to be updated again when the licensing plugin is used and then it can just use the new pattern we have adopted.
There was a problem hiding this comment.
I agree with @jloleysens. I'd prefer not to block this PR and address when I finish the migration for rollups and adopt the NP licensing plugin.
jloleysens
left a comment
There was a problem hiding this comment.
Code
Left non-blocker comments.
UX/UI
I tested CRUD of rollups and that seemed to work. Not sure how to test integration with Index Patterns?
Overall everything worked as expected!
| import { LICENSE_STATUS_VALID } from '../../../../../common/constants/license_status'; | ||
| import { ServerShim } from '../../types'; | ||
|
|
||
| export const licensePreRoutingFactory = ( |
There was a problem hiding this comment.
I think that is a fair point. The logic for isEsError could probably be moved to a shared space too.
I don't think we need to block this PR though. This work will need to be updated again when the licensing plugin is used and then it can just use the new pattern we have adopted.
| name = 'rollup'; | ||
|
|
||
| constructor(server) { | ||
| constructor(server: ElasticsearchServiceSetup) { |
There was a problem hiding this comment.
Nit, we should consider renaming server to something else. Perhaps elasticsearchService, just to clean up what looks like a legacy reference.
| deps.router.get( | ||
| { | ||
| path: '/api/index_patterns/rollup/_fields_for_wildcard', | ||
| validate: { |
There was a problem hiding this comment.
Nit; If you would like to re-use the type information of the query validations you can move this object to outside of the register function:
import { TypeOf } from '@kbn/config-schema';
const queryValidation = schema.object({...});
type RouteQuery = TypeOf<typeof queryValidation>;
...
const handler: RequestHandler<unknown, RouteQuery> = ...
...
validate: { query: queryValidation },
...| try { | ||
| parsedFields = parseMetaFields(metaFields); | ||
| } catch (error) { | ||
| return response.badRequest(); |
There was a problem hiding this comment.
Does the above error have useful information we can send back in the response body?
| this.log = initializerContext.logger.get(); | ||
| } | ||
|
|
||
| async setup( |
There was a problem hiding this comment.
@rudolf informed me that async setup is going to be deprecated, so everything in setup phase for plugins should be synchronous. Not sure it is worth making the changes here though, just wanted to flag this.
There was a problem hiding this comment.
Leaving as is for now.
|
@elasticmachine merge upstream |
|
@elasticsearchmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…t-state * upstream/master: (96 commits) top nav ts arg support (elastic#56984) [SIEM][detection engine] Limit network rules to filebeat source semantics (elastic#57130) Add docs for alerting and action settings (elastic#57035) Add Test to Verify Endpoint App Landing Page (elastic#57129) Update `markdown-to-jsx` (`6.9.3` → `6.11.0`) and `url-parse` (`1.4.4` → `1.4.7`) dependencies. (elastic#57126) chore(NA): removes use of parallel option in the terser minimizer (elastic#57077) [ML] New Platform server shim: update file data visualizer routes to use new platform router (elastic#56972) Specifying valid licenses for the Graph feature (elastic#55911) [APM][docs] Add troubleshooting for non-indexed fields (elastic#54948) [ML] DF Analytics creation: update schema definition for create route (elastic#56979) Remove Kibana a11y guide in favor of EUI (elastic#57021) [Logs UI] Set streamLive false in URL state when arriving from link-to (elastic#56329) [docs] Fix spaces api example json (elastic#50411) Add new config for filebeat index name (elastic#56920) [Metrics-UI] Fix toolbar popover for metrics table row (elastic#56796) Saved Objects testing (elastic#56965) Disabled categorization stats validation (elastic#57087) [Rollups] Server NP migration (elastic#55606) [Metrics UI] Limit group by selector to only 2 fields (elastic#56800) fix auto closing new vis modal when navigating to lens or when navigating away with browser history (elastic#56998) ...
* master: (96 commits) top nav ts arg support (elastic#56984) [SIEM][detection engine] Limit network rules to filebeat source semantics (elastic#57130) Add docs for alerting and action settings (elastic#57035) Add Test to Verify Endpoint App Landing Page (elastic#57129) Update `markdown-to-jsx` (`6.9.3` → `6.11.0`) and `url-parse` (`1.4.4` → `1.4.7`) dependencies. (elastic#57126) chore(NA): removes use of parallel option in the terser minimizer (elastic#57077) [ML] New Platform server shim: update file data visualizer routes to use new platform router (elastic#56972) Specifying valid licenses for the Graph feature (elastic#55911) [APM][docs] Add troubleshooting for non-indexed fields (elastic#54948) [ML] DF Analytics creation: update schema definition for create route (elastic#56979) Remove Kibana a11y guide in favor of EUI (elastic#57021) [Logs UI] Set streamLive false in URL state when arriving from link-to (elastic#56329) [docs] Fix spaces api example json (elastic#50411) Add new config for filebeat index name (elastic#56920) [Metrics-UI] Fix toolbar popover for metrics table row (elastic#56796) Saved Objects testing (elastic#56965) Disabled categorization stats validation (elastic#57087) [Rollups] Server NP migration (elastic#55606) [Metrics UI] Limit group by selector to only 2 fields (elastic#56800) fix auto closing new vis modal when navigating to lens or when navigating away with browser history (elastic#56998) ...
This PR starts the NP migration of the rollup jobs server code. It also converts the server code to TS.
Things to note:
index_patternsroute was usingserver.inject(). I removed this and pulled inIndexPatternsFetcherdirectly from theindex_patternsplugin.What to test
What's left in order to migrate out of legacy