-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Changes from 32 commits
ca86f76
b17a0b9
c6afb7b
cc04280
7f39a6b
547ae65
64cc796
ade9431
be265ee
013369b
cb6c9de
5244347
9104784
9a4b99d
afbcd8b
f131283
c9b3040
ecd1d75
89dfda2
130f498
9ddde60
1236eb6
bfa89a1
8724c98
aa4f909
ac873d3
d95cea7
55314be
98147fb
8f41990
70cd7b0
83c2b74
5f69244
14bdcc1
e96aed9
1656d8d
a0f9d4f
1709e11
c52158b
11e3f28
1736424
3e7d611
6af23f3
787d9d7
b665413
6076fbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; |
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 { RawResponseBase, SearchStrategyClientParams } from '../types'; | ||
|
||
import { FAILED_TRANSACTIONS_IMPACT_THRESHOLD } from './constants'; | ||
|
||
export interface FailedTransactionsCorrelation { | ||
key: string; | ||
doc_count: number; | ||
bg_count: number; | ||
score: number; | ||
pValue: number | null; | ||
fieldName: string; | ||
fieldValue: string; | ||
normalizedScore: number; | ||
failurePercentage: number; | ||
successPercentage: number; | ||
} | ||
|
||
// Basic type guard for array of FailedTransactionsCorrelation | ||
export const isFailedTransactionsCorrelations = ( | ||
arg: unknown | ||
): arg is FailedTransactionsCorrelation[] => { | ||
return Array.isArray(arg) && arg.length > 0; | ||
}; | ||
|
||
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,48 @@ | ||
/* | ||
* 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 { | ||
HistogramItem, | ||
RawResponseBase, | ||
SearchStrategyClientParams, | ||
} from '../types'; | ||
|
||
export interface LatencyCorrelation { | ||
correlation: number; | ||
fieldName: string; | ||
fieldValue: string; | ||
histogram: HistogramItem[]; | ||
ksTest: number; | ||
} | ||
|
||
// Basic type guard for array of LatencyCorrelation | ||
export function isLatencyCorrelations( | ||
arg: unknown | ||
sorenlouv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
): arg is LatencyCorrelation[] { | ||
return Array.isArray(arg) && arg.length > 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be better to have a check that at least the first item has There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI Decided the type guard was overkill and changed it back to inline checks in c52158b. |
||
} | ||
|
||
export interface AsyncSearchProviderProgress { | ||
started: number; | ||
loadedHistogramStepsize: number; | ||
loadedOverallHistogram: number; | ||
loadedFieldCanditates: number; | ||
sorenlouv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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[]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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; | ||
fieldValue: string; | ||
} | ||
|
||
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should also check if arg[0] matches the signature of
FailedTransactionsCorrelation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI Decided the type guard was overkill and changed it back to inline checks in c52158b.