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

[AO] Allow providing custom time range for Alert Summary Widget #147253

Merged
merged 15 commits into from
Dec 14, 2022

Conversation

maryam-saeidi
Copy link
Member

Resolves #139489

📝 Summary

Allow time range filter to be provided by consumer for Alert Summary Widget.

🧪 How to test

The functionality of the Alert Summary Widget has not been changed, so Alert Summary Widget should have the same information as before. You can check if the numbers that you see in the widget match the number of alerts in the alert table.

@maryam-saeidi maryam-saeidi changed the title Allow time range filter to be provided by consumer for Alert Summary … [AO] Allow providing custom time range for Alert Summary Widget Dec 8, 2022
@maryam-saeidi maryam-saeidi added Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" release_note:skip Skip the PR/issue when compiling release notes labels Dec 8, 2022
@maryam-saeidi maryam-saeidi marked this pull request as ready for review December 8, 2022 16:41
@maryam-saeidi maryam-saeidi requested review from a team as code owners December 8, 2022 16:41
@elasticmachine
Copy link
Contributor

Pinging @elastic/actionable-observability (Team: Actionable Observability)

Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a question about the use of state for the default time range value.

@@ -108,6 +110,7 @@ export function RuleDetailsPage() {
const [editFlyoutVisible, setEditFlyoutVisible] = useState<boolean>(false);
const [isRuleEditPopoverOpen, setIsRuleEditPopoverOpen] = useState(false);
const [esQuery, setEsQuery] = useState<{ bool: BoolQuery }>();
const [defaultAlertTimeRange] = useState(getDefaultAlertSummaryTimeRange);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to use a state for this? Can it be just a variable in this scope, or a constant in the module?

Copy link
Member Author

@maryam-saeidi maryam-saeidi Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for having this state is to run getAbsoluteTimeRange only once during the rendering of this component. getAbsoluteTimeRange will return the absolute time for the last 30 days at the time of the execution and I didn't want this value to be created more than once in this component but I also didn't want to have it created when the module is loaded so I used the state in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - I also saw that people use useRef to do that to avoid the state

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I'll keep it in the state to be able to refresh it in case we want to.

Copy link
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observability 459 461 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observability 502.4KB 502.7KB +306.0B
triggersActionsUi 690.9KB 690.9KB -21.0B
total +285.0B
Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 60 66 +6
osquery 109 115 +6
securitySolution 445 451 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 69 75 +6
osquery 110 117 +7
securitySolution 521 527 +6
total +21

History

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

@maryam-saeidi maryam-saeidi merged commit a92c796 into elastic:main Dec 14, 2022
@kibanamachine kibanamachine added v8.7.0 backport:skip This commit does not require backporting labels Dec 14, 2022
jloleysens added a commit to jloleysens/kibana that referenced this pull request Dec 14, 2022
* main: (21 commits)
  [Profiling] Remove link to 'Other' bucket (elastic#147523)
  [Synthetics UI] Add missing configuration options to the add/edit monitor forms (elastic#147265)
  [DOCS] Updates what's new pages (elastic#147483)
  [Fleet][Endpoint][RBAC V2] Update fleet router and config to allow API access via RBAC controls (elastic#145361)
  [Guided onboarding] Update guide IDs (elastic#147348)
  [Synthetics] Add synthetics settings alerting default (elastic#147339)
  [Security Solution][Endpoint] Fix Policy form being displayed as Read Only when displayed in Fleet pages (elastic#147212)
  [Cases] Save draft user comment (elastic#146327)
  [API Docs] Fix `--plugin` filter (elastic#147500)
  [Fleet] added a logic to use `destinationId` when tagging imported SOs (elastic#147439)
  Do not skip UPDATE_TARGET_MAPPINGS if upgrading to a newer stack version (elastic#147503)
  [Discover] Validate if Data View time field exists on Alert creation / editing (elastic#146324)
  [Discover] Fix Discover navigation from Lens embeddable (elastic#147000)
  Allow users to Update API Keys (elastic#146237)
  Update dependency xstate to ^4.35.0 (main) (elastic#147463)
  [Behavioral Analytics] Remove feature flag to hide functionality (elastic#147429)
  [Fleet] Add agent policy `inactivity_timeout`experimental setting (elastic#147432)
  [APM] Switching service groups from grid to flex layout (elastic#147448)
  [Fleet] Add missing endpoints to openApi specs (elastic#147452)
  [AO] Allow providing custom time range for Alert Summary Widget (elastic#147253)
  ...
nreese pushed a commit to nreese/kibana that referenced this pull request Dec 16, 2022
…tic#147253)

Resolves elastic#139489

## 📝 Summary

Allow time range filter to be provided by consumer for Alert Summary
Widget.

## 🧪 How to test

The functionality of the Alert Summary Widget has not been changed, so
Alert Summary Widget should have the same information as before. You can
check if the numbers that you see in the widget match the number of
alerts in the alert table.

Co-authored-by: Kevin Delemme <kdelemme@gmail.com>
@maryam-saeidi maryam-saeidi deleted the 139489-time-range-filter branch December 19, 2022 10:29
@maryam-saeidi maryam-saeidi self-assigned this Dec 30, 2022
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: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Actionable Observability] Add time range filter to Alerts Summary Widget
6 participants