Skip to content
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

[kbn/rule-data-utils] add submodules and require public use them #117963

Merged

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Nov 9, 2021

Similar to #117958, this adds import targets to @kbn/rule-data-utils so that we can import sub-modules from the package directly without resorting to wacky hacks. Adds the following import targets and imports from there where appropriate:

  • @kbn/rule-data-utils/alerts_as_data_rbac
  • @kbn/rule-data-utils/alerts_as_data_severity
  • @kbn/rule-data-utils/alerts_as_data_status
  • @kbn/rule-data-utils/technical_field_names

Additionally we've prevented public and common code from importing from @kbn/rule-data-utils directly, to prevent the whole package from ending up in a bundle and bloating it.

@spalger spalger force-pushed the implement/kbn-rule-data-utils-submodules branch from a709cf8 to e35993c Compare November 9, 2021 06:51
@spalger spalger added Team:Operations Team label for Operations Team v7.16.0 v8.0.0 v8.1.0 auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes labels Nov 9, 2021
@spalger spalger marked this pull request as ready for review November 9, 2021 21:32
@spalger spalger requested review from a team as code owners November 9, 2021 21:32
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@spalger spalger enabled auto-merge (squash) November 9, 2021 21:32
Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APM changes look good.

@botelastic botelastic bot added Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Nov 9, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uptime changes LGTM

@spalger
Copy link
Contributor Author

spalger commented Nov 10, 2021

@elasticmachine merge upstream

@elastic elastic deleted a comment from kibanamachine Nov 11, 2021
@spalger
Copy link
Contributor Author

spalger commented Nov 13, 2021

@elasticmachine merge upstream

@@ -850,6 +850,10 @@ module.exports = {
name: 'semver',
message: 'Please use "semver/*/{function}" instead',
},
{
name: '@kbn/rule-data-utils',
message: `Import directly from @kbn/rule-data-utils/* submodules in public/common code`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this message specific to rule-data-utils?

Should this read generically like:

Import directly from @kbn/<module_name>/* in public/common code

or

Import directly from @kbn/*/* in public/common code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is specific to the @kbn/rule-data-utils package as import targets have to be setup for each package individually

{
"main": "../target_node/technical_field_names",
"types": "../target_types/technical_field_names"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: surprised your IDE/prettier isn't adding new lines here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what's defined in the .editorconfig file, which is automatically managed by the EditorConfig plugin in IDEs https://github.com/elastic/kibana/blob/main/.editorconfig#L12-L13

Copy link
Contributor

@FrankHassanabad FrankHassanabad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through the ticket, added two small minor items. This is mergeable anytime.

@jasonrhodes jasonrhodes requested a review from a team November 15, 2021 17:47
Copy link
Contributor

@Zacqary Zacqary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

observability changes look good

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1183 1181 -2
cases 341 337 -4
infra 931 927 -4
observability 345 343 -2
securitySolution 2796 2792 -4
uptime 641 638 -3
total -19

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 2.7MB 2.7MB +8.7KB
cases 323.9KB 321.9KB -2.0KB
infra 921.6KB 921.6KB -25.0B
observability 381.3KB 389.9KB +8.7KB
securitySolution 4.5MB 4.5MB -4.0B
timelines 207.6KB 209.6KB +2.0KB
uptime 573.3KB 573.3KB -7.0B
total +17.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
apm 29.3KB 29.4KB +111.0B
infra 90.3KB 88.3KB -2.0KB
securitySolution 253.9KB 251.9KB -2.0KB
timelines 168.0KB 166.0KB -2.0KB
uptime 24.9KB 23.1KB -1.8KB
total -7.6KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@spalger spalger disabled auto-merge November 15, 2021 22:23
@spalger spalger merged commit 0f68fcf into elastic:main Nov 15, 2021
@spalger spalger deleted the implement/kbn-rule-data-utils-submodules branch November 15, 2021 22:23
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Nov 15, 2021
…stic#117963)

* [kbn/rule-data-utils] add submodules and require public use them

* fix lint errors

Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💔 Backport failed

Status Branch Result
8.0
7.16 Commit could not be cherrypicked due to conflicts

Successful backport PRs will be merged automatically after passing CI.

To backport manually run:
node scripts/backport --pr 117963

kibanamachine added a commit that referenced this pull request Nov 16, 2021
…7963) (#118628)

* [kbn/rule-data-utils] add submodules and require public use them

* fix lint errors

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Spencer <[email protected]>
@mgiota mgiota requested review from mgiota and removed request for mgiota November 16, 2021 08:17
jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 16, 2021
…igrate-away-from-injected-css-js

* 'main' of github.com:elastic/kibana: (221 commits)
  [Reporting] Add log level to config (elastic#118319)
  [Metrics UI] Skip failing waffle chart color palette test (elastic#118527)
  [APM] chore: Unify naming of 'apm/scripts/**/*' with snake_case (elastic#118328)
  skip flaky suites (elastic#99581, elastic#118356, elastic#118474)
  [Alerting] Initial implementation of alerting task `cancel()` (elastic#114289)
  chore(NA): creates pkg_npm_types bazel rule (elastic#116465)
  skip flaky suite (elastic#116892)
  Bump chromedriver to 95.0.0 (elastic#116724)
  [Data visualizer] Improve design of expanded rows (elastic#118125)
  [APM] prefer ECS field names for HTTP and URL (elastic#118485)
  Update query_debugging_in_development_and_production.md (elastic#118491)
  [Uptime] adjust Elastic Synthetics integration functional tests (elastic#118163)
  [kbn/rule-data-utils] add submodules and require public use them (elastic#117963)
  [DOCS] Refresh APM correlation screenshots (elastic#116723) (elastic#118577)
  Handles ns to ms conversion for event loop delay metrics (elastic#118447)
  [Cases] Rename functional tests folder (elastic#118490)
  dummy commit
  skip flaky suite (elastic#118593)
  Improve workpad schema validation (elastic#97838)
  skip flaky suite (elastic#118584)
  ...

# Conflicts:
#	src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx
spalger pushed a commit to spalger/kibana that referenced this pull request Nov 16, 2021
…stic#117963)

* [kbn/rule-data-utils] add submodules and require public use them

* fix lint errors

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts
#	x-pack/plugins/cases/public/components/user_action_tree/index.tsx
#	x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx
#	x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx
#	x-pack/plugins/security_solution/public/helpers.ts
#	x-pack/test/case_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts
#	x-pack/test/case_api_integration/security_and_spaces/tests/common/comments/post_comment.ts
spalger pushed a commit that referenced this pull request Nov 16, 2021
…7963) (#118725)

* [kbn/rule-data-utils] add submodules and require public use them

* fix lint errors

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts
#	x-pack/plugins/cases/public/components/user_action_tree/index.tsx
#	x-pack/plugins/observability/public/pages/alerts/alerts_flyout/index.tsx
#	x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx
#	x-pack/plugins/security_solution/public/helpers.ts
#	x-pack/test/case_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts
#	x-pack/test/case_api_integration/security_and_spaces/tests/common/comments/post_comment.ts
mbondyra pushed a commit to mbondyra/kibana that referenced this pull request Nov 19, 2021
…stic#117963)

* [kbn/rule-data-utils] add submodules and require public use them

* fix lint errors

Co-authored-by: Kibana Machine <[email protected]>
dmlemeshko pushed a commit that referenced this pull request Nov 29, 2021
…7963)

* [kbn/rule-data-utils] add submodules and require public use them

* fix lint errors

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support Team:Operations Team label for Operations Team Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.16.0 v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants