-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Add transaction error rate alert #76933
[APM] Add transaction error rate alert #76933
Conversation
Pinging @elastic/apm-ui (Team:apm) |
@@ -96,17 +109,22 @@ export function AlertIntegrations(props: Props) { | |||
: []), | |||
], | |||
}, | |||
|
|||
// transaction duration panel |
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 can remove these comments again. Added them for my own sake but I can see how they are somewhat noisy/redundant.
} | ||
)} | ||
value={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.
Transaction type used to be hidden. Now it's visible (read-only)
ac6cade
to
2eb1cd6
Compare
x-pack/plugins/apm/server/lib/rum_client/get_page_view_trends.ts
Outdated
Show resolved
Hide resolved
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.
Uptime code owner changes LGTM
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.
x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/alerting/TransactionErrorRateAlertTrigger/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/public/components/alerting/TransactionDurationAlertTrigger/index.tsx
Outdated
Show resolved
Hide resolved
3843ec0
to
5336dbb
Compare
67c4599
to
9caf99a
Compare
@dgieselaar All comments addressed |
x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_anomaly_alert_type.ts
Show resolved
Hide resolved
const environmentFilter = | ||
alertParams.environment === ENVIRONMENT_ALL.value | ||
? [] | ||
: [{ term: { [SERVICE_ENVIRONMENT]: alertParams.environment } }]; |
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.
shouldn't we use something like getEnvironmentUiFilterES
?
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.
Totally. I was lazy and copied the alert from below and didn't notice:
Will update the other alerts as well
x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts
Outdated
Show resolved
Hide resolved
8dc074d
to
a9ce803
Compare
<ServiceField value={serviceName} />, | ||
<EnvironmentField | ||
currentValue={params.environment} | ||
options={environmentOptions} | ||
onChange={(e) => setAlertParams('environment', e.target.value)} | ||
/>, | ||
<IsAboveField | ||
value={params.threshold} | ||
unit={i18n.translate('xpack.apm.errorCountAlertTrigger.errors', { | ||
defaultMessage: ' errors', |
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.
Extracting commonly-used field types into separate components. I was a little torn whether this improves readability by hiding boilerplate or hurts readability by adding an additional abstraction.
In the end I decided it was better.
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'm not entirely sure if the space should be in the label.
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.
You are right. Was hoping you wouldn't notice 🙈
I'll fix it in a follow-up. For now I'll merge to avoid additional conflicts.
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const apmActionVariables = { |
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.
Extracted the action variables and their descriptions to avoid duplication and improve readability of alerts.
@@ -88,6 +73,7 @@ export function registerTransactionDurationAnomalyAlertType({ | |||
|
|||
const anomalySearchParams = { | |||
body: { | |||
terminateAfter: 1, |
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.
@ogupte I added terminateAfter
to improve perf of this alert since we only need a single document. Do you agree this is fine?
import { getEnvironmentLabel } from '../../../common/environment_filter_values'; | ||
import { PopoverExpression } from './ServiceAlertTrigger/PopoverExpression'; | ||
|
||
export function ServiceField({ value }: { value?: string }) { |
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 file contains the commonly-used alerting fields. I intend for these fields to be almost 1:1 in their use across alerts. If they start to diverge we should abandon this approach (but I don't think that'll be the case)
threshold: alertParams.threshold, | ||
triggerValue: errorCount, |
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.
All threshold alerts now expose the threshold and the value that triggered the alert. They are consistently named threshold
and triggerValue
to make it easier to reuse templates between 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.
nice improvements 👍🏻
<ServiceField value={serviceName} />, | ||
<EnvironmentField | ||
currentValue={params.environment} | ||
options={environmentOptions} | ||
onChange={(e) => setAlertParams('environment', e.target.value)} | ||
/>, | ||
<IsAboveField | ||
value={params.threshold} | ||
unit={i18n.translate('xpack.apm.errorCountAlertTrigger.errors', { | ||
defaultMessage: ' errors', |
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'm not entirely sure if the space should be in the label.
x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts
Outdated
Show resolved
Hide resolved
import { SERVICE_ENVIRONMENT } from '../../../../common/elasticsearch_fieldnames'; | ||
|
||
export function getEnvironmentUiFilterES(environment?: string): ESFilter[] { | ||
if (!environment) { | ||
if (!environment || environment === ENVIRONMENT_ALL.value) { |
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.
What's the use case for having environment as an optional argument here?
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.
getEnvironmentUiFilterES
is called from places where environment
is optional. Those callers would have to implement this themselves if it was required:
const envFilter = environment ? getEnvironmentUiFilterES(environment) : []
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 my guess - haven't checked)
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 see. I guess what I'm arguing is that environment should never be undefined. It should always be ENVIRONMENT_ALL.value, ENVIRONMENT_NOT_DEFINED.value, or another non-empty string. But obviously that's a bigger and potentially painful change.
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.
Agree. I think right now the client will not send environment when "all" is selected. We should ofc always send a value regardless if "not defined", "all" or "" is selected.
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
async chunks size
page load bundle size
distributable file count
History
To update your PR or re-run it, just comment with: |
* master: (92 commits) [ILM] Data tiers for 7.10 (elastic#76126) [ML] Transforms: Fixes styling of preview grid pagination in summary step (elastic#77789) [Drilldowns] Beta badge support. Mark URL Drilldown as Beta (elastic#75654) Re-enable session lifespan, idle timeout api integration tests and use unique names for the security test reports. (elastic#77746) [Alerting] renames code in alerting RBAC exemption to make it easier to maintain (elastic#77598) [Alerting & Actions] Overwrite SOs when updating instead of partially updating (elastic#73688) fixed react warning in Suspense in alert flyout (elastic#77777) [APM] Track usage of Gold+ features (elastic#77630) Visualize: Bad request when working with histogram aggregation (elastic#77684) remove legacy ES plugin (elastic#77703) [Lens] change name of custom query to filters (elastic#77725) skip flaky suite (elastic#76239) remove visual aspects of baseline job (elastic#77815) skip flaky suite (elastic#77835) Fixes typo in data recognizer text (elastic#77691) management/update trusted_apps jest snapshot [build] Use Elastic hosted UBI minimal base image (elastic#77776) [APM] Add transaction error rate alert (elastic#76933) [Security Solution] [Detections] Remove file validation on import route (elastic#77770) [Enterprise Search][tech debt] Add Kea logic paths for easier debugging/defaults (elastic#77698) ...
@sqren @formgeist should we validate if a user tries to create an alert with more than |
@cauemarcondes Good question. I think it's a nice-to-have. Is it easy to do? |
We can add Maybe for 7.10 we should leave it like it is, and maybe change it for 7.11 if needed? |
Tests ok: |
Okay, then let's leave it for now. |
Closes #76367
error_rate
toerror_count
to avoid confusion with transaction error rateIt is now possible to write a message like the one below with the new alert parameters
Transaction type will be read-only if there's only a single value
Transaction type will be a dropdown if there's multiple values
Service name is now visible for all alerts even though it's not editable