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

[ML] APM Latency Correlations: Code consolidation. #110790

Merged
merged 46 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ca86f76
[ML] Fix tooltip text.
walterra Aug 24, 2021
b17a0b9
Revert "[ML] Fix tooltip text."
walterra Aug 25, 2021
c6afb7b
Merge branch 'master' of https://github.com/elastic/kibana
walterra Aug 26, 2021
cc04280
Merge branch 'master' of https://github.com/elastic/kibana
walterra Aug 30, 2021
7f39a6b
[ML] Code consolidation.
walterra Aug 30, 2021
547ae65
[ML] Fix naming inconsistencies.
walterra Aug 30, 2021
64cc796
[ML] Fix naming inconsistencies.
walterra Aug 30, 2021
ade9431
[ML] Fix naming inconsistencies.
walterra Aug 30, 2021
be265ee
[ML] Consolidate hooks.
walterra Aug 31, 2021
013369b
[ML] Consolidate hooks.
walterra Aug 31, 2021
cb6c9de
[ML] Consolidate hooks.
walterra Sep 1, 2021
5244347
[ML] Use function overloads.
walterra Sep 1, 2021
9104784
[ML] Fix naming inconsistencies.
walterra Sep 1, 2021
9a4b99d
[ML] Fix jest test.
walterra Sep 1, 2021
afbcd8b
[ML] Fix chart loading behavior.
walterra Sep 1, 2021
f131283
[ML] Rename values to latencyCorrelations.
walterra Sep 1, 2021
c9b3040
[ML] Clean up types.
walterra Sep 1, 2021
ecd1d75
[ML] Add function overloads.
walterra Sep 1, 2021
89dfda2
Merge branch 'master' into ml-apm-correlations-consolidation-1
walterra Sep 1, 2021
130f498
[Ml] Update API integration tests.
walterra Sep 1, 2021
9ddde60
Merge branch 'master' into ml-apm-correlations-consolidation-1
walterra Sep 1, 2021
1236eb6
[ML] Rename values to failedTransactionsCorrelations.
walterra Sep 2, 2021
bfa89a1
[ML] Fix naming inconsistencies.
walterra Sep 2, 2021
8724c98
[ML] Fix naming inconsistencies.
walterra Sep 2, 2021
aa4f909
[ML] Fix naming inconsistencies.
walterra Sep 2, 2021
ac873d3
[ML] Fix jest test.
walterra Sep 2, 2021
d95cea7
Merge branch 'master' into ml-apm-correlations-consolidation-1
walterra Sep 2, 2021
55314be
[ML] Fix API integration test
walterra Sep 2, 2021
98147fb
Merge branch 'master' into ml-apm-correlations-consolidation-1
walterra Sep 3, 2021
8f41990
[ML] Clean up chart data.
walterra Sep 3, 2021
70cd7b0
Merge branch 'master' into ml-apm-correlations-consolidation-1
walterra Sep 3, 2021
83c2b74
[ML] Fix chart props.
walterra Sep 3, 2021
5f69244
[ML] Tweak types for failed correlations.
walterra Sep 6, 2021
14bdcc1
Merge branch 'master' into ml-apm-correlations-consolidation-1
walterra Sep 6, 2021
e96aed9
[ML] Improve FieldValuePair type usage.
walterra Sep 6, 2021
1656d8d
[ML] Remove 'async' from variable names.
walterra Sep 6, 2021
a0f9d4f
[ML] Fix typo.
walterra Sep 6, 2021
1709e11
[ML] Simplify mock.
walterra Sep 6, 2021
c52158b
[ML] Refactor code that used type guards.
walterra Sep 6, 2021
11e3f28
[ML] Comment about feature availability.
walterra Sep 7, 2021
1736424
Merge branch 'master' into ml-apm-correlations-consolidation-1
walterra Sep 7, 2021
3e7d611
[ML] Simplify check.
walterra Sep 7, 2021
6af23f3
[ML] Simplify selectedHistogram.
walterra Sep 7, 2021
787d9d7
[ML] Improve column type safety.
walterra Sep 7, 2021
b665413
[ML] Simplify selectedTerm.
walterra Sep 7, 2021
6076fbf
[ML] Simplify sorting.
walterra Sep 7, 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
14 changes: 14 additions & 0 deletions x-pack/plugins/apm/common/search_strategies/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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.
*/

export const APM_SEARCH_STRATEGIES = {
APM_FAILED_TRANSACTIONS_CORRELATIONS: 'apmFailedTransactionsCorrelations',
APM_LATENCY_CORRELATIONS: 'apmLatencyCorrelations',
} as const;
export type ApmSearchStrategies = typeof APM_SEARCH_STRATEGIES[keyof typeof APM_SEARCH_STRATEGIES];

export const DEFAULT_PERCENTILE_THRESHOLD = 95;
63 changes: 0 additions & 63 deletions x-pack/plugins/apm/common/search_strategies/correlations/types.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

import { i18n } from '@kbn/i18n';

export const FAILED_TRANSACTIONS_CORRELATION_SEARCH_STRATEGY =
'apmFailedTransactionsCorrelationsSearchStrategy';

export const FAILED_TRANSACTIONS_IMPACT_THRESHOLD = {
HIGH: i18n.translate(
'xpack.apm.correlations.failedTransactions.highImpactText',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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 {
FieldValuePair,
RawResponseBase,
SearchStrategyClientParams,
} from '../types';

import { FAILED_TRANSACTIONS_IMPACT_THRESHOLD } from './constants';

export interface FailedTransactionsCorrelation extends FieldValuePair {
doc_count: number;
bg_count: number;
score: number;
pValue: number | null;
normalizedScore: number;
failurePercentage: number;
successPercentage: number;
}

export type FailedTransactionsCorrelationsImpactThreshold = typeof FAILED_TRANSACTIONS_IMPACT_THRESHOLD[keyof typeof FAILED_TRANSACTIONS_IMPACT_THRESHOLD];

export type FailedTransactionsCorrelationsParams = SearchStrategyClientParams;

export interface FailedTransactionsCorrelationsRawResponse
extends RawResponseBase {
log: string[];
failedTransactionsCorrelations: FailedTransactionsCorrelation[];
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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 {
FieldValuePair,
HistogramItem,
RawResponseBase,
SearchStrategyClientParams,
} from '../types';

export interface LatencyCorrelation extends FieldValuePair {
correlation: number;
histogram: HistogramItem[];
ksTest: number;
}

export interface LatencyCorrelationSearchServiceProgress {
started: number;
loadedHistogramStepsize: number;
loadedOverallHistogram: number;
loadedFieldCandidates: number;
loadedFieldValuePairs: number;
loadedHistograms: number;
}

export interface LatencyCorrelationsParams extends SearchStrategyClientParams {
percentileThreshold: number;
analyzeCorrelations: boolean;
}

export interface LatencyCorrelationsRawResponse extends RawResponseBase {
log: string[];
overallHistogram?: HistogramItem[];
percentileThresholdValue?: number;
latencyCorrelations?: LatencyCorrelation[];
}
50 changes: 50 additions & 0 deletions x-pack/plugins/apm/common/search_strategies/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.
*/

export interface FieldValuePair {
fieldName: string;
// For dynamic fieldValues we only identify fields as `string`,
// but for example `http.response.status_code` which is part of
// of the list of predefined field candidates is of type long/number.
fieldValue: string | number;
}

export interface HistogramItem {
key: number;
doc_count: number;
}

export interface ResponseHitSource {
[s: string]: unknown;
}

export interface ResponseHit {
_source: ResponseHitSource;
}

export interface RawResponseBase {
ccsWarning: boolean;
took: number;
}

export interface SearchStrategyClientParams {
environment: string;
kuery: string;
serviceName?: string;
transactionName?: string;
transactionType?: string;
start?: string;
end?: string;
}

export interface SearchStrategyServerParams {
index: string;
includeFrozen?: boolean;
}

export type SearchStrategyParams = SearchStrategyClientParams &
SearchStrategyServerParams;
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,31 @@ import type { Criteria } from '@elastic/eui/src/components/basic_table/basic_tab
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { useUiTracker } from '../../../../../observability/public';
import { useTheme } from '../../../hooks/use_theme';
import type { CorrelationsTerm } from '../../../../common/search_strategies/failure_correlations/types';
import type { FieldValuePair } from '../../../../common/search_strategies/types';

const PAGINATION_SIZE_OPTIONS = [5, 10, 20, 50];

export type SelectedCorrelationTerm<T extends CorrelationsTerm> = Pick<
T,
'fieldName' | 'fieldValue'
>;

interface Props<T> {
interface CorrelationsTableProps<T extends FieldValuePair> {
significantTerms?: T[];
status: FETCH_STATUS;
percentageColumnName?: string;
setSelectedSignificantTerm: (term: T | null) => void;
selectedTerm?: { fieldName: string; fieldValue: string };
selectedTerm?: FieldValuePair;
onFilter?: () => void;
columns: Array<EuiBasicTableColumn<T>>;
onTableChange: (c: Criteria<T>) => void;
sorting?: EuiTableSortingType<T>;
}

export function CorrelationsTable<T extends CorrelationsTerm>({
export function CorrelationsTable<T extends FieldValuePair>({
significantTerms,
status,
setSelectedSignificantTerm,
columns,
selectedTerm,
onTableChange,
sorting,
}: Props<T>) {
}: CorrelationsTableProps<T>) {
const euiTheme = useTheme();
const trackApmEvent = useUiTracker({ app: 'apm' });
const trackSelectSignificantCorrelationTerm = useCallback(
Expand Down
Loading