Skip to content

Commit

Permalink
[APM] Handle other values popup when correlated value is not in top 10 (
Browse files Browse the repository at this point in the history
#118069) (#120680)

* [ML] Add stats for field value not in top 10

* [ML] Fix tests

* [ML] Add message

* [ML] Reverse label, remove Fragment, switch to i18n

* Fix sample shard size import, subdued text

* Fix sample shard size import, subdued text

* Move routes after refactor

* Add loading spinner

* Fix sampler shard size

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Quynh Nguyen <[email protected]>
  • Loading branch information
kibanamachine and qn895 authored Dec 7, 2021
1 parent cb85623 commit 04fee5b
Show file tree
Hide file tree
Showing 12 changed files with 414 additions and 264 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/apm/common/correlations/field_stats_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { CorrelationsParams } from './types';

export interface FieldStatsCommonRequestParams extends CorrelationsParams {
samplerShardSize: number;
}
export type FieldStatsCommonRequestParams = CorrelationsParams;

export interface Field {
fieldName: string;
Expand Down Expand Up @@ -55,3 +53,5 @@ export type FieldStats =
| NumericFieldStats
| KeywordFieldStats
| BooleanFieldStats;

export type FieldValueFieldStats = TopValuesStats;
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ import {
EuiFlexItem,
EuiPopover,
EuiPopoverTitle,
EuiSpacer,
EuiText,
EuiTitle,
EuiToolTip,
} from '@elastic/eui';
import React, { Fragment, useState } from 'react';
import React, { useState } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { FieldStats } from '../../../../../common/correlations/field_stats_types';
import { OnAddFilter, TopValues } from './top_values';
import { useTheme } from '../../../../hooks/use_theme';
Expand Down Expand Up @@ -97,27 +94,11 @@ export function CorrelationsContextPopover({
</h5>
</EuiTitle>
{infoIsOpen ? (
<>
<TopValues
topValueStats={topValueStats}
onAddFilter={onAddFilter}
fieldValue={fieldValue}
/>
{topValueStats.topValuesSampleSize !== undefined && (
<Fragment>
<EuiSpacer size="s" />
<EuiText size="xs">
<FormattedMessage
id="xpack.apm.correlations.fieldContextPopover.calculatedFromSampleDescription"
defaultMessage="Calculated from sample of {sampleSize} documents"
values={{
sampleSize: topValueStats.topValuesSampleSize,
}}
/>
</EuiText>
</Fragment>
)}
</>
<TopValues
topValueStats={topValueStats}
onAddFilter={onAddFilter}
fieldValue={fieldValue}
/>
) : null}
</EuiPopover>
);
Expand Down
Loading

0 comments on commit 04fee5b

Please sign in to comment.