-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Actionable Observability] - Add alert annotation and threshold shade…
… on the APM latency chart on the Alert Details page (#147848) ## Summary Closes #147779 by adding the following elements to the latency chart for the Latency threshold alert: 1. Alert annotation that indicates when the alert is triggered 2. Alert threshold rect (shade) 3. Alert threshold annotation (red line on Y axe) 4. Alert active rect (dark red shade where the alert is active) 
- Loading branch information
Showing
11 changed files
with
266 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ugins/apm/public/components/alerting/ui_components/alert_details_app_section/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
export const DEFAULT_DATE_FORMAT = 'HH:mm:ss'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...ng/ui_components/alert_details_app_section/latency_chart_components/alert_active_rect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { RectAnnotation } from '@elastic/charts'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
|
||
export function AlertActiveRect({ alertStarted }: { alertStarted: number }) { | ||
return ( | ||
<RectAnnotation | ||
id="rect_alert_active" | ||
dataValues={[ | ||
{ | ||
coordinates: { | ||
y0: 0, | ||
x0: alertStarted, | ||
}, | ||
details: i18n.translate( | ||
'xpack.apm.latency.chart.alertDetails.active', | ||
{ | ||
defaultMessage: 'Active', | ||
} | ||
), | ||
}, | ||
]} | ||
style={{ fill: 'red', opacity: 0.2 }} | ||
/> | ||
); | ||
} |
47 changes: 47 additions & 0 deletions
47
...ing/ui_components/alert_details_app_section/latency_chart_components/alert_annotation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
AnnotationDomainType, | ||
LineAnnotation, | ||
Position, | ||
} from '@elastic/charts'; | ||
import moment from 'moment'; | ||
import { EuiIcon } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { DEFAULT_DATE_FORMAT } from '../constants'; | ||
|
||
export function AlertAnnotation({ alertStarted }: { alertStarted: number }) { | ||
return ( | ||
<LineAnnotation | ||
id="annotation_alert_started" | ||
domainType={AnnotationDomainType.XDomain} | ||
dataValues={[ | ||
{ | ||
dataValue: alertStarted, | ||
header: moment(alertStarted).format(DEFAULT_DATE_FORMAT), | ||
details: i18n.translate( | ||
'xpack.apm.latency.chart.alertDetails.alertStarted', | ||
{ | ||
defaultMessage: 'Alert started', | ||
} | ||
), | ||
}, | ||
]} | ||
style={{ | ||
line: { | ||
strokeWidth: 3, | ||
stroke: '#f00', | ||
opacity: 1, | ||
}, | ||
}} | ||
marker={<EuiIcon type="alert" color="red" />} | ||
markerPosition={Position.Top} | ||
/> | ||
); | ||
} |
37 changes: 37 additions & 0 deletions
37
...ponents/alert_details_app_section/latency_chart_components/alert_threshold_annotation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { AnnotationDomainType, LineAnnotation } from '@elastic/charts'; | ||
|
||
export function AlertThresholdAnnotation({ | ||
threshold, | ||
}: { | ||
threshold?: number; | ||
}) { | ||
if (!threshold) return <></>; | ||
|
||
return ( | ||
<LineAnnotation | ||
id="annotation_alert_threshold" | ||
domainType={AnnotationDomainType.YDomain} | ||
dataValues={[ | ||
{ | ||
dataValue: threshold, | ||
header: String(threshold), | ||
}, | ||
]} | ||
style={{ | ||
line: { | ||
opacity: 0.5, | ||
strokeWidth: 1, | ||
stroke: 'red', | ||
}, | ||
}} | ||
/> | ||
); | ||
} |
39 changes: 39 additions & 0 deletions
39
...ui_components/alert_details_app_section/latency_chart_components/alert_threshold_rect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { RectAnnotation } from '@elastic/charts'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
|
||
export function AlertThresholdRect({ | ||
threshold, | ||
alertStarted, | ||
}: { | ||
threshold?: number; | ||
alertStarted: number; | ||
}) { | ||
if (!threshold) return <></>; | ||
|
||
return ( | ||
<RectAnnotation | ||
id="rect_alert_threshold" | ||
zIndex={2} | ||
dataValues={[ | ||
{ | ||
coordinates: { y0: threshold, x1: alertStarted }, | ||
details: i18n.translate( | ||
'xpack.apm.latency.chart.alertDetails.threshold', | ||
{ | ||
defaultMessage: 'Threshold', | ||
} | ||
), | ||
}, | ||
]} | ||
style={{ fill: 'red', opacity: 0.05 }} | ||
/> | ||
); | ||
} |
11 changes: 11 additions & 0 deletions
11
...onents/alerting/ui_components/alert_details_app_section/latency_chart_components/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { AlertAnnotation } from './alert_annotation'; | ||
export { AlertThresholdRect } from './alert_threshold_rect'; | ||
export { AlertActiveRect } from './alert_active_rect'; | ||
export { AlertThresholdAnnotation } from './alert_threshold_annotation'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.