mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[APM] Fixes mixed units in service overview latencies (#88277)
* Closes #87726. Uses ms as the unit for latencies in service overview.
* removes optional chaining in those cases where it is not needed
* updates test snapshot with correct value
* Revert "updates test snapshot with correct value"
This reverts commit 9a1bdd7b44
.
* update param name from time -> value
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
53efccbc3b
commit
bc50f66657
5 changed files with 11 additions and 8 deletions
|
@ -46,5 +46,8 @@ describe('duration formatters', () => {
|
|||
it('converts to formatted decimal milliseconds', () => {
|
||||
expect(asMillisecondDuration(0)).toEqual('0 ms');
|
||||
});
|
||||
it('formats correctly with undefined values', () => {
|
||||
expect(asMillisecondDuration(undefined)).toEqual('N/A');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -186,9 +186,9 @@ export function asDuration(
|
|||
* `asDuration`, but this is used in places like tables where we always want
|
||||
* the same units.
|
||||
*/
|
||||
export function asMillisecondDuration(time: number) {
|
||||
export function asMillisecondDuration(value: Maybe<number>) {
|
||||
return convertTo({
|
||||
unit: 'milliseconds',
|
||||
microseconds: time,
|
||||
microseconds: value,
|
||||
}).formatted;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import React from 'react';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
|
||||
import {
|
||||
asDuration,
|
||||
asMillisecondDuration,
|
||||
asPercent,
|
||||
asTransactionRate,
|
||||
} from '../../../../../common/utils/formatters';
|
||||
|
@ -92,7 +92,7 @@ export function ServiceOverviewDependenciesTable({ serviceName }: Props) {
|
|||
<SparkPlot
|
||||
color="euiColorVis1"
|
||||
series={latency.timeseries}
|
||||
valueLabel={asDuration(latency.value)}
|
||||
valueLabel={asMillisecondDuration(latency.value)}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
|
|
@ -17,7 +17,7 @@ import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../../common/i18n';
|
|||
import { SERVICE_NODE_NAME_MISSING } from '../../../../../common/service_nodes';
|
||||
import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context';
|
||||
import {
|
||||
asDuration,
|
||||
asMillisecondDuration,
|
||||
asPercent,
|
||||
asTransactionRate,
|
||||
} from '../../../../../common/utils/formatters';
|
||||
|
@ -107,7 +107,7 @@ export function ServiceOverviewInstancesTable({ serviceName }: Props) {
|
|||
<SparkPlot
|
||||
color="euiColorVis1"
|
||||
series={latency?.timeseries}
|
||||
valueLabel={asDuration(latency?.value)}
|
||||
valueLabel={asMillisecondDuration(latency?.value)}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
|
|
@ -16,7 +16,7 @@ import React, { useState } from 'react';
|
|||
import { ValuesType } from 'utility-types';
|
||||
import { LatencyAggregationType } from '../../../../../common/latency_aggregation_types';
|
||||
import {
|
||||
asDuration,
|
||||
asMillisecondDuration,
|
||||
asPercent,
|
||||
asTransactionRate,
|
||||
} from '../../../../../common/utils/formatters';
|
||||
|
@ -201,7 +201,7 @@ export function ServiceOverviewTransactionsTable(props: Props) {
|
|||
color="euiColorVis1"
|
||||
compact
|
||||
series={latency.timeseries ?? undefined}
|
||||
valueLabel={asDuration(latency.value)}
|
||||
valueLabel={asMillisecondDuration(latency.value)}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue