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

Alert creation and freeform selection #111883

Merged
merged 38 commits into from
Sep 29, 2021
Merged

Conversation

smith
Copy link
Contributor

@smith smith commented Sep 10, 2021

Allow selecting any service name, transaction type (where appropriate), and environment when creating and editing rules, both in APM and Stack Management.

  • Create /internal/apm/suggestions endpoint that uses terms_enum
  • Use combo box for environment, service name, and transaction type with suggestions endpoint on all alerts
  • Remove "Go to APM" callouts on new alert creation
  • Wrap calls to createCallApmApi in alert triggers with useEffect
  • Use getEnvironmentLabel for value in environment field expression
  • Make all AlertParams fields optional (except in latency threshold alert)
  • Add e2e tests for creating an alert
  • Remove NewAlertEmptyPrompt component and isNewApmRuleFromStackManagement helper
  • Replace maxServiceEnvironments and maxServiceSelections config options with maxSuggestions advanced setting.

CleanShot 2021-09-28 at 10 35 58

Fixes #106786

@smith smith added release_note:enhancement v7.16.0 v8.0.0 auto-backport Deprecated - use backport:version if exact versions are needed labels Sep 28, 2021
@smith smith marked this pull request as ready for review September 28, 2021 15:41
@smith smith requested review from a team as code owners September 28, 2021 15:41
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Sep 28, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

Looks great!

import * as stories from './error_count_alert_trigger.stories';
import { composeStories } from '@storybook/testing-react';

const { CreatingInApmFromService } = composeStories(stories);
Copy link
Member

Choose a reason for hiding this comment

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

Yay! Great to see storybook and testing-library playing well together. What's your impression of this so far?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's pretty great. Centralizes most of the boilerplate and makes injecting data easy.

isLoading={status === FETCH_STATUS.LOADING}
onChange={handleChange}
onCreateOption={handleCreateOption}
onSearchChange={debounce(setSearchValue, 500)}
Copy link
Member

Choose a reason for hiding this comment

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

I think we want to use throttle to allow continuous results to come through even as the user is typing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think debounce is more appropriate here. throttle will just keep making requests. I found https://redd.one/blog/debounce-vs-throttle useful.

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
deprecations: ({ deprecate, renameFromRoot }) => [
deprecate('enabled', '8.0.0'),
renameFromRoot(
Copy link
Member

Choose a reason for hiding this comment

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

@ogupte I think you can use renameFromRoot when working on #108160

deprecate('enabled', '8.0.0'),
renameFromRoot(
'xpack.apm.maxServiceEnvironments',
`uiSettings.overrides[${maxSuggestions}]`
Copy link
Member

Choose a reason for hiding this comment

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

What does this actually do? It looks like we are not using xpack.apm.maxServiceEnvironments anywhere in the ui anymore.

Copy link
Member

@sorenlouv sorenlouv Sep 28, 2021

Choose a reason for hiding this comment

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

nvm, I understand now that we are basically renaming the config setting but allowing users to keep using the old name.

import { createApmServerRouteRepository } from './create_apm_server_route_repository';

const suggestionsRoute = createApmServerRoute({
endpoint: 'GET /internal/apm/suggestions',
Copy link
Member

@sorenlouv sorenlouv Sep 29, 2021

Choose a reason for hiding this comment

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

Thanks for creating this as an internal api.
I recall there was an issue for doing this in Kibana but can't find it now. I think we should have an APM specific issue so we have it captured on our board too.

Copy link
Member

Choose a reason for hiding this comment

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

Created an issue for internal apis here: #113383

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

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 232 234 +2

Async chunks

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

id before after diff
apm 2.7MB 2.7MB -2.0KB

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
apm 36 37 +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 28.6KB 28.6KB +6.0B
Unknown metric groups

API count

id before after diff
observability 232 234 +2

History

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

@smith smith merged commit f4a95f9 into elastic:master Sep 29, 2021
@smith smith deleted the nls/create-alerts branch September 29, 2021 16:18
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 29, 2021
Allow selecting any service name, transaction type (where appropriate), and environment when creating and editing rules, both in APM and Stack Management.

- Create /internal/apm/suggestions endpoint that uses `terms_enum`
- Use combo box for environment, service name, and transaction type with suggestions endpoint on all alerts
- Remove "Go to APM" callouts on new alert creation
- Wrap calls to `createCallApmApi` in alert triggers with `useEffect`
- Use `getEnvironmentLabel` for value in environment field expression
- Make all `AlertParams` fields optional (except in latency threshold alert)
- Add e2e tests for creating an alert
- Remove `NewAlertEmptyPrompt` component and `isNewApmRuleFromStackManagement` helper
- Replace `maxServiceEnvironments` and `maxServiceSelections` config options with `maxSuggestions` advanced setting.


![CleanShot 2021-09-28 at 10 35 58](https://user-images.githubusercontent.com/9912/135119948-e247615a-d235-4feb-b197-b803f165ad1e.gif)

Fixes elastic#106786
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Sep 29, 2021
Allow selecting any service name, transaction type (where appropriate), and environment when creating and editing rules, both in APM and Stack Management.

- Create /internal/apm/suggestions endpoint that uses `terms_enum`
- Use combo box for environment, service name, and transaction type with suggestions endpoint on all alerts
- Remove "Go to APM" callouts on new alert creation
- Wrap calls to `createCallApmApi` in alert triggers with `useEffect`
- Use `getEnvironmentLabel` for value in environment field expression
- Make all `AlertParams` fields optional (except in latency threshold alert)
- Add e2e tests for creating an alert
- Remove `NewAlertEmptyPrompt` component and `isNewApmRuleFromStackManagement` helper
- Replace `maxServiceEnvironments` and `maxServiceSelections` config options with `maxSuggestions` advanced setting.


![CleanShot 2021-09-28 at 10 35 58](https://user-images.githubusercontent.com/9912/135119948-e247615a-d235-4feb-b197-b803f165ad1e.gif)

Fixes #106786

Co-authored-by: Nathan L Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:enhancement Team:APM All issues that need APM UI Team support v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Add and edit alerts outside of APM UI
5 participants