elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.6k stars 8.21k forks source link

[synthetics API] inconsistencies between monitor create / get / update APIs #189906

Closed biscout42 closed 1 month ago

biscout42 commented 2 months ago

Kibana version: 8.14.3

Elasticsearch version: 8.14.3

Server OS version: Tested with docker, docker.elastic.co/elasticsearch/elasticsearch:8.14.3 / docker.elastic.co/kibana/kibana:8.14.3

Here is docker compose example

Browser version: N/A

Browser OS version: N/A

Original install method (e.g. download page, yum, from source, etc.): Docker

Describe the bug:

  1. params field stated to be a string, but API accepts as string as well as json object.
  2. response of PUT / POST (create / update) monitor API return params as json object only, not a string.
  3. GET request doesn't return params, username, password, proxy_headers, check.response.body.positive
  4. GET, PUT and POST requests doesn't return retest_on_failure field
  5. max_redirects for http monitor described as number, but API returns it as a string. You could also see that doc shows it as string
    "max_redirects": "0",
  6. GET API doesn't return inline_script and synthetics_args.

The difference in ssl, check and response fields is so that it is impossible to make back and forth mapping (aka not isomorphic, which is required for terraform resource, e.g.).

Steps to reproduce: I was able to reproduce it in this unit test

Steps:

  1. create elasticsearch and kibana, e.g. in docker
  2. create private location in fleet, e.g. via API
  3. call monitor create API and provide params as string / as json object -> see response has params as json object
  4. call monitor GET api -> see response doesn't have params field
  5. call update api -> see response has params as json object

Expected behavior:

Overall idea - could we try to keep two invariants?

  1. Request and Response schema is identical, or isomorphic?
  2. The test to verify it: create a request, send it to API and compare result with the request.

Attach couple of examples for http and tcp monitors:

elasticmachine commented 2 months ago

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