-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[APM] Threshold alerts #59566
[APM] Threshold alerts #59566
Conversation
a77f088
to
564dbc9
Compare
'save', | ||
'alerting:show', | ||
'actions:show', | ||
'alerting:save', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to grant users granular access, like alerting:show
bu not actions:show
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible for us? Or for admins?
.../plugins/apm/public/components/app/ServiceDetails/AlertIntegrations/AlertingFlyout/index.tsx
Outdated
Show resolved
Hide resolved
I don't think so. Previously (IIRC) there were instance specific properties
(setFlyoutVisible etc) passed to the context component but they were
recently moved to the form, so might be fine as a root component now.
Op di 10 mrt. 2020 23:30 schreef Søren Louv-Jansen <notifications@github.com
…:
***@***.**** commented on this pull request.
------------------------------
In
x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/AlertIntegrations/AlertingFlyout/index.tsx
<#59566 (comment)>:
> +
+export function AlertingFlyout(props: Props) {
+ const { addFlyoutVisible, setAddFlyoutVisibility, alertType } = props;
+
+ const plugin = useApmPluginContext();
+
+ return (
+ <AlertsContextProvider
+ value={{
+ http: plugin.core.http,
+ toastNotifications: plugin.core.notifications.toasts,
+ actionTypeRegistry:
+ plugin.plugins.triggers_actions_ui.actionTypeRegistry,
+ alertTypeRegistry: plugin.plugins.triggers_actions_ui.alertTypeRegistry
+ }}
+ >
is it overkill adding AlertsContextProvider at the application root?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#59566?email_source=notifications&email_token=AACWDXAPE5MGLEZRWXKJHADRG25Q7A5CNFSM4LDD7UK2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCYY5ULQ#pullrequestreview-372365870>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACWDXHSABERLQPJLX7BHJDRG25Q7ANCNFSM4LDD7UKQ>
.
|
@@ -88,22 +88,31 @@ export const apm: LegacyPluginInitializer = kibana => { | |||
catalogue: ['apm'], | |||
privileges: { | |||
all: { | |||
api: ['apm', 'apm_write'], | |||
api: ['apm', 'apm_write', 'actions-read', 'alerting-read'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apm_write
uses snake_case. Should we stay consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw. Should apm
be renamed to apm_read
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah.. actions-read
is what's defined in the Action app endpoints...
My mind is a little hazy on this mapping concept. Are we mapping tags to privileges here? How does it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understood it last time I looked into it, but that was last year. It seems this mapping concept is not immediately intuitive so adding some comments (albeit a bit verbose) might be a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would just linking to x-pack/plugins/features/common/feature_kibana_privileges.ts
where it's explained be OK? Rather than copying documentation between files?
AlertAdd | ||
} from '../../../../../../../../../plugins/triggers_actions_ui/public'; | ||
|
||
type AlertAddProps = React.ComponentProps<typeof AlertAdd>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such an underrated ts helper
parsedInterval = parseEsInterval(duration); | ||
} catch (err) { | ||
// | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the error be handled somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't, but I'll leave a comment there with the reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case this feels like something that shouldn't be thrown from parseEsInterval
. But I can see how that is not easily changed.
value={parsedInterval?.value ?? ''} | ||
onChange={e => onChange(`${e.target.value}${displayedUnit.current}`)} | ||
prepend={i18n.translate( | ||
'xpack.apm.serviceAlertTrigger.durationField..last', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This key looks off durationField..last
// | ||
} | ||
|
||
const displayedUnit = useRef(parsedInterval?.unit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the ref needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To allow the user to clear the number input. I'll add a comment there as well:
// we use a ref that we only update when we've succesfully parsed
// the interval. this allows the user to clear the number input
// without us having to fill it with a 0 in order for it to be
// succesfully parsed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have to fill it with a 0? Is ""
(empty string) not valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what this is (was) about - supporting anything that is not a valid number, which is e.g. what happens when the user clears the field. Once that happens we can no longer successfully parse the interval.
In any case I'm now using the ForLastExpression
that the triggers_actions_ui plugin provides.
}); | ||
|
||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬I'll add a comment.
564dbc9
to
c0dc3c7
Compare
`service.name:${params.serviceName}`, | ||
`transaction.type:${params.transactionType}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use the ecs constants:
`service.name:${params.serviceName}`, | |
`transaction.type:${params.transactionType}` | |
`${SERVICE_NAME}:${params.serviceName}`, | |
`${TRANSACTION_TYPE}:${params.transactionType}` |
Ntw. what do you think about renaming elasticsearch_fieldnames.ts to ecs.ts ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not all ECS (unfortunately). ie, service.environment
is not in the ECS specification. Same goes for error.grouping_key
and a couple of others. So maybe elasticsearch_fieldnames
is good enough for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I'm removing the service.name
and transaction.type
tags. We're not doing anything wiht lookups now, and in the future (IIRC) we can use the params.
@dgieselaar I've collected some immediate design feedback and polish comments;
Also, can you tell me how exactly we calculate the Error rate? The number of new errors over the selected time range? Not sure the label title and append copy are good enough... Looks great otherwise 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Happy to see one more alerting integration!
c0dc3c7
to
5a28653
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor label changes that move for consistency across Observability apps.
name: i18n.translate( | ||
'xpack.apm.serviceDetails.alertsMenu.viewActiveAlerts', | ||
{ | ||
defaultMessage: 'View active alerts' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultMessage: 'View active alerts' | |
defaultMessage: 'Manage alerts' |
const createThresholdAlertLabel = i18n.translate( | ||
'xpack.apm.serviceDetails.alertsMenu.createThresholdAlert', | ||
{ | ||
defaultMessage: 'Create threshold alert' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultMessage: 'Create threshold alert' | |
defaultMessage: 'Create alert' |
name: i18n.translate( | ||
'xpack.apm.serviceDetails.alertsMenu.transactionDuration', | ||
{ | ||
defaultMessage: 'Transaction duration' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultMessage: 'Transaction duration' | |
defaultMessage: 'Transaction duration threshold' |
name: i18n.translate( | ||
'xpack.apm.serviceDetails.alertsMenu.errorRate', | ||
{ | ||
defaultMessage: 'Error rate' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultMessage: 'Error rate' | |
defaultMessage: 'Error rate threshold' |
5a28653
to
fcb78c7
Compare
fcb78c7
to
cdf77ce
Compare
4a9bcf5
to
bd7a6f0
Compare
bd7a6f0
to
5ff8d75
Compare
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Add alerting/actions permissions for APM * Export TIME_UNITS, getTimeUnitLabel from triggers actions UI plugin * Add APM alert types and UI * Review feedback * Use Expression components for triggers * Update alert name for transaction duration * Change defaults for error rate trigger
* Add alerting/actions permissions for APM * Export TIME_UNITS, getTimeUnitLabel from triggers actions UI plugin * Add APM alert types and UI * Review feedback * Use Expression components for triggers * Update alert name for transaction duration * Change defaults for error rate trigger
* master: Updating our direct usage of https-proxy-agent to 5.0.0 (elastic#58296) allow users to unset the throttle of an alert (elastic#60964) [Lens] Fix bug in metric config panel (elastic#60982) [SearchProfiler] Minor fixes (elastic#60919) [ML] Renaming ML setup and start contracts (elastic#60980) introduce StartServicesAccessor type for `CoreSetup.getStartServices` (elastic#60748) [SIEM][Detection Engine] Add rule's notification alert type (elastic#60832) [APM] Re-revert "Collect telemetry about data/API performance" (elastic#61030) [NP] Graph: get rid of saved objects class wrapper (elastic#59917) [EPM] merge duplicate fields when creating index patterns (elastic#60957) [Uptime] Ml detection of duration anomalies (elastic#59785) [Alerting] removes unimplemented buttons from Alert Details page (elastic#60934) [skip-ci] Fix CODEOWNERS paths for the Pulse team (elastic#60944) [APM] Threshold alerts (elastic#59566) [ML] Add support for percentiles aggregation to Transform wizard (elastic#60763) Cahgen save object duplicate message (elastic#60901)
Tests ok. |
Closes #49038 (
actually, does it? should we remove the watcher functionality in this PR as wellwe'll keep the Watcher one as well for the time being).Out of scope:
I've not yet tested all scenarios, but it would be helpful to get some feedback while I'm out on spacetime so I can pick it up directly after.
Related issues:
Relevant changes for @elastic/kibana-alerting-services are mostly in a77f088bd5aec73716cb68a0fb9ceaeb19fa9adc and 73d6bdc5b111c61038e06e488ef37212c55a74bc.