-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Synthetics] ensure metric color and current status are synced (#145031)
## Summary Relates to #146001 This PR ensures that the status of monitors is in sync with the current status metric by deriving the status of each individual monitor card based on the current status api. Updates the current status api to [return objects representing all the down monitors and all the up monitors](https://github.com/elastic/kibana/pull/145031/files#diff-db953498cb683d4f81a105a8c53f80ef08aea4bb687e6a29f651dd4e148bcc55R122), with the keys being the combination of the monitor config id and location name. These two objects are [combined into one object in redux](https://github.com/elastic/kibana/pull/145031/files#diff-2fb9b43772c61e2706a828651abd651a2a03b33b9f7b59c91d91c3a245edf655R77). Creates a new `useStatusByLocationOverview` [hook](https://github.com/elastic/kibana/pull/145031/files#diff-b80b952c8c3e15be0472d8b63a23f6ca0798dfbfdbce6a1ed056d7f954ab200eR11) that consumes this object. [Uses that hook](https://github.com/elastic/kibana/pull/145031/files#diff-d65b7f3fa061b4f65d63f72296d29f603e10757e595dd688a34fa99deeac3250R56) in Overview Metric item to derive the status. ### Testing 1. Create a handful of monitors, ensuring you have at least 1 ui monitor and 1 project monitor 2. Ensure your cluster is connected to the synthetics service, either by running the service locally or connecting to dev environment 3. Navigate to overview. Ensure the number of down monitor cards and number of up monitor cards matches the current status metric 4. Use the sort by status feature to test for regression. That logic was lightly touched in this PR
- Loading branch information
1 parent
d0039ea
commit 578d643
Showing
12 changed files
with
153 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_status_by_location_overview.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { useSelector } from 'react-redux'; | ||
import { selectOverviewStatus } from '../state/overview'; | ||
|
||
export function useStatusByLocationOverview(configId: string, locationName?: string) { | ||
const { status } = useSelector(selectOverviewStatus); | ||
if (!locationName || !status) { | ||
return 'unknown'; | ||
} | ||
const allConfigs = status.allConfigs; | ||
|
||
return allConfigs[`${configId}-${locationName}`]?.status || 'unknown'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.