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] Prefer ConfigKey.MONITOR_QUERY_ID as the single source of truth for monitor queries #143309

Closed
dominiqueclarke opened this issue Oct 13, 2022 · 3 comments · Fixed by #144176
Labels
Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability

Comments

@dominiqueclarke
Copy link
Contributor

dominiqueclarke commented Oct 13, 2022

In the Synthetics UI, we currently have to rely on two fields for querying monitor data: the monitor.id and monitor.attributes.custom_heartbeat_id.

This is because project monitors utilize the custom_heartbeat_id key when sending configuration to the agent or service. The resulting documents are indexed under that id.

To account for this we've had diverging logic in our codebase that queries using either the monitor.id or, when present, monitor.attributes.custom_heartbeat_Id

To avoid added complexity and conditional logic, we should save all monitors, including UI monitors, with their id under the attributes.id (alias ConfigKey.MONITOR_QUERY_ID) key. We can then move to only using monitor.attributes.id everywhere we query for heartbeat data.

To accomplish this, all existing UI-based monitors will need a migration to place their existing monitor.id under the monitor.attributes.id key.

Additionally, we'll need to start saving new UI-based monitors with monitor.attributes.id at the time they are saved.

@dominiqueclarke dominiqueclarke added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Oct 13, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@dominiqueclarke dominiqueclarke self-assigned this Oct 24, 2022
shahzad31 pushed a commit that referenced this issue Nov 15, 2022
…hroughout the app (#144176)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: shahzad31 <shahzad.muhammad@elastic.co>
Co-authored-by: Shahzad <shahzad31comp@gmail.com>
Resolves #143309
benakansara pushed a commit to benakansara/kibana that referenced this issue Nov 17, 2022
…hroughout the app (elastic#144176)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: shahzad31 <shahzad.muhammad@elastic.co>
Co-authored-by: Shahzad <shahzad31comp@gmail.com>
Resolves elastic#143309
@dominiqueclarke dominiqueclarke changed the title [Synthetics] Prefer custom_heartbeat_id as the single source of truth for monitor queries [Synthetics] Prefer ConfigKey.MONITOR_QUERY_ID as the single source of truth for monitor queries Nov 21, 2022
@dominiqueclarke
Copy link
Contributor Author

dominiqueclarke commented Nov 22, 2022

Two regressions were found related to this, and are currently being worked on. Full post FF testing of this has not yet occurred.

@dominiqueclarke dominiqueclarke removed their assignment Nov 22, 2022
@awahab07 awahab07 self-assigned this Nov 22, 2022
dominiqueclarke added a commit that referenced this issue Nov 22, 2022
…ic item (#145916)

## Summary

Resolves #145922
Resolves #145270

Fixes a regression from #143309

Standardizes the way the monitor duration metric is queried, ensuring
that both monitor types, UI and Project, are queries in the same way.

The changes were also carried into changes to the Monitor Flyout

Before (duration for UI monitor shows, but not the duration for project
monitors)

![image](https://user-images.githubusercontent.com/11356435/203143905-4564b14e-a2af-402c-a2c1-5b95d22ad1e3.png)

After (duration shows for both monitor types)
<img width="1366" alt="Screen Shot 2022-11-21 at 2 39 09 PM"
src="https://user-images.githubusercontent.com/11356435/203144056-d74617e5-6745-4c17-9a68-e5164f4be689.png">

### Testing
1. Create at least one project monitor and one UI monitor
2. Ensure that both monitor types display the duration metric on the
Overview page after running
3. In the actions popover, click edit monitor. Ensure the page redirects
to the monitor edit page appropriately
4. In the actions popover, click go to monitor. Ensure that the page
redirects to the monitor details page appropriately
5. In the actions popover, disable the monitor. Ensure it is successful.
6. In the actions popover, click inspect. Ensure the monitor flyout
appears, then close the flyout.
7. Click on both monitor types, ensure the monitor flyout appears
8. Ensure the monitor duration metric appears in the monitor flyout
9. Ensure the last test run appears in the monitor flyout
10. Ensure both enable toggles work in the monitor flyout (in the body
of the flyout and actions popover next to the flyout title)
11. Ensure the go to monitor link works in the monitor flyout actions
popover next to the monitor title
12. Ensure the edit monitor link works in the monitor flyout actions
popover next to the monitor title

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Nov 22, 2022
…ic item (elastic#145916)

## Summary

Resolves elastic#145922
Resolves elastic#145270

Fixes a regression from elastic#143309

Standardizes the way the monitor duration metric is queried, ensuring
that both monitor types, UI and Project, are queries in the same way.

The changes were also carried into changes to the Monitor Flyout

Before (duration for UI monitor shows, but not the duration for project
monitors)

![image](https://user-images.githubusercontent.com/11356435/203143905-4564b14e-a2af-402c-a2c1-5b95d22ad1e3.png)

After (duration shows for both monitor types)
<img width="1366" alt="Screen Shot 2022-11-21 at 2 39 09 PM"
src="https://user-images.githubusercontent.com/11356435/203144056-d74617e5-6745-4c17-9a68-e5164f4be689.png">

### Testing
1. Create at least one project monitor and one UI monitor
2. Ensure that both monitor types display the duration metric on the
Overview page after running
3. In the actions popover, click edit monitor. Ensure the page redirects
to the monitor edit page appropriately
4. In the actions popover, click go to monitor. Ensure that the page
redirects to the monitor details page appropriately
5. In the actions popover, disable the monitor. Ensure it is successful.
6. In the actions popover, click inspect. Ensure the monitor flyout
appears, then close the flyout.
7. Click on both monitor types, ensure the monitor flyout appears
8. Ensure the monitor duration metric appears in the monitor flyout
9. Ensure the last test run appears in the monitor flyout
10. Ensure both enable toggles work in the monitor flyout (in the body
of the flyout and actions popover next to the flyout title)
11. Ensure the go to monitor link works in the monitor flyout actions
popover next to the monitor title
12. Ensure the edit monitor link works in the monitor flyout actions
popover next to the monitor title

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit e8d77b3)
kibanamachine referenced this issue Nov 22, 2022
…n metric item (#145916) (#146005)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Synthetics] Overview - standardize queries for monitor duration
metric item (#145916)](#145916)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dominique
Clarke","email":"dominique.clarke@elastic.co"},"sourceCommit":{"committedDate":"2022-11-22T14:49:07Z","message":"[Synthetics]
Overview - standardize queries for monitor duration metric item
(#145916)\n\n## Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/145922\r\nResolves
https://github.com/elastic/kibana/issues/145270\r\n\r\nFixes a
regression from
https://github.com/elastic/kibana/issues/143309\r\n\r\nStandardizes the
way the monitor duration metric is queried, ensuring\r\nthat both
monitor types, UI and Project, are queries in the same way.\r\n\r\nThe
changes were also carried into changes to the Monitor
Flyout\r\n\r\nBefore (duration for UI monitor shows, but not the
duration for
project\r\nmonitors)\r\n\r\n![image](https://user-images.githubusercontent.com/11356435/203143905-4564b14e-a2af-402c-a2c1-5b95d22ad1e3.png)\r\n\r\nAfter
(duration shows for both monitor types)\r\n<img width=\"1366\"
alt=\"Screen Shot 2022-11-21 at 2 39 09
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/11356435/203144056-d74617e5-6745-4c17-9a68-e5164f4be689.png\">\r\n\r\n###
Testing\r\n1. Create at least one project monitor and one UI
monitor\r\n2. Ensure that both monitor types display the duration metric
on the\r\nOverview page after running\r\n3. In the actions popover,
click edit monitor. Ensure the page redirects\r\nto the monitor edit
page appropriately\r\n4. In the actions popover, click go to monitor.
Ensure that the page\r\nredirects to the monitor details page
appropriately\r\n5. In the actions popover, disable the monitor. Ensure
it is successful.\r\n6. In the actions popover, click inspect. Ensure
the monitor flyout\r\nappears, then close the flyout.\r\n7. Click on
both monitor types, ensure the monitor flyout appears\r\n8. Ensure the
monitor duration metric appears in the monitor flyout\r\n9. Ensure the
last test run appears in the monitor flyout\r\n10. Ensure both enable
toggles work in the monitor flyout (in the body\r\nof the flyout and
actions popover next to the flyout title)\r\n11. Ensure the go to
monitor link works in the monitor flyout actions\r\npopover next to the
monitor title\r\n12. Ensure the edit monitor link works in the monitor
flyout actions\r\npopover next to the monitor
title\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e8d77b3f0f46ac62e9220ffe28eb455880854906","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:uptime","release_note:skip","v8.6.0","v8.7.0"],"number":145916,"url":"https://github.com/elastic/kibana/pull/145916","mergeCommit":{"message":"[Synthetics]
Overview - standardize queries for monitor duration metric item
(#145916)\n\n## Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/145922\r\nResolves
https://github.com/elastic/kibana/issues/145270\r\n\r\nFixes a
regression from
https://github.com/elastic/kibana/issues/143309\r\n\r\nStandardizes the
way the monitor duration metric is queried, ensuring\r\nthat both
monitor types, UI and Project, are queries in the same way.\r\n\r\nThe
changes were also carried into changes to the Monitor
Flyout\r\n\r\nBefore (duration for UI monitor shows, but not the
duration for
project\r\nmonitors)\r\n\r\n![image](https://user-images.githubusercontent.com/11356435/203143905-4564b14e-a2af-402c-a2c1-5b95d22ad1e3.png)\r\n\r\nAfter
(duration shows for both monitor types)\r\n<img width=\"1366\"
alt=\"Screen Shot 2022-11-21 at 2 39 09
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/11356435/203144056-d74617e5-6745-4c17-9a68-e5164f4be689.png\">\r\n\r\n###
Testing\r\n1. Create at least one project monitor and one UI
monitor\r\n2. Ensure that both monitor types display the duration metric
on the\r\nOverview page after running\r\n3. In the actions popover,
click edit monitor. Ensure the page redirects\r\nto the monitor edit
page appropriately\r\n4. In the actions popover, click go to monitor.
Ensure that the page\r\nredirects to the monitor details page
appropriately\r\n5. In the actions popover, disable the monitor. Ensure
it is successful.\r\n6. In the actions popover, click inspect. Ensure
the monitor flyout\r\nappears, then close the flyout.\r\n7. Click on
both monitor types, ensure the monitor flyout appears\r\n8. Ensure the
monitor duration metric appears in the monitor flyout\r\n9. Ensure the
last test run appears in the monitor flyout\r\n10. Ensure both enable
toggles work in the monitor flyout (in the body\r\nof the flyout and
actions popover next to the flyout title)\r\n11. Ensure the go to
monitor link works in the monitor flyout actions\r\npopover next to the
monitor title\r\n12. Ensure the edit monitor link works in the monitor
flyout actions\r\npopover next to the monitor
title\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e8d77b3f0f46ac62e9220ffe28eb455880854906"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145916","number":145916,"mergeCommit":{"message":"[Synthetics]
Overview - standardize queries for monitor duration metric item
(#145916)\n\n## Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/145922\r\nResolves
https://github.com/elastic/kibana/issues/145270\r\n\r\nFixes a
regression from
https://github.com/elastic/kibana/issues/143309\r\n\r\nStandardizes the
way the monitor duration metric is queried, ensuring\r\nthat both
monitor types, UI and Project, are queries in the same way.\r\n\r\nThe
changes were also carried into changes to the Monitor
Flyout\r\n\r\nBefore (duration for UI monitor shows, but not the
duration for
project\r\nmonitors)\r\n\r\n![image](https://user-images.githubusercontent.com/11356435/203143905-4564b14e-a2af-402c-a2c1-5b95d22ad1e3.png)\r\n\r\nAfter
(duration shows for both monitor types)\r\n<img width=\"1366\"
alt=\"Screen Shot 2022-11-21 at 2 39 09
PM\"\r\nsrc=\"https://user-images.githubusercontent.com/11356435/203144056-d74617e5-6745-4c17-9a68-e5164f4be689.png\">\r\n\r\n###
Testing\r\n1. Create at least one project monitor and one UI
monitor\r\n2. Ensure that both monitor types display the duration metric
on the\r\nOverview page after running\r\n3. In the actions popover,
click edit monitor. Ensure the page redirects\r\nto the monitor edit
page appropriately\r\n4. In the actions popover, click go to monitor.
Ensure that the page\r\nredirects to the monitor details page
appropriately\r\n5. In the actions popover, disable the monitor. Ensure
it is successful.\r\n6. In the actions popover, click inspect. Ensure
the monitor flyout\r\nappears, then close the flyout.\r\n7. Click on
both monitor types, ensure the monitor flyout appears\r\n8. Ensure the
monitor duration metric appears in the monitor flyout\r\n9. Ensure the
last test run appears in the monitor flyout\r\n10. Ensure both enable
toggles work in the monitor flyout (in the body\r\nof the flyout and
actions popover next to the flyout title)\r\n11. Ensure the go to
monitor link works in the monitor flyout actions\r\npopover next to the
monitor title\r\n12. Ensure the edit monitor link works in the monitor
flyout actions\r\npopover next to the monitor
title\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"e8d77b3f0f46ac62e9220ffe28eb455880854906"}}]}]
BACKPORT-->

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
@awahab07
Copy link
Contributor

Post FF Testing

Tested HTTP and Browser monitor types, both created on UI and pushed via project. Walked through pages and links and it LGTM.

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
3 participants