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

[Backport 2.x] Various bug fixes #507

Merged
merged 1 commit into from
Mar 24, 2023
Merged

Conversation

opensearch-trigger-bot[bot]
Copy link
Contributor

Backport 6dc848e from #502

* Various bug fixes

We display the error message "No features have been added to this anomaly detector. A feature is a metric used for anomaly detection. A detector can detect anomalies across one or more features" when the preview API fails to complete the preview request due to one of the following reasons:
* The preview API cannot locate sufficient data to show sample anomaly results, as it requires more than 400 data points within the preview date range (from 5 days ago to the present time).
* The preview API fails with an error (e.g., 5xx error).
* No features have been added to the anomaly detector.
* No features have been enabled in the anomaly detector.

This pull request (PR) fixes the issue by displaying errors on a case-by-case basis.

Additionally, this PR adds Prettier to the repository as it is used by Dashboards and other plugins (https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/DEVELOPER_GUIDE.md#prettier-and-linting).

Furthermore, this PR standardizes the preview range to 7 days. Previously, we attempted to use 7 days but had to override it to 5 days due to two startTime fields in the parameters (refer to AnomalyDetectorData.js).

This PR also resolves a bug where we show two links to the detector configuration (refer to getOverviewStats.js).

This PR addresses a warning when displaying a detector URL on the monitor overview page (OverviewStat/OverviewStat). As the following error trace indicates, we only supported string or number as a value in Overview stats. This PR introduces a React element as another supported type.
checkPropTypes.js:20 Warning: Failed prop type: Invalid prop `value` supplied to `OverviewStat`, expected one of type [string, number].
in OverviewStat (created by MonitorOverview)
in MonitorOverview (created by MonitorDetails)
in div (created by MonitorDetails)
in MonitorDetails (created by Context.Consumer)
in Route (created by Context.Consumer)
in Switch (created by Context.Consumer)
in div (created by Context.Consumer)
in Main (created by Context.Consumer)
in Route
in Router (created by HashRouter)
in HashRouter

This PR also removes the unused file AnomalyHistory.js.

Testing done:
* Manually tested each preview failure scenario.
* Manually tested alerting workflow of both HC and single stream detectors still works.
* Added unit tests for new code.

Signed-off-by: Kaituo Li <[email protected]>

* add missing period

Signed-off-by: Kaituo Li <[email protected]>

* Don't block trigger creation when preview fails

Creating/editing a monitor without setting a trigger means no alert is ever raised. This commit fixed the issue.

Signed-off-by: Kaituo Li <[email protected]>

---------

Signed-off-by: Kaituo Li <[email protected]>
(cherry picked from commit 6dc848e)
@opensearch-trigger-bot opensearch-trigger-bot bot requested a review from a team March 23, 2023 23:57
@AWSHurneyt
Copy link
Collaborator

The cypress tests are failing in this PR because the version bump PR had not yet been merged. #506
It is now merged though.

@kaituo kaituo merged commit 91785d7 into 2.x Mar 24, 2023
@github-actions github-actions bot deleted the backport/backport-502-to-2.x branch March 24, 2023 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants