-
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.
Browse files
Browse the repository at this point in the history
* [APM] Add version annotations to timeseries charts Closes #51426. * Don't subdue 'Version' text in tooltip * Optimize version queries * Don't pass radius/color to indicator Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
2c6ed6d
commit 2e97fff
Showing
20 changed files
with
639 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export enum AnnotationType { | ||
VERSION = 'version' | ||
} | ||
|
||
export interface Annotation { | ||
type: AnnotationType; | ||
id: string; | ||
time: number; | ||
text: string; | ||
} |
74 changes: 74 additions & 0 deletions
74
x-pack/legacy/plugins/apm/public/components/shared/charts/CustomPlot/AnnotationsPlot.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,74 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import React from 'react'; | ||
import { VerticalGridLines } from 'react-vis'; | ||
import theme from '@elastic/eui/dist/eui_theme_light.json'; | ||
import { | ||
EuiIcon, | ||
EuiToolTip, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiText | ||
} from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { Maybe } from '../../../../../typings/common'; | ||
import { Annotation } from '../../../../../common/annotations'; | ||
import { PlotValues, SharedPlot } from './plotUtils'; | ||
import { asAbsoluteDateTime } from '../../../../utils/formatters'; | ||
|
||
interface Props { | ||
annotations: Annotation[]; | ||
plotValues: PlotValues; | ||
width: number; | ||
overlay: Maybe<HTMLElement>; | ||
} | ||
|
||
const style = { | ||
stroke: theme.euiColorSecondary, | ||
strokeDasharray: 'none' | ||
}; | ||
|
||
export function AnnotationsPlot(props: Props) { | ||
const { plotValues, annotations } = props; | ||
|
||
const tickValues = annotations.map(annotation => annotation.time); | ||
|
||
return ( | ||
<> | ||
<SharedPlot plotValues={plotValues}> | ||
<VerticalGridLines tickValues={tickValues} style={style} /> | ||
</SharedPlot> | ||
{annotations.map(annotation => ( | ||
<div | ||
key={annotation.id} | ||
style={{ | ||
position: 'absolute', | ||
left: plotValues.x(annotation.time) - 8, | ||
top: -2 | ||
}} | ||
> | ||
<EuiToolTip | ||
title={asAbsoluteDateTime(annotation.time, 'seconds')} | ||
content={ | ||
<EuiFlexGroup> | ||
<EuiFlexItem grow={true}> | ||
<EuiText> | ||
{i18n.translate('xpack.apm.version', { | ||
defaultMessage: 'Version' | ||
})} | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}>{annotation.text}</EuiFlexItem> | ||
</EuiFlexGroup> | ||
} | ||
> | ||
<EuiIcon type="tag" color={theme.euiColorSecondary} /> | ||
</EuiToolTip> | ||
</div> | ||
))} | ||
</> | ||
); | ||
} |
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
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.