Skip to content

Commit

Permalink
Merge branch 'main' into 166545_default_navgation_panels_intergation
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 19, 2023
2 parents b0c7ada + 8b54eed commit a7ab6dc
Show file tree
Hide file tree
Showing 59 changed files with 1,266 additions and 1,222 deletions.
2 changes: 2 additions & 0 deletions docs/apm/infrastructure.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
[[infrastructure]]
=== Infrastructure

beta::[]

The *Infrastructure* tab provides information about the containers, pods, and hosts,
that the selected service is linked to.

Expand Down
5 changes: 3 additions & 2 deletions docs/apm/spans.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ For example, quickly view:
[[distributed-tracing]]
==== Distributed tracing

If your trace sample timeline is colorful, it's indicative of a distributed trace.
Services in a distributed trace are separated by color and listed in the order they occur.
When a trace travels through multiple services it is known as a _distributed trace_.
In APM, the colors in a distributed trace represent different services and
are listed in the order they occur.

[role="screenshot"]
image::apm/images/apm-services-trace.png[Example of distributed trace colors in the APM app in Kibana]
Expand Down
4 changes: 4 additions & 0 deletions docs/apm/traces.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ it's the collective amount of pain a specific endpoint is causing your users.
If there's a particular endpoint you're worried about, select it to view its
<<transaction-details,transaction details>>.

You can also use queries to filter and search the transactions shown on this page.
Note that only properties available on root transactions are searchable.
For example, you can't search for `label.tier: 'high'`, as that field is only available on non-root transactions.

[role="screenshot"]
image::apm/images/apm-traces.png[Example view of the Traces overview in APM app in Kibana]

Expand Down
4 changes: 3 additions & 1 deletion src/plugins/data/common/search/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export const isAbortResponse = (response?: IKibanaSearchResponse) => {
/**
* @returns true if request is still running
*/
export const isRunningResponse = (response?: IKibanaSearchResponse) => response?.isRunning ?? false;
export const isRunningResponse = (response?: IKibanaSearchResponse) => {
return response?.isRunning ?? false;
};

export const getUserTimeZone = (
getConfig: AggTypesDependencies['getConfig'],
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/data/server/search/routes/bsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { catchError } from 'rxjs/operators';
import { BfetchServerSetup } from '@kbn/bfetch-plugin/server';
import type { ExecutionContextSetup } from '@kbn/core/server';
import apm from 'elastic-apm-node';
import { getRequestAbortedSignal } from '../..';
import {
IKibanaSearchRequest,
IKibanaSearchResponse,
Expand All @@ -28,6 +29,7 @@ export function registerBsearchRoute(
IKibanaSearchResponse
>('/internal/bsearch', (request) => {
const search = getScoped(request);
const abortSignal = getRequestAbortedSignal(request.events.aborted$);
return {
/**
* @param requestOptions
Expand All @@ -39,7 +41,7 @@ export function registerBsearchRoute(
apm.addLabels(executionContextService.getAsLabels());

return firstValueFrom(
search.search(requestData, restOptions).pipe(
search.search(requestData, { ...restOptions, abortSignal }).pipe(
catchError((err) => {
// Re-throw as object, to get attributes passed to the client
// eslint-disable-next-line no-throw-literal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,38 @@ describe('ES search strategy', () => {

expect(mockApiCaller).toBeCalledTimes(0);
});

it('should delete when aborted', async () => {
mockSubmitCaller.mockResolvedValueOnce({
...mockAsyncResponse,
body: {
...mockAsyncResponse.body,
is_running: true,
},
});

const params = { index: 'logstash-*', body: { query: {} } };
const esSearch = await enhancedEsSearchStrategyProvider(
mockLegacyConfig$,
mockSearchConfig,
mockLogger
);
const abortController = new AbortController();
const abortSignal = abortController.signal;

// Abort after an incomplete first response is returned
setTimeout(() => abortController.abort(), 100);

let err: KbnServerError | undefined;
try {
await esSearch.search({ params }, { abortSignal }, mockDeps).toPromise();
} catch (e) {
err = e;
}
expect(mockSubmitCaller).toBeCalled();
expect(err).not.toBeUndefined();
expect(mockDeleteCaller).toBeCalled();
});
});

describe('with sessionId', () => {
Expand Down Expand Up @@ -366,6 +398,44 @@ describe('ES search strategy', () => {
expect(request).toHaveProperty('wait_for_completion_timeout');
expect(request).not.toHaveProperty('keep_alive');
});

it('should not delete a saved session when aborted', async () => {
mockSubmitCaller.mockResolvedValueOnce({
...mockAsyncResponse,
body: {
...mockAsyncResponse.body,
is_running: true,
},
});

const params = { index: 'logstash-*', body: { query: {} } };
const esSearch = await enhancedEsSearchStrategyProvider(
mockLegacyConfig$,
mockSearchConfig,
mockLogger
);
const abortController = new AbortController();
const abortSignal = abortController.signal;

// Abort after an incomplete first response is returned
setTimeout(() => abortController.abort(), 100);

let err: KbnServerError | undefined;
try {
await esSearch
.search(
{ params },
{ abortSignal, sessionId: '1', isSearchStored: true, isStored: true },
mockDeps
)
.toPromise();
} catch (e) {
err = e;
}
expect(mockSubmitCaller).toBeCalled();
expect(err).not.toBeUndefined();
expect(mockDeleteCaller).not.toBeCalled();
});
});

it('throws normalized error if ResponseError is thrown', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const enhancedEsSearchStrategyProvider = (
};

const cancel = async () => {
if (id) {
if (id && !options.isStored) {
await cancelAsyncSearch(id, esClient);
}
};
Expand Down
1 change: 1 addition & 0 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ export class VisualBuilderPageObject extends FtrService {
const fieldEl = await this.getFieldForAggregation(aggNth);

await this.comboBox.setElement(fieldEl, field);
await this.header.waitUntilLoadingHasFinished();
}

public async setFieldForAggregateBy(field: string): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
const navigateTo = async (path: string) =>
await browser.navigateTo(`${deployment.getHostPort()}${path}`);

describe('ui applications', function describeIndexTests() {
// FLAKY: https://github.com/elastic/kibana/issues/53356
describe.skip('ui applications', function describeIndexTests() {
before(async () => {
await esArchiver.emptyKibanaIndex();
await PageObjects.common.navigateToApp('foo');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,6 @@ const VulnerabilitiesDataGrid = ({
isFetching,
]);

const onPaginateFlyout = useCallback(
(nextVulnerabilityIndex: number) => {
// the index of the vulnerability in the current page
const newVulnerabilityIndex = nextVulnerabilityIndex % pageSize;

// if the vulnerability is not in the current page, we need to change the page
const flyoutPageIndex = Math.floor(nextVulnerabilityIndex / pageSize);

setUrlQuery({
pageIndex: flyoutPageIndex,
vulnerabilityIndex: newVulnerabilityIndex,
});
},
[pageSize, setUrlQuery]
);

const showVulnerabilityFlyout = flyoutVulnerabilityIndex > invalidIndex;

if (data?.page.length === 0) {
Expand Down Expand Up @@ -372,7 +356,6 @@ const VulnerabilitiesDataGrid = ({
flyoutIndex={selectedVulnerabilityIndex}
vulnerabilityRecord={selectedVulnerability}
totalVulnerabilitiesCount={limitedTotalItemCount}
onPaginate={onPaginateFlyout}
closeFlyout={onCloseFlyout}
isLoading={isFetching}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const VulnerabilityFindingFlyout = ({
isLoading,
}: {
closeFlyout: () => void;
onPaginate: (pageIndex: number) => void;
onPaginate?: (pageIndex: number) => void;
totalVulnerabilitiesCount: number;
flyoutIndex?: number;
vulnerabilityRecord: CspVulnerabilityFinding;
Expand Down Expand Up @@ -236,15 +236,21 @@ export const VulnerabilityFindingFlyout = ({
</EuiSkeletonText>
</EuiFlyoutBody>
<EuiFlyoutFooter>
<EuiFlexGroup gutterSize="none" alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiPagination
pageCount={totalVulnerabilitiesCount}
activePage={flyoutIndex}
onPageClick={onPaginate}
compressed
/>
</EuiFlexItem>
<EuiFlexGroup
gutterSize="none"
alignItems="center"
justifyContent={onPaginate ? 'spaceBetween' : 'flexEnd'}
>
{onPaginate && (
<EuiFlexItem grow={false}>
<EuiPagination
pageCount={totalVulnerabilitiesCount}
activePage={flyoutIndex}
onPageClick={onPaginate}
compressed
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<TakeAction createRuleFn={createVulnerabilityRuleFn} />
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const AdvancedStepForm: FC<CreateAnalyticsStepProps> = ({
randomizeSeed,
softTreeDepthLimit,
softTreeDepthTolerance,
useEstimatedMml,
]);

const outlierDetectionAdvancedConfig = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,38 +139,40 @@ export const CreateAnalyticsAdvancedEditor: FC<CreateAnalyticsFormProps> = (prop
)}
style={{ maxWidth: '100%' }}
>
<CodeEditor
languageId={'json'}
height={500}
languageConfiguration={{
autoClosingPairs: [
{
open: '{',
close: '}',
<div data-test-subj={'mlAnalyticsCreateJobWizardAdvancedEditorCodeEditor'}>
<CodeEditor
languageId={'json'}
height={500}
languageConfiguration={{
autoClosingPairs: [
{
open: '{',
close: '}',
},
],
}}
value={advancedEditorRawString}
onChange={onChange}
options={{
ariaLabel: i18n.translate(
'xpack.ml.dataframe.analytics.create.advancedEditor.codeEditorAriaLabel',
{
defaultMessage: 'Advanced analytics job editor',
}
),
automaticLayout: true,
readOnly: isJobCreated,
fontSize: 12,
scrollBeyondLastLine: false,
quickSuggestions: true,
minimap: {
enabled: false,
},
],
}}
value={advancedEditorRawString}
onChange={onChange}
options={{
ariaLabel: i18n.translate(
'xpack.ml.dataframe.analytics.create.advancedEditor.codeEditorAriaLabel',
{
defaultMessage: 'Advanced analytics job editor',
}
),
automaticLayout: true,
readOnly: isJobCreated,
fontSize: 12,
scrollBeyondLastLine: false,
quickSuggestions: true,
minimap: {
enabled: false,
},
wordWrap: 'on',
wrappingIndent: 'indent',
}}
/>
wordWrap: 'on',
wrappingIndent: 'indent',
}}
/>
</div>
</EuiFormRow>
<EuiSpacer />
{advancedEditorMessages.map((advancedEditorMessage, i) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,9 @@ export function reducer(state: State, action: Action): State {
const { jobConfig: config } = state;
const { jobId } = state.form;
// @ts-ignore
const formState = getFormStateFromJobConfig(config, false);
const formStateFromJobConfig = getFormStateFromJobConfig(config, false);
// Ensure previous form settings are persisted. Form state does not include any nested attributes.
const formState = { ...formStateFromJobConfig, ...state.form };

if (typeof jobId === 'string' && jobId.trim() !== '') {
formState.jobId = jobId;
Expand Down Expand Up @@ -605,7 +607,6 @@ export function reducer(state: State, action: Action): State {

return validateForm({
...state,
// @ts-ignore
form: formState,
isAdvancedEditorEnabled: false,
advancedEditorRawString: JSON.stringify(config, null, 2),
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/observability/common/locators/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const paths = {
sloCreateWithEncodedForm: (encodedParams: string) =>
`${OBSERVABILITY_BASE_PATH}${SLO_CREATE_PATH}?_a=${encodedParams}`,
sloEdit: (sloId: string) => `${OBSERVABILITY_BASE_PATH}${SLOS_PATH}/edit/${encodeURI(sloId)}`,
sloEditWithEncodedForm: (sloId: string, encodedParams: string) =>
`${OBSERVABILITY_BASE_PATH}${SLOS_PATH}/edit/${encodeURI(sloId)}?_a=${encodedParams}`,
sloDetails: (sloId: string, instanceId?: string) =>
!!instanceId
? `${OBSERVABILITY_BASE_PATH}${SLOS_PATH}/${encodeURI(sloId)}?instanceId=${encodeURI(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export function useCreateSlo() {
values: { name: slo.name },
})
);

queryClient.invalidateQueries({ queryKey: sloKeys.lists(), exact: false });
},
onError: (error, { slo }, context) => {
if (context?.previousData && context?.queryKey) {
Expand Down
Loading

0 comments on commit a7ab6dc

Please sign in to comment.