Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Correlations Beta (#86477) #89952

Merged
merged 23 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d321f85
[APM] Correlations GA (#86477)
ogupte Feb 2, 2021
9110ffa
polish and improvements to correlations UI
ogupte Feb 4, 2021
63da7e6
more improvements and polish
ogupte Feb 5, 2021
d93f4ca
added impact bar
ogupte Feb 9, 2021
711bfe6
added descriptions
ogupte Feb 9, 2021
38d6a61
make custom field persistence be unique per service
ogupte Feb 9, 2021
c535b4a
make custom threshold unique per service in latency correlations
ogupte Feb 9, 2021
3fece27
adds telemetry for apm correlations feature. Events:
ogupte Feb 9, 2021
c52deb3
adds more telemetry for correlations (#90622)
ogupte Feb 9, 2021
906cb6d
removes the raw score column
ogupte Feb 11, 2021
185bfe6
replaces experiemental callout with beta badge
ogupte Feb 11, 2021
1c99c5c
replaces threshold number input with percentile option selector
ogupte Feb 11, 2021
6a0b5e0
improvements to latency correlations scoring and percentage reporting
ogupte Feb 12, 2021
f878301
Merge branch 'master' into apm-86477-correlations-ga
ogupte Feb 12, 2021
54ff95d
Merge branch 'master' into apm-86477-correlations-ga
ogupte Feb 16, 2021
30b188c
removes the 'apm:enableCorrelations' UI setting
ogupte Feb 16, 2021
429bc7b
- rename useFieldNames.ts -> use_field_names.ts
ogupte Feb 16, 2021
cab10a2
Fixes casing issue for the 'correlations' dir
ogupte Feb 16, 2021
0f09c0b
[APM] Moves correlations button to service details tabslist row (#91080)
ogupte Feb 16, 2021
b5f69ab
[APM] Adds license check for correlations (#90766)
ogupte Feb 16, 2021
cd3407e
[APM] Adds metrics tracking for correlations views and license prompt…
ogupte Feb 16, 2021
7eae6b9
Updated the API integration tests to check for new default fields and…
ogupte Feb 16, 2021
50cd63a
Merge branch 'master' into apm-86477-correlations-ga
kibanamachine Feb 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
*/

import React from 'react';
import { EuiIcon, EuiLink } from '@elastic/eui';
import {
EuiIcon,
EuiLink,
EuiBasicTable,
EuiBasicTableColumn,
EuiBadge,
} 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';
Expand All @@ -29,22 +33,27 @@ interface Props<T> {
status: FETCH_STATUS;
cardinalityColumnName: string;
setSelectedSignificantTerm: (term: T | null) => void;
onFilter: () => void;
}

export function SignificantTermsTable<T extends SignificantTerm>({
export function CorrelationsTable<T extends SignificantTerm>({
significantTerms,
status,
cardinalityColumnName,
setSelectedSignificantTerm,
onFilter,
}: Props<T>) {
const history = useHistory();
const columns: Array<EuiBasicTableColumn<T>> = [
{
width: '100px',
field: 'score',
name: 'Score',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.scoreLabel',
{ defaultMessage: 'Score' }
),
render: (_: any, term: T) => {
return <EuiCode>{Math.round(term.score)}</EuiCode>;
return <EuiBadge>{Math.round(term.score)}</EuiBadge>;
sorenlouv marked this conversation as resolved.
Show resolved Hide resolved
},
},
{
Expand All @@ -57,19 +66,31 @@ export function SignificantTermsTable<T extends SignificantTerm>({
},
{
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 +101,18 @@ export function SignificantTermsTable<T extends SignificantTerm>({
)}"`,
},
});
onFilter();
},
},
{
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 +123,14 @@ export function SignificantTermsTable<T extends SignificantTerm>({
)}"`,
},
});
onFilter();
},
},
],
name: 'Actions',
name: i18n.translate(
'xpack.apm.correlations.correlationsTable.actionsLabel',
{ defaultMessage: 'Actions' }
),
render: (_: any, term: T) => {
return (
<>
Expand Down Expand Up @@ -134,7 +166,9 @@ 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) => {
Expand All @@ -146,3 +180,13 @@ export function SignificantTermsTable<T extends SignificantTerm>({
/>
);
}

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

const noDataText = i18n.translate(
'xpack.apm.correlations.correlationsTable.noDataText',
{ defaultMessage: 'No data' }
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
* 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 {
EuiFlexGroup,
EuiFlexItem,
EuiAccordion,
EuiComboBox,
EuiFormRow,
EuiLink,
EuiFieldNumber,
EuiSpacer,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { useEffect, useState } from 'react';
import { useFieldNames } from './useFieldNames';
import { ElasticDocsLink } from '../../shared/Links/ElasticDocsLink';

interface Props {
fieldNames: string[];
setFieldNames: (fieldNames: string[]) => void;
setDurationPercentile?: (value: number) => void;
showThreshold?: boolean;
durationPercentile?: number;
}

export function CustomFields({
fieldNames,
setFieldNames,
setDurationPercentile = () => {},
showThreshold = false,
durationPercentile = 50,
}: Props) {
const { defaultFieldNames, getSuggestions } = useFieldNames();
const [suggestedFieldNames, setSuggestedFieldNames] = useState(
getSuggestions('')
sorenlouv marked this conversation as resolved.
Show resolved Hide resolved
);

useEffect(() => {
if (suggestedFieldNames.length) {
return;
}
setSuggestedFieldNames(getSuggestions(''));
}, [getSuggestions, suggestedFieldNames]);

return (
<EuiAccordion
id="accordion"
buttonContent={i18n.translate(
'xpack.apm.correlations.customize.buttonLabel',
{ defaultMessage: 'Customize fields' }
)}
>
<EuiSpacer />
<EuiFlexGroup direction="column">
{showThreshold && (
<EuiFlexItem grow={false}>
<EuiFormRow
label={i18n.translate(
'xpack.apm.correlations.customize.thresholdLabel',
{ defaultMessage: 'Threshold' }
)}
helpText="Default threshold is 50th percentile."
>
<EuiFieldNumber
value={durationPercentile.toString(10)}
onChange={(e) => {
const value = parseInt(e.currentTarget.value, 10);
if (isValidPercentile(value)) {
setDurationPercentile(value);
}
}}
prepend="Percentile"
/>
</EuiFormRow>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiFormRow
fullWidth={true}
label={i18n.translate(
'xpack.apm.correlations.customize.fieldLabel',
{ defaultMessage: 'Field' }
)}
helpText={
<FormattedMessage
id="xpack.apm.correlations.customize.fieldHelpText"
defaultMessage="Customize or {reset} fields to analyze for correlations. {docsLink}"
values={{
reset: (
<EuiLink
type="reset"
onClick={() => {
setFieldNames(defaultFieldNames);
}}
>
{i18n.translate(
'xpack.apm.correlations.customize.fieldHelpTextReset',
{ defaultMessage: 'reset' }
)}
</EuiLink>
),
docsLink: (
<ElasticDocsLink
section="/kibana"
path="/advanced-queries.html"
>
{i18n.translate(
'xpack.apm.correlations.customize.fieldHelpTextDocsLink',
{
defaultMessage:
'Learn more about the default fields.',
}
)}
</ElasticDocsLink>
),
}}
/>
}
>
<EuiComboBox
fullWidth={true}
placeholder={i18n.translate(
'xpack.apm.correlations.customize.fieldPlaceholder',
{ defaultMessage: 'Select or create options' }
)}
selectedOptions={fieldNames.map((label) => ({ label }))}
onChange={(options) => {
const nextFieldNames = options.map((option) => option.label);
setFieldNames(nextFieldNames);
}}
onCreateOption={(term) => {
const nextFieldNames = [...fieldNames, term];
setFieldNames(nextFieldNames);
}}
onSearchChange={(searchValue) => {
setSuggestedFieldNames(getSuggestions(searchValue));
}}
options={suggestedFieldNames.map((label) => ({ label }))}
/>
</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
</EuiAccordion>
);
}

function isValidPercentile(value: number) {
return !isNaN(value) && value >= 0 && value <= 100;
}
Loading