-
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] Fix custom index name settings, functional tests for APM Latency Correlation. #105200
Changes from 5 commits
48ceb8f
0bc79de
9a39121
a39dcf8
dada021
2b2872c
c439dbd
ecfd6e4
60bbed5
b4dc37e
7592578
42a7cbd
7d04ca3
1a63809
06b5b8f
5922e84
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 |
---|---|---|
|
@@ -6,8 +6,11 @@ | |
*/ | ||
|
||
import React, { useEffect, useMemo, useState } from 'react'; | ||
import { useHistory, useParams } from 'react-router-dom'; | ||
import { useHistory, useLocation, useParams } from 'react-router-dom'; | ||
import { | ||
EuiCode, | ||
EuiAccordion, | ||
EuiPanel, | ||
EuiIcon, | ||
EuiBasicTableColumn, | ||
EuiButton, | ||
|
@@ -72,7 +75,11 @@ export function MlLatencyCorrelations({ onClose }: Props) { | |
}, | ||
} = useUrlParams(); | ||
|
||
const location = useLocation(); | ||
const displayLog = location.search.includes('debug=true'); | ||
|
||
const { | ||
log, | ||
error, | ||
histograms, | ||
percentileThresholdValue, | ||
|
@@ -82,7 +89,6 @@ export function MlLatencyCorrelations({ onClose }: Props) { | |
cancelFetch, | ||
overallHistogram: originalOverallHistogram, | ||
} = useCorrelations({ | ||
index: 'apm-*', | ||
...{ | ||
...{ | ||
environment, | ||
|
@@ -292,9 +298,10 @@ export function MlLatencyCorrelations({ onClose }: Props) { | |
</EuiFlexItem> | ||
<EuiFlexItem> | ||
<EuiFlexGroup direction="column" gutterSize="none"> | ||
<EuiFlexItem> | ||
<EuiFlexItem data-test-subj="apmCorrelationsLatencyCorrelationsProgressTitle"> | ||
<EuiText size="xs" color="subdued"> | ||
<FormattedMessage | ||
data-test-subj="apmCorrelationsLatencyCorrelationsProgressTitle" | ||
id="xpack.apm.correlations.latencyCorrelations.progressTitle" | ||
defaultMessage="Progress: {progress}%" | ||
values={{ progress: Math.round(progress * 100) }} | ||
|
@@ -323,7 +330,7 @@ export function MlLatencyCorrelations({ onClose }: Props) { | |
{overallHistogram !== undefined ? ( | ||
<> | ||
<EuiTitle size="xxs"> | ||
<h4> | ||
<h4 data-test-subj="apmCorrelationsLatencyCorrelationsChartTitle"> | ||
{i18n.translate( | ||
'xpack.apm.correlations.latencyCorrelations.chartTitle', | ||
{ | ||
|
@@ -347,32 +354,50 @@ export function MlLatencyCorrelations({ onClose }: Props) { | |
</> | ||
) : null} | ||
|
||
{histograms.length > 0 && selectedHistogram !== undefined && ( | ||
<CorrelationsTable | ||
// @ts-ignore correlations don't have the same column format other tables have | ||
columns={mlCorrelationColumns} | ||
// @ts-expect-error correlations don't have the same significant term other tables have | ||
significantTerms={histogramTerms} | ||
status={FETCH_STATUS.SUCCESS} | ||
setSelectedSignificantTerm={setSelectedSignificantTerm} | ||
selectedTerm={{ | ||
fieldName: selectedHistogram.field, | ||
fieldValue: selectedHistogram.value, | ||
}} | ||
onFilter={onClose} | ||
/> | ||
<div data-test-subj="apmCorrelationsTable"> | ||
{histograms.length > 0 && selectedHistogram !== undefined && ( | ||
<CorrelationsTable | ||
// @ts-ignore correlations don't have the same column format other tables have | ||
columns={mlCorrelationColumns} | ||
// @ts-expect-error correlations don't have the same significant term other tables have | ||
significantTerms={histogramTerms} | ||
status={FETCH_STATUS.SUCCESS} | ||
setSelectedSignificantTerm={setSelectedSignificantTerm} | ||
selectedTerm={{ | ||
fieldName: selectedHistogram.field, | ||
fieldValue: selectedHistogram.value, | ||
}} | ||
onFilter={onClose} | ||
/> | ||
)} | ||
{histograms.length < 1 && progress > 0.99 ? ( | ||
<> | ||
<EuiSpacer size="m" /> | ||
<EuiText textAlign="center"> | ||
<FormattedMessage | ||
id="xpack.apm.correlations.latencyCorrelations.noCorrelationsText" | ||
defaultMessage="No significant correlations found" | ||
/> | ||
</EuiText> | ||
</> | ||
) : null} | ||
</div> | ||
{log.length > 0 && displayLog && ( | ||
<EuiAccordion id="accordion1" buttonContent="Log"> | ||
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. Does 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. Fixed translation in 7592578. |
||
<EuiPanel color="subdued"> | ||
{log.map((d, i) => { | ||
const splitItem = d.split(': '); | ||
return ( | ||
<p key={i}> | ||
<small> | ||
<EuiCode>{splitItem[0]}</EuiCode> {splitItem[1]} | ||
</small> | ||
</p> | ||
); | ||
})} | ||
</EuiPanel> | ||
</EuiAccordion> | ||
)} | ||
{histograms.length < 1 && progress > 0.99 ? ( | ||
<> | ||
<EuiSpacer size="m" /> | ||
<EuiText textAlign="center"> | ||
<FormattedMessage | ||
id="xpack.apm.correlations.latencyCorrelations.noCorrelationsText" | ||
defaultMessage="No significant correlations found" | ||
/> | ||
</EuiText> | ||
</> | ||
) : null} | ||
</> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
import { shuffle, range } from 'lodash'; | ||
import type { ElasticsearchClient } from 'src/core/server'; | ||
import type { ApmIndicesConfig } from '../../settings/apm_indices/get_apm_indices'; | ||
import { fetchTransactionDurationFieldCandidates } from './query_field_candidates'; | ||
import { fetchTransactionDurationFieldValuePairs } from './query_field_value_pairs'; | ||
import { fetchTransactionDurationPercentiles } from './query_percentiles'; | ||
|
@@ -16,6 +17,7 @@ import { fetchTransactionDurationRanges, HistogramItem } from './query_ranges'; | |
import type { | ||
AsyncSearchProviderProgress, | ||
SearchServiceParams, | ||
SearchServiceFetchParams, | ||
SearchServiceValue, | ||
} from '../../../../common/search_strategies/correlations/types'; | ||
import { computeExpectationsAndRanges } from './utils/aggregation_utils'; | ||
|
@@ -28,7 +30,9 @@ const currentTimeAsString = () => new Date().toISOString(); | |
|
||
export const asyncSearchServiceProvider = ( | ||
esClient: ElasticsearchClient, | ||
params: SearchServiceParams | ||
getApmIndices: () => Promise<ApmIndicesConfig>, | ||
searchServiceParams: SearchServiceParams, | ||
includeFrozen: boolean | ||
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. Is 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. Just re-read the post description and my question is redundant here :) Sorry the noise |
||
) => { | ||
let isCancelled = false; | ||
let isRunning = true; | ||
|
@@ -64,6 +68,12 @@ export const asyncSearchServiceProvider = ( | |
|
||
const fetchCorrelations = async () => { | ||
try { | ||
const indices = await getApmIndices(); | ||
const params: SearchServiceFetchParams = { | ||
...searchServiceParams, | ||
index: indices['apm_oss.transactionIndices'], | ||
}; | ||
|
||
// 95th percentile to be displayed as a marker in the log log chart | ||
const { | ||
totalDocs, | ||
|
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.
Instead of adding this, we should use the existing
observability:enableInspectEsQueries
UI setting.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.
Great suggestion, fixed in 1a63809.