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] Refactor observability alert search bar #147461

Conversation

maryam-saeidi
Copy link
Member

@maryam-saeidi maryam-saeidi commented Dec 13, 2022

📝 Summary

In the previous PR, I've added a provider to pass Kibana dependencies to the observability alert search bar component. Since then, I had a lot of discussions about whether it makes sense to have a context for the dependencies of this component or not. Since we haven't decided yet whether this pattern should be adopted or not and there are suggestions about having one provider for the alert-related components, I refactored it to pass the dependency via props instead.

🧪 How to test

Add this component to APM:

// Add
import { ObservabilityAlertSearchBar } from '@kbn/observability-plugin/public';
export const useToasts = () =>
  useKibana<ApmPluginStartDeps>().services.notifications!.toasts;

// Update
  const {
    triggersActionsUi: {
      getAlertsStateTable: AlertsStateTable,
      getAlertsSearchBar: AlertsSearchBar,
      alertsTableConfigurationRegistry,
    },
    data: {
      query: {
        timefilter: { timefilter: timeFilterService },
      },
    },
  } = services;

// Replace
// <AlertsTableStatusFilter
//       status={alertStatusFilter}
//       onChange={setAlertStatusFilter}
//  />
  <ObservabilityAlertSearchBar
    appName={'apmApp'}
    kuery={''}
    onRangeFromChange={(input) => console.log(input)}
    onRangeToChange={(input) => console.log(input)}
    onKueryChange={(input) => console.log(input)}
    onStatusChange={(input) => console.log(input)}
    onEsQueryChange={(input) => console.log(input)}
    rangeTo={'now'}
    rangeFrom={'now-15m'}
    status={'all'}
    services={{ timeFilterService, AlertsSearchBar, useToasts }}
  />

@maryam-saeidi maryam-saeidi added 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" labels Dec 13, 2022
@maryam-saeidi maryam-saeidi self-assigned this Dec 13, 2022
@maryam-saeidi maryam-saeidi marked this pull request as ready for review December 13, 2022 16:40
@elasticmachine
Copy link
Contributor

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

@maryam-saeidi maryam-saeidi requested review from a team and XavierM December 14, 2022 09:01
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observability 461 460 -1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
observability 579 577 -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.7KB 502.7KB +16.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
observability 33 32 -1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observability 80.1KB 79.4KB -670.0B
Unknown metric groups

API count

id before after diff
observability 583 581 -2

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 61 67 +6
osquery 109 115 +6
securitySolution 445 451 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 70 76 +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

cc @maryam-saeidi

Copy link
Contributor

@CoenWarmer CoenWarmer left a comment

Choose a reason for hiding this comment

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

LGTM :))

@maryam-saeidi maryam-saeidi merged commit 23ca495 into elastic:main Dec 15, 2022
@kibanamachine kibanamachine added v8.7.0 backport:skip This commit does not require backporting labels Dec 15, 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.

5 participants