Skip to content

Commit

Permalink
Merge branch '8.11' into backport/8.11/pr-167916
Browse files Browse the repository at this point in the history
  • Loading branch information
MadameSheema authored Oct 24, 2023
2 parents b60118e + 89f1a28 commit 04f61d4
Show file tree
Hide file tree
Showing 37 changed files with 713 additions and 565 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ steps:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 60
parallelism: 2
parallelism: 4
retry:
automatic:
- exit_status: '*'
Expand Down
2 changes: 2 additions & 0 deletions dev_docs/operations/writing_stable_functional_tests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Consistently writing functional tests that aren't flaky is impossible. There are

When you watch tests execute locally it can be tempting to think "after I click this button I can click this other button" but this assumes that the first button click will always execute its click handler immediately, or that the render of the second button will be done immediately. The reality is that user interfaces are super complex and these types of assumptions are by far the most common cause of flakiness in tests.

We also have to remember that we can't assume a test passing locally will mean it will pass in CI. The two environments are different. There is a lot we could mention, but at a high level, most functional tests are run on 4 core 16 GB machines, and these machines are virtualized, which means neighbors can cause modest but variable levels of performance. Additionally, end-to-end tests in CI are run against {kib} distributions, using default memory configurations, while we run the tests under the `--dev` flag locally with, most likely, a different memory configuration.

There are all sorts of things that can happen to delay a click handler, or react render, and we need to be prepared for those in our tests. We can do this using appropriate timeouts for specific actions, retry logic, and validating our assumptions with code.

## Become familiar with the retry/timing logic of each common service method
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-test/src/kbn_client/kbn_client_saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ const STANDARD_LIST_TYPES = [
'lens',
'links',
'map',
// cases saved objects
'cases',
'cases-comments',
'cases-user-actions',
'cases-configure',
'cases-connector-mappings',
// synthetics based objects
'synthetics-monitor',
'uptime-dynamic-settings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const sourceCommands = {
),
description: (
<Markdown
openLinksInNewTab={true}
markdown={i18n.translate(
'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.from.markdown',
{
Expand Down Expand Up @@ -197,6 +198,7 @@ export const processingCommands = {
),
description: (
<Markdown
openLinksInNewTab={true}
markdown={i18n.translate(
'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.dissect.markdown',
{
Expand Down Expand Up @@ -260,6 +262,7 @@ FROM employees
),
description: (
<Markdown
openLinksInNewTab={true}
markdown={i18n.translate(
'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.enrich.markdown',
{
Expand Down Expand Up @@ -353,6 +356,7 @@ FROM employees
),
description: (
<Markdown
openLinksInNewTab={true}
markdown={i18n.translate(
'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.grok.markdown',
{
Expand Down Expand Up @@ -1093,8 +1097,8 @@ ROW a=1.8
Extracts parts of a date, like year, month, day, hour. The supported field types are those provided by Java's \`java.time.temporal.ChronoField\`.
\`\`\`
ROW date = DATE_PARSE("2022-05-06", "yyyy-MM-dd")
| EVAL year = DATE_EXTRACT(date, "year")
ROW date = DATE_PARSE("yyyy-MM-dd", "2022-05-06")
| EVAL year = DATE_EXTRACT("year", date)
\`\`\`
`,
description:
Expand Down Expand Up @@ -1122,7 +1126,7 @@ Returns a string representation of a date in the provided format. If no format i
\`\`\`
FROM employees
| KEEP first_name, last_name, hire_date
| EVAL hired = DATE_FORMAT(hire_date, "YYYY-MM-dd")
| EVAL hired = DATE_FORMAT("YYYY-MM-dd", hire_date)
\`\`\`
`,
description:
Expand All @@ -1149,7 +1153,7 @@ Converts a string to a date, in the provided format. If no format is specified,
\`\`\`
ROW date_string = "2022-05-06"
| EVAL date = DATE_PARSE(date_string, "yyyy-MM-dd")
| EVAL date = DATE_PARSE("yyyy-MM-dd", date_string)
\`\`\`
`,
description:
Expand Down Expand Up @@ -2866,6 +2870,7 @@ NOTE: There isn’t yet a \`COUNT(*)\`. Please count a single valued field if yo
),
description: (
<Markdown
openLinksInNewTab={true}
markdown={i18n.translate(
'textBasedEditor.query.textBasedLanguagesEditor.documentationESQL.countDistinctFunction.markdown',
{
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/observability/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export const uiSettings: Record<string, UiSettings> = {
defaultMessage: `The average amortized per-core power consumption (based on 100% CPU utilization).`,
}),
schema: schema.number({ min: 0 }),
requiresPageReload: false,
requiresPageReload: true,
},
[profilingDatacenterPUE]: {
category: [observabilityFeatureId],
Expand Down Expand Up @@ -425,7 +425,7 @@ export const uiSettings: Record<string, UiSettings> = {
},
}),
schema: schema.number({ min: 0 }),
requiresPageReload: false,
requiresPageReload: true,
},
[profilingCo2PerKWH]: {
category: [observabilityFeatureId],
Expand All @@ -448,7 +448,7 @@ export const uiSettings: Record<string, UiSettings> = {
},
}),
schema: schema.number({ min: 0 }),
requiresPageReload: false,
requiresPageReload: true,
},
};

Expand Down
20 changes: 20 additions & 0 deletions x-pack/plugins/observability_ai_assistant/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ export type { ObservabilityAIAssistantServerRouteRepository } from './routes/get
import { config as configSchema } from './config';

export const config: PluginConfigDescriptor<ObservabilityAIAssistantConfig> = {
deprecations: ({ unusedFromRoot }) => [
unusedFromRoot('xpack.observability.aiAssistant.enabled', {
level: 'warning',
}),
unusedFromRoot('xpack.observability.aiAssistant.provider.azureOpenAI.deploymentId', {
level: 'warning',
}),
unusedFromRoot('xpack.observability.aiAssistant.provider.azureOpenAI.resourceName', {
level: 'warning',
}),
unusedFromRoot('xpack.observability.aiAssistant.provider.azureOpenAI.apiKey', {
level: 'warning',
}),
unusedFromRoot('xpack.observability.aiAssistant.provider.openAI.apiKey', {
level: 'warning',
}),
unusedFromRoot('xpack.observability.aiAssistant.provider.openAI.model', {
level: 'warning',
}),
],
exposeToBrowser: {},
schema: configSchema,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
profilingPerCoreWatt,
} from '@kbn/observability-plugin/common';

describe('Functions page', () => {
describe.skip('Functions page', () => {
const rangeFrom = '2023-04-18T00:00:00.000Z';
const rangeTo = '2023-04-18T00:00:30.000Z';

Expand Down Expand Up @@ -203,6 +203,10 @@ describe('Functions page', () => {
.clear()
.type('20');
cy.contains('Save changes').click();
cy.getByTestSubj('kbnLoadingMessage').should('exist');
cy.getByTestSubj('kbnLoadingMessage').should('not.exist', {
timeout: 50000,
});
cy.go('back');
cy.wait('@getTopNFunctions');
cy.get(firstRowSelector).eq(5).contains('24.22k lbs / 10.99k');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
useEuiTheme,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { TopNFunctionSortField } from '@kbn/profiling-utils';
import React, { useEffect } from 'react';
import { asCost } from '../../utils/formatters/as_cost';
import { asWeight } from '../../utils/formatters/as_weight';
import { StackFrameSummary } from '../stack_frame_summary';
Expand All @@ -39,38 +39,8 @@ export function FunctionRow({
onFrameClick,
setCellProps,
}: Props) {
const theme = useEuiTheme();
const successColor = useEuiBackgroundColor('success');
const dangerColor = useEuiBackgroundColor('danger');

if (columnId === TopNFunctionSortField.Diff) {
if (!functionRow.diff) {
return (
<EuiText size="xs" color={theme.euiTheme.colors.primaryText}>
{i18n.translate('xpack.profiling.functionsView.newLabel', {
defaultMessage: 'New',
})}
</EuiText>
);
}

if (functionRow.diff.rank === 0) {
return null;
}

const color = functionRow.diff.rank > 0 ? 'success' : 'danger';
setCellProps({ style: { backgroundColor: color === 'success' ? successColor : dangerColor } });

return (
<EuiFlexGroup direction="row" gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiIcon type={functionRow.diff.rank > 0 ? 'sortUp' : 'sortDown'} color={color} />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="s">{Math.abs(functionRow.diff.rank)}</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
);
return <DiffColumn diff={functionRow.diff} setCellProps={setCellProps} />;
}

if (columnId === TopNFunctionSortField.Rank) {
Expand All @@ -82,12 +52,12 @@ export function FunctionRow({
}

if (columnId === TopNFunctionSortField.Samples) {
setCellProps({ css: { textAlign: 'right' } });
return (
<SampleStat
<SamplesColumn
samples={functionRow.samples}
diffSamples={functionRow.diff?.samples}
totalSamples={totalCount}
setCellProps={setCellProps}
/>
);
}
Expand Down Expand Up @@ -116,3 +86,65 @@ export function FunctionRow({

return null;
}

interface SamplesColumnProps {
samples: number;
diffSamples?: number;
totalSamples: number;
setCellProps: EuiDataGridCellValueElementProps['setCellProps'];
}

function SamplesColumn({ samples, totalSamples, diffSamples, setCellProps }: SamplesColumnProps) {
useEffect(() => {
setCellProps({ css: { textAlign: 'right' } });
}, [setCellProps]);
return <SampleStat samples={samples} diffSamples={diffSamples} totalSamples={totalSamples} />;
}

interface DiffColumnProps {
diff: IFunctionRow['diff'];
setCellProps: EuiDataGridCellValueElementProps['setCellProps'];
}

function DiffColumn({ diff, setCellProps }: DiffColumnProps) {
const theme = useEuiTheme();
const successColor = useEuiBackgroundColor('success');
const dangerColor = useEuiBackgroundColor('danger');

useEffect(() => {
if (diff && diff.rank > 0) {
const color = diff.rank > 0 ? 'success' : 'danger';
setCellProps({
style: { backgroundColor: color === 'success' ? successColor : dangerColor },
});
}
}, [dangerColor, diff, setCellProps, successColor]);

if (!diff) {
return (
<EuiText size="xs" color={theme.euiTheme.colors.primaryText}>
{i18n.translate('xpack.profiling.functionsView.newLabel', {
defaultMessage: 'New',
})}
</EuiText>
);
}

if (diff.rank === 0) {
return null;
}

return (
<EuiFlexGroup direction="row" gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiIcon
type={diff.rank > 0 ? 'sortUp' : 'sortDown'}
color={diff.rank > 0 ? 'success' : 'danger'}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="s">{Math.abs(diff.rank)}</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
);
}
Loading

0 comments on commit 04f61d4

Please sign in to comment.