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

[APM] Add validations to general settings #175874

Merged

Conversation

ElenaStoeva
Copy link
Contributor

@ElenaStoeva ElenaStoeva commented Jan 30, 2024

Summary

In #174712, we integrated the new settings field component into APM General settings. The new setting field supports validation on the user input, based on the schema of the given setting.

Since some of the APM General settings have schema with specified restrictions, which were not enforced in the UI before, this PR adds schema validation so that they are enforced.

Note that this validation adds some performance overhead as it sends a request to the server (to the internal/kibana/settings/validate endpoint) for every user input change. It's up to the team to decide whether you think that is okay for the app and whether validation for these settings is really beneficial to have.

Settings with schema restrictions:

apmServiceGroupMaxNumberOfServices (currently input value 0 is not validated but a fix is coming with #175957):
Screenshot 2024-01-31 at 08 57 58

observability:apmAWSLambdaPriceFactor:
Screenshot 2024-01-31 at 08 58 39

observability:apmAWSLambdaRequestCostPerMillion:
Screenshot 2024-01-31 at 08 59 36

Bottom bar when there are invalid changes:
Screenshot 2024-01-31 at 09 04 57

@ElenaStoeva ElenaStoeva force-pushed the apm/general-settings/add-validation branch from 9764c81 to cb322c9 Compare January 31, 2024 09:05
@ElenaStoeva
Copy link
Contributor Author

/ci

@ElenaStoeva ElenaStoeva marked this pull request as ready for review January 31, 2024 11:06
@ElenaStoeva ElenaStoeva requested a review from a team as a code owner January 31, 2024 11:06
@ElenaStoeva ElenaStoeva self-assigned this Jan 31, 2024
@botelastic botelastic bot added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Jan 31, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@ElenaStoeva ElenaStoeva added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more release_note:skip Skip the PR/issue when compiling release notes apm:settings and removed Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Jan 31, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

@ElenaStoeva ElenaStoeva added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Jan 31, 2024
Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

LGTM: just a nit

@@ -118,7 +115,8 @@ export function GeneralSettings() {
links: docLinks.links.management,
showDanger: (message: string) =>
notifications.toasts.addDanger(message),
validateChange: async () => settingsValidationResponse,
validateChange: async (key: string, value: any) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you don't need to add async here, settings.client.validateValue returns a promise already.

Suggested change
validateChange: async (key: string, value: any) =>
validateChange: (key: string, value: any) =>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch! Fixed in bd9b76c.

@ElenaStoeva ElenaStoeva enabled auto-merge (squash) January 31, 2024 14:33
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Integration Tests #2 / migration v2 - read batch size reduces the read batchSize in half if a batch exceeds maxReadBatchSizeBytes
  • [job] [logs] Jest Integration Tests #2 / migration with waitForCompletion=true waits for another instance to complete the migration

Metrics [docs]

Async chunks

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

id before after diff
apm 3.2MB 3.2MB +64.0B

History

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

cc @ElenaStoeva

@ElenaStoeva ElenaStoeva merged commit da34e18 into elastic:main Feb 1, 2024
19 checks passed
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Feb 1, 2024
@ElenaStoeva ElenaStoeva deleted the apm/general-settings/add-validation branch February 1, 2024 17:26
fkanout pushed a commit to fkanout/kibana that referenced this pull request Feb 7, 2024
## Summary

In elastic#174712, we integrated the new
settings field component into APM General settings. The new setting
field supports validation on the user input, based on the `schema` of
the given setting.

Since some of the APM General settings have `schema` with specified
restrictions, which were not enforced in the UI before, this PR adds
schema validation so that they are enforced.

Note that this validation adds some performance overhead as it sends a
request to the server (to the `internal/kibana/settings/validate`
endpoint) for every user input change. It's up to the team to decide
whether you think that is okay for the app and whether validation for
these settings is really beneficial to have.

**Settings with `schema` restrictions:**


[apmServiceGroupMaxNumberOfServices](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L189)
(currently input value `0` is not validated but a fix is coming with
elastic#175957):
<img width="1071" alt="Screenshot 2024-01-31 at 08 57 58"
src="https://github.com/elastic/kibana/assets/59341489/35d9a4fc-4641-4603-97f9-9fbc1a76a778">



[observability:apmAWSLambdaPriceFactor](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L315):
<img width="1071" alt="Screenshot 2024-01-31 at 08 58 39"
src="https://github.com/elastic/kibana/assets/59341489/810948f5-134a-49ec-8d6e-b15ea7896624">



[observability:apmAWSLambdaRequestCostPerMillion](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L326):
<img width="1071" alt="Screenshot 2024-01-31 at 08 59 36"
src="https://github.com/elastic/kibana/assets/59341489/269c0a3c-d257-43b7-bcf7-2e10dffdb0b3">



**Bottom bar when there are invalid changes:**
<img width="1084" alt="Screenshot 2024-01-31 at 09 04 57"
src="https://github.com/elastic/kibana/assets/59341489/1d6a44a2-2659-421b-84b4-44fc693a645b">
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

In elastic#174712, we integrated the new
settings field component into APM General settings. The new setting
field supports validation on the user input, based on the `schema` of
the given setting.

Since some of the APM General settings have `schema` with specified
restrictions, which were not enforced in the UI before, this PR adds
schema validation so that they are enforced.

Note that this validation adds some performance overhead as it sends a
request to the server (to the `internal/kibana/settings/validate`
endpoint) for every user input change. It's up to the team to decide
whether you think that is okay for the app and whether validation for
these settings is really beneficial to have.

**Settings with `schema` restrictions:**


[apmServiceGroupMaxNumberOfServices](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L189)
(currently input value `0` is not validated but a fix is coming with
elastic#175957):
<img width="1071" alt="Screenshot 2024-01-31 at 08 57 58"
src="https://github.com/elastic/kibana/assets/59341489/35d9a4fc-4641-4603-97f9-9fbc1a76a778">



[observability:apmAWSLambdaPriceFactor](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L315):
<img width="1071" alt="Screenshot 2024-01-31 at 08 58 39"
src="https://github.com/elastic/kibana/assets/59341489/810948f5-134a-49ec-8d6e-b15ea7896624">



[observability:apmAWSLambdaRequestCostPerMillion](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L326):
<img width="1071" alt="Screenshot 2024-01-31 at 08 59 36"
src="https://github.com/elastic/kibana/assets/59341489/269c0a3c-d257-43b7-bcf7-2e10dffdb0b3">



**Bottom bar when there are invalid changes:**
<img width="1084" alt="Screenshot 2024-01-31 at 09 04 57"
src="https://github.com/elastic/kibana/assets/59341489/1d6a44a2-2659-421b-84b4-44fc693a645b">
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
## Summary

In elastic#174712, we integrated the new
settings field component into APM General settings. The new setting
field supports validation on the user input, based on the `schema` of
the given setting.

Since some of the APM General settings have `schema` with specified
restrictions, which were not enforced in the UI before, this PR adds
schema validation so that they are enforced.

Note that this validation adds some performance overhead as it sends a
request to the server (to the `internal/kibana/settings/validate`
endpoint) for every user input change. It's up to the team to decide
whether you think that is okay for the app and whether validation for
these settings is really beneficial to have.

**Settings with `schema` restrictions:**


[apmServiceGroupMaxNumberOfServices](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L189)
(currently input value `0` is not validated but a fix is coming with
elastic#175957):
<img width="1071" alt="Screenshot 2024-01-31 at 08 57 58"
src="https://github.com/elastic/kibana/assets/59341489/35d9a4fc-4641-4603-97f9-9fbc1a76a778">



[observability:apmAWSLambdaPriceFactor](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L315):
<img width="1071" alt="Screenshot 2024-01-31 at 08 58 39"
src="https://github.com/elastic/kibana/assets/59341489/810948f5-134a-49ec-8d6e-b15ea7896624">



[observability:apmAWSLambdaRequestCostPerMillion](https://github.com/elastic/kibana/blob/b4d93fc145c3c09eb1096c610b7cd736f19f6a3a/x-pack/plugins/observability/server/ui_settings.ts#L326):
<img width="1071" alt="Screenshot 2024-01-31 at 08 59 36"
src="https://github.com/elastic/kibana/assets/59341489/269c0a3c-d257-43b7-bcf7-2e10dffdb0b3">



**Bottom bar when there are invalid changes:**
<img width="1084" alt="Screenshot 2024-01-31 at 09 04 57"
src="https://github.com/elastic/kibana/assets/59341489/1d6a44a2-2659-421b-84b4-44fc693a645b">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:settings backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants