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] Add / Edit monitor API - isolate HTTP interface from SO attributes #153495

Closed
Tracked by #153396
dominiqueclarke opened this issue Mar 22, 2023 · 1 comment · Fixed by #162519
Closed
Tracked by #153396
Assignees
Labels
Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability

Comments

@dominiqueclarke
Copy link
Contributor

dominiqueclarke commented Mar 22, 2023

Relates to #153469

To prepare for serverless and versioned HTTP apis, we need to isolate our api interfaces from our saved object interfaces.

APIs whose interface directly references saved objects fields must be updated to remove those references, opting instead to separate out the HTTP interface from any saved object fields reference and transform the request to saved object fields when necessary.

The HTTP versioning doc states:

Your HTTP route should not return SO-attribs as-is. You need to use two TypeScript interfaces, one for your HTTP route and one for your SO-attribs, even if they are exactly the same.

In particular, the synthetics get and edit monitor APIs rely on the client to directly provide the SO interface for writes and updates, and directly returns the saved object attributes wholesale on reads.

https://github.com/elastic/kibana/blob/main/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts#L61
https://github.com/elastic/kibana/blob/main/x-pack/plugins/synthetics/server/routes/monitor_cruds/edit_monitor.ts#L56

We'll need to separate out the HTTP schema for creating and updating and monitors from the existing SyntheticsMonitor and EncryptedSyntheticsMonitor schema.

https://github.com/elastic/kibana/blob/main/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts#L321
https://github.com/elastic/kibana/blob/main/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts#LL438

We might want to rename the existing SyntheticsMonitor and EncryptedSyntheticsMonitor interfaces to SyntheticsMonitorAttributes and EncryptedSyntheticsMonitorAttributes and create new to create a new typescript interface, SyntheticsMonitor and EncryptedSyntheticsMonitor that represents the interface returned from the HTTP. These two interfaces need to be separate and maintained separately, even if they are exactly the same currently.

@dominiqueclarke dominiqueclarke added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Mar 22, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants