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] Isolate Add/Edit API routes HTTP interface from SavedObject type #162519

Conversation

awahab07
Copy link
Contributor

@awahab07 awahab07 commented Jul 25, 2023

Resolves #153495

Summary

For monitor crud Add and Edit routes, the PR refactors the API response to isolate the returned data type from SavedObject interface and returns a monitor object instead. The notion of accessing monitor fields via attributes is eliminated from the frontend code and there's no reference to SavedObject anymore under synthetics/public directory.

Testing

Monitor Add/Edit server routes previously were responding the success payload in the form

  {
    "id": "d42afe4e-0f3e-4c3f-b37b-9ecb6a1ab46e",     // (generated) saved object id
    "attributes": {
      "type": "browser",
      ...
      "config_id": "d42afe4e-0f3e-4c3f-b37b-9ecb6a1ab46e",       // (generated) saved object id
      "id": "<custom-heartbeat-id>" // or same as config_id for a UI monitor
      "custom_heartbeat_id": "<custom-heartbeat-id>" // or undefined for a UI monitor
    },
    "created_at": "2023-07-24T16:24:15.697Z",
    "updated_at": "2023-07-24T16:24:15.697Z"
  }

will now response with the following payload format

{
  "type": "browser",
  ...
  "config_id": "d42afe4e-0f3e-4c3f-b37b-9ecb6a1ab46e", // (generated) saved object id
  "id": "<custom-heartbeat-id>" // or same as config_id for a UI monitor
  "custom_heartbeat_id": "<custom-heartbeat-id>" // or undefined for a UI monitor
  "created_at": "2023-07-24T16:24:15.697Z",
  "updated_at": "2023-07-24T16:24:15.697Z"
}

so code paths which might have been relying on the outer id(which they shouldn't regardless and should only rely on monitor[ConfigKey.MONITOR_QUERY_ID] and monitor[ConfigKey.CONFIG_ID]) in the old format including monitor add/update/push, alerts enable/disable, monitor enable/disable, run once and UI routes e.g. monitor details, test run details and step details etc should be smoke tested while also keeping an eye on runtime bugs in kibana and browser console.

@awahab07 awahab07 added Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability release_note:skip Skip the PR/issue when compiling release notes v8.10.0 labels Jul 25, 2023
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@awahab07 awahab07 force-pushed the 153495-Add-Edit-API-Isolate-Client-Interface-and-SO-attributes branch from aca67da to d4104a5 Compare July 26, 2023 11:00
@awahab07 awahab07 force-pushed the 153495-Add-Edit-API-Isolate-Client-Interface-and-SO-attributes branch from 9e08a39 to 31b0c0e Compare July 26, 2023 22:21
@awahab07 awahab07 marked this pull request as ready for review July 27, 2023 12:08
@awahab07 awahab07 requested a review from a team as a code owner July 27, 2023 12:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

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
synthetics 912.7KB 912.8KB +47.0B
Unknown metric groups

References to deprecated APIs

id before after diff
synthetics 31 27 -4

History

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

@shahzad31 shahzad31 merged commit d7e16b3 into elastic:main Jul 31, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 31, 2023
ThomThomson pushed a commit to ThomThomson/kibana that referenced this pull request Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Synthetics] Add / Edit monitor API - isolate HTTP interface from SO attributes
6 participants