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

[Synthetics] Consider validating client strategy for monitor body #159578

Closed
4 tasks
Tracked by #153396 ...
dominiqueclarke opened this issue Jun 13, 2023 · 2 comments
Closed
4 tasks
Tracked by #153396 ...
Labels
enhancement New value added to drive a business result Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.9.0

Comments

@dominiqueclarke
Copy link
Contributor

dominiqueclarke commented Jun 13, 2023

Describe the feature:

This ticket is simply to evaluate the use of kbn-schema and io-ts to help with validating monitor bodies for the following apis

  • - POST /internal/uptime/service/monitors
  • - PUT /internal/uptime/service/monitors/{monitorId}
  • - POST /internal/uptime/service/monitors/run_once
  • - GET /internal/uptime/service/monitor/inspect (shahzad)

Currently, we do not have any kbn-schema defined for the monitor body. However, we do use io.ts for runtime checking on the body. Since the client monitor body is the same type as the SO attributes currently, io-ts is used to ensure that the body sent is compatible with the SO schema. However, these types will soon be separated and require their own form of compile time or runtime-time type checking.

We need to ensure we have proper type checking in two places:

  • The client contract for the monitor configuration
  • The SO attributes contract that is saved for the monitor, after it is transformed from the client contract

We should evaluate how we want to use io-ts and kbn-schema for both of these goals.

Is there any reason we should use kbn-schema alongside io-ts? Or should we stick with using io-ts exclusively because of how complicated the monitor types are?

@dominiqueclarke dominiqueclarke added enhancement New value added to drive a business result Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.9.0 labels Jun 13, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@dominiqueclarke dominiqueclarke changed the title [Synthetics] Consider validating monitor body with kbn-schema [Synthetics] Consider validating client strategy for monitor body Jun 13, 2023
@shahzad31
Copy link
Contributor

not worth redoing validations in kbn-schema, since we already have io-ts based runtime validation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.9.0
Projects
None yet
Development

No branches or pull requests

3 participants