Skip to content

Commit

Permalink
[APM] Correlations Beta (#86477) (#89952) (#91603)
Browse files Browse the repository at this point in the history
* [APM] Correlations GA (#86477)

* polish and improvements to correlations UI

* more improvements and polish

* added impact bar

* added descriptions

* make custom field persistence be unique per service

* make custom threshold unique per service in latency correlations

* adds telemetry for apm correlations feature. Events:
 - 'show_correlations_flyout'
 - 'customize_correlations_fields'
 - 'select_significant_term'

* adds more telemetry for correlations (#90622)

* removes the raw score column

* replaces experiemental callout with beta badge

* replaces threshold number input with percentile option selector

* improvements to latency correlations scoring and percentage reporting

* removes the 'apm:enableCorrelations' UI setting

* - rename useFieldNames.ts -> use_field_names.ts
- filter out fields that are not type 'keyword'
- feedback improvements

* Fixes casing issue for the 'correlations' dir

* [APM] Moves correlations button to service details tabslist row (#91080)

* [APM] Adds license check for correlations (#90766)

* [APM] Adds metrics tracking for correlations views and license prompts (#90622)

* Updated the API integration tests to check for new default fields and 15 buckets

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
ogupte and kibanamachine authored Feb 17, 2021
1 parent 7bf9d63 commit afaf615
Show file tree
Hide file tree
Showing 25 changed files with 795 additions and 351 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,4 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
'securitySolution:rulesTableRefresh': { type: 'text' },
'apm:enableSignificantTerms': { type: 'boolean' },
'apm:enableServiceOverview': { type: 'boolean' },
'apm:enableCorrelations': { type: 'boolean' },
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export interface UsageStats {
'securitySolution:rulesTableRefresh': string;
'apm:enableSignificantTerms': boolean;
'apm:enableServiceOverview': boolean;
'apm:enableCorrelations': boolean;
'visualize:enableLabs': boolean;
'visualization:heatmap:maxBuckets': number;
'visualization:colorMapping': string;
Expand Down
3 changes: 0 additions & 3 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4387,9 +4387,6 @@
},
"apm:enableServiceOverview": {
"type": "boolean"
},
"apm:enableCorrelations": {
"type": "boolean"
}
}
},
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/apm/common/ui_settings_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
* 2.0.
*/

export const enableCorrelations = 'apm:enableCorrelations';
export const enableServiceOverview = 'apm:enableServiceOverview';
108 changes: 0 additions & 108 deletions x-pack/plugins/apm/public/components/app/Correlations/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@
* 2.0.
*/

import React from 'react';
import { EuiIcon, EuiLink } from '@elastic/eui';
import React, { useCallback } from 'react';
import { debounce } from 'lodash';
import {
EuiIcon,
EuiLink,
EuiBasicTable,
EuiBasicTableColumn,
EuiToolTip,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useHistory } from 'react-router-dom';
import { EuiBasicTable } from '@elastic/eui';
import { EuiBasicTableColumn } from '@elastic/eui';
import { EuiCode } from '@elastic/eui';
import { asInteger, asPercent } from '../../../../common/utils/formatters';
import { APIReturnType } from '../../../services/rest/createCallApmApi';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { createHref, push } from '../../shared/Links/url_helpers';
import { ImpactBar } from '../../shared/ImpactBar';
import { useUiTracker } from '../../../../../observability/public';

type CorrelationsApiResponse =
| APIReturnType<'GET /api/apm/correlations/failed_transactions'>
Expand All @@ -27,49 +34,83 @@ type SignificantTerm = NonNullable<
interface Props<T> {
significantTerms?: T[];
status: FETCH_STATUS;
cardinalityColumnName: string;
percentageColumnName: string;
setSelectedSignificantTerm: (term: T | null) => void;
onFilter: () => void;
}

export function SignificantTermsTable<T extends SignificantTerm>({
export function CorrelationsTable<T extends SignificantTerm>({
significantTerms,
status,
cardinalityColumnName,
percentageColumnName,
setSelectedSignificantTerm,
onFilter,
}: Props<T>) {
const trackApmEvent = useUiTracker({ app: 'apm' });
const trackSelectSignificantTerm = useCallback(
() =>
debounce(
() => trackApmEvent({ metric: 'select_significant_term' }),
1000
),
[trackApmEvent]
);
const history = useHistory();
const columns: Array<EuiBasicTableColumn<T>> = [
{
width: '100px',
field: 'score',
name: 'Score',
field: 'impact',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.impactLabel',
{ defaultMessage: 'Impact' }
),
render: (_: any, term: T) => {
return <EuiCode>{Math.round(term.score)}</EuiCode>;
return <ImpactBar value={term.impact * 100} />;
},
},
{
field: 'cardinality',
name: cardinalityColumnName,
field: 'percentage',
name: percentageColumnName,
render: (_: any, term: T) => {
const matches = asPercent(term.fgCount, term.bgCount);
return `${asInteger(term.fgCount)} (${matches})`;
return (
<EuiToolTip
position="right"
content={`${asInteger(term.valueCount)} / ${asInteger(
term.fieldCount
)}`}
>
<>{asPercent(term.valueCount, term.fieldCount)}</>
</EuiToolTip>
);
},
},
{
field: 'fieldName',
name: 'Field name',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.fieldNameLabel',
{ defaultMessage: 'Field name' }
),
},
{
field: 'fieldValue',
name: 'Field value',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.fieldValueLabel',
{ defaultMessage: 'Field value' }
),
render: (_: any, term: T) => String(term.fieldValue).slice(0, 50),
},
{
width: '100px',
actions: [
{
name: 'Focus',
description: 'Focus on this term',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.filterLabel',
{ defaultMessage: 'Filter' }
),
description: i18n.translate(
'xpack.apm.correlations.correlationsTable.filterDescription',
{ defaultMessage: 'Filter by value' }
),
icon: 'magnifyWithPlus',
type: 'icon',
onClick: (term: T) => {
Expand All @@ -80,11 +121,19 @@ export function SignificantTermsTable<T extends SignificantTerm>({
)}"`,
},
});
onFilter();
trackApmEvent({ metric: 'correlations_term_include_filter' });
},
},
{
name: 'Exclude',
description: 'Exclude this term',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.excludeLabel',
{ defaultMessage: 'Exclude' }
),
description: i18n.translate(
'xpack.apm.correlations.correlationsTable.excludeDescription',
{ defaultMessage: 'Filter out value' }
),
icon: 'magnifyWithMinus',
type: 'icon',
onClick: (term: T) => {
Expand All @@ -95,10 +144,15 @@ export function SignificantTermsTable<T extends SignificantTerm>({
)}"`,
},
});
onFilter();
trackApmEvent({ metric: 'correlations_term_exclude_filter' });
},
},
],
name: 'Actions',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.actionsLabel',
{ defaultMessage: 'Actions' }
),
render: (_: any, term: T) => {
return (
<>
Expand Down Expand Up @@ -134,15 +188,30 @@ export function SignificantTermsTable<T extends SignificantTerm>({
return (
<EuiBasicTable
items={significantTerms ?? []}
noItemsMessage={status === FETCH_STATUS.LOADING ? 'Loading' : 'No data'}
noItemsMessage={
status === FETCH_STATUS.LOADING ? loadingText : noDataText
}
loading={status === FETCH_STATUS.LOADING}
columns={columns}
rowProps={(term) => {
return {
onMouseEnter: () => setSelectedSignificantTerm(term),
onMouseEnter: () => {
setSelectedSignificantTerm(term);
trackSelectSignificantTerm();
},
onMouseLeave: () => setSelectedSignificantTerm(null),
};
}}
/>
);
}

const loadingText = i18n.translate(
'xpack.apm.correlations.correlationsTable.loadingText',
{ defaultMessage: 'Loading' }
);

const noDataText = i18n.translate(
'xpack.apm.correlations.correlationsTable.noDataText',
{ defaultMessage: 'No data' }
);
Loading

0 comments on commit afaf615

Please sign in to comment.