forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Break down error table api removing the sparklines (elastic#89138)
* breaking error table api * shows loading state while fetching metrics * adding api tests * removing pagination from server * adding API test * refactoring * fixing license * renaming apis * fixing some stuff * addressing PR comments * adding request id * addressing PR comments Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Dario Gieselaar <[email protected]>
- Loading branch information
1 parent
857300b
commit 405255c
Showing
13 changed files
with
774 additions
and
389 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
94 changes: 94 additions & 0 deletions
94
...s/apm/public/components/app/service_overview/service_overview_errors_table/get_column.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,94 @@ | ||
/* | ||
* 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 { EuiBasicTableColumn } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { asInteger } from '../../../../../common/utils/formatters'; | ||
import { px, unit } from '../../../../style/variables'; | ||
import { SparkPlot } from '../../../shared/charts/spark_plot'; | ||
import { ErrorDetailLink } from '../../../shared/Links/apm/ErrorDetailLink'; | ||
import { TimestampTooltip } from '../../../shared/TimestampTooltip'; | ||
import { TruncateWithTooltip } from '../../../shared/truncate_with_tooltip'; | ||
import { APIReturnType } from '../../../../services/rest/createCallApmApi'; | ||
|
||
type ErrorGroupPrimaryStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/primary_statistics'>; | ||
type ErrorGroupComparisonStatistics = APIReturnType<'GET /api/apm/services/{serviceName}/error_groups/comparison_statistics'>; | ||
|
||
export function getColumns({ | ||
serviceName, | ||
errorGroupComparisonStatistics, | ||
}: { | ||
serviceName: string; | ||
errorGroupComparisonStatistics: ErrorGroupComparisonStatistics; | ||
}): Array<EuiBasicTableColumn<ErrorGroupPrimaryStatistics['error_groups'][0]>> { | ||
return [ | ||
{ | ||
field: 'name', | ||
name: i18n.translate('xpack.apm.serviceOverview.errorsTableColumnName', { | ||
defaultMessage: 'Name', | ||
}), | ||
render: (_, { name, group_id: errorGroupId }) => { | ||
return ( | ||
<TruncateWithTooltip | ||
text={name} | ||
content={ | ||
<ErrorDetailLink | ||
serviceName={serviceName} | ||
errorGroupId={errorGroupId} | ||
> | ||
{name} | ||
</ErrorDetailLink> | ||
} | ||
/> | ||
); | ||
}, | ||
}, | ||
{ | ||
field: 'last_seen', | ||
name: i18n.translate( | ||
'xpack.apm.serviceOverview.errorsTableColumnLastSeen', | ||
{ | ||
defaultMessage: 'Last seen', | ||
} | ||
), | ||
render: (_, { last_seen: lastSeen }) => { | ||
return <TimestampTooltip time={lastSeen} timeUnit="minutes" />; | ||
}, | ||
width: px(unit * 9), | ||
}, | ||
{ | ||
field: 'occurrences', | ||
name: i18n.translate( | ||
'xpack.apm.serviceOverview.errorsTableColumnOccurrences', | ||
{ | ||
defaultMessage: 'Occurrences', | ||
} | ||
), | ||
width: px(unit * 12), | ||
render: (_, { occurrences, group_id: errorGroupId }) => { | ||
const timeseries = | ||
errorGroupComparisonStatistics?.[errorGroupId]?.timeseries; | ||
return ( | ||
<SparkPlot | ||
color="euiColorVis7" | ||
series={timeseries} | ||
valueLabel={i18n.translate( | ||
'xpack.apm.serviceOveriew.errorsTableOccurrences', | ||
{ | ||
defaultMessage: `{occurrencesCount} occ.`, | ||
values: { | ||
occurrencesCount: asInteger(occurrences), | ||
}, | ||
} | ||
)} | ||
/> | ||
); | ||
}, | ||
}, | ||
]; | ||
} |
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.