Skip to content

Commit

Permalink
Merge branch 'main' into 164695-services-endpoint-apm-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
klacabane authored Sep 4, 2023
2 parents 261c736 + 6e7624f commit 49936d7
Show file tree
Hide file tree
Showing 51 changed files with 353 additions and 352 deletions.
6 changes: 5 additions & 1 deletion .buildkite/hooks/post-command
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env bash

.buildkite/scripts/lifecycle/post_command.sh
if [[ "$BUILDKITE_AGENT_NAME" =~ ^bk-agent ]]; then
echo "Pipeline file triggered from outside the kibana executors, skipping post_command"
else
.buildkite/scripts/lifecycle/post_command.sh
fi
6 changes: 5 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env bash

source .buildkite/scripts/lifecycle/pre_command.sh
if [[ "$BUILDKITE_AGENT_NAME" =~ ^bk-agent ]]; then
echo "Pipeline file triggered from outside the kibana executors, skipping pre_command"
else
source .buildkite/scripts/lifecycle/pre_command.sh
fi
11 changes: 11 additions & 0 deletions .buildkite/pipelines/quality-gates/pipeline.tests-production.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
env:
TEAM_CHANNEL: "#kibana-serverless-release"
ENVIRONMENT: "production"

steps:
- label: ":pipeline::fleet::seedling: Trigger Observability Kibana Tests for ${ENVIRONMENT}"
command: echo "replace me with Observability specific Kibana tests"
Expand All @@ -8,3 +12,10 @@ steps:
command: echo "replace me with Security specific Kibana tests"
agent:
image: "docker.elastic.co/ci-agent-images/basic-buildkite-agent:1688566364"

- wait: ~

- label: ":judge::seedling: Trigger Manual Tests Phase"
command: "make -C /agent trigger-manual-verification-phase"
agents:
image: "docker.elastic.co/ci-agent-images/manual-verification-agent:0.0.1"
11 changes: 11 additions & 0 deletions .buildkite/pipelines/quality-gates/pipeline.tests-qa.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
env:
TEAM_CHANNEL: "#kibana-serverless-release"
ENVIRONMENT: "qa"

steps:
- label: ":pipeline::kibana::seedling: Trigger Kibana Tests for ${ENVIRONMENT}"
command: echo "replace me with Kibana specific tests"
Expand All @@ -18,3 +22,10 @@ steps:
command: echo "replace me with Control Plane specific Kibana tests"
agent:
image: "docker.elastic.co/ci-agent-images/basic-buildkite-agent:1688566364"

- wait: ~

- label: ":judge::seedling: Trigger Manual Tests Phase"
command: "make -C /agent trigger-manual-verification-phase"
agents:
image: "docker.elastic.co/ci-agent-images/manual-verification-agent:0.0.1"
11 changes: 11 additions & 0 deletions .buildkite/pipelines/quality-gates/pipeline.tests-staging.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
env:
TEAM_CHANNEL: "#kibana-serverless-release"
ENVIRONMENT: "staging"

steps:
- label: ":pipeline::fleet::seedling: Trigger Observability Kibana Tests for ${ENVIRONMENT}"
command: echo "replace me with Observability specific Kibana tests"
Expand All @@ -8,3 +12,10 @@ steps:
command: echo "replace me with Security specific Kibana tests"
agent:
image: "docker.elastic.co/ci-agent-images/basic-buildkite-agent:1688566364"

- wait: ~

- label: ":judge::seedling: Trigger Manual Tests Phase"
command: "make -C /agent trigger-manual-verification-phase"
agents:
image: "docker.elastic.co/ci-agent-images/manual-verification-agent:0.0.1"
5 changes: 0 additions & 5 deletions .buildkite/scripts/lifecycle/pre_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

set -euo pipefail

if [[ "$BUILDKITE_COMMAND" =~ ^"buildkite-agent pipeline upload" ]]; then
echo "Skipped pre-command when running the Upload pipeline"
exit 0
fi

source .buildkite/scripts/common/util.sh

echo '--- Setup environment vars'
Expand Down
270 changes: 21 additions & 249 deletions docs/CHANGELOG.asciidoc

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@
"@elastic/synthetics": "^1.3.0",
"@emotion/babel-preset-css-prop": "^11.11.0",
"@emotion/jest": "^11.11.0",
"@frsource/cypress-plugin-visual-regression-diff": "^3.3.10",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@istanbuljs/schema": "^0.1.2",
"@jest/console": "^29.6.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class ContentClient {
private readonly crudClientProvider: (contentType?: string) => CrudClient,
private readonly contentTypeRegistry: ContentTypeRegistry
) {
this.queryClient = new QueryClient();
this.queryClient = new QueryClient({ defaultOptions: { queries: { networkMode: 'always' } } });
this.queryOptionBuilder = createQueryOptionBuilder({
crudClientProvider: this.crudClientProvider,
contentTypeRegistry: this.contentTypeRegistry,
Expand Down
3 changes: 2 additions & 1 deletion test/examples/unified_field_list_examples/field_stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
await PageObjects.unifiedFieldList.cleanSidebarLocalStorage();
});

describe('field distribution', () => {
// FLAKY: https://github.com/elastic/kibana/issues/165608
describe.skip('field distribution', () => {
before(async () => {
await PageObjects.unifiedFieldList.toggleSidebarSection('empty'); // it will allow to render more fields in Available fields section
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { synthtrace } from '../../../synthtrace';
import { opbeans } from '../../fixtures/synthtrace/opbeans';

const start = '2021-10-10T00:00:00.000Z';
const end = '2021-10-10T00:15:00.000Z';
const end = '2021-10-10T00:01:00.000Z';

const serviceMapHref = url.format({
pathname: '/app/apm/service-map',
Expand All @@ -29,7 +29,7 @@ const detailedServiceMap = url.format({
},
});

describe('Service map', () => {
describe('service map', () => {
before(() => {
synthtrace.index(
opbeans({
Expand All @@ -47,20 +47,28 @@ describe('Service map', () => {
cy.loginAsViewerUser();
});

describe('When navigating to service map', () => {
it('opens service map', () => {
describe('when navigating to service map', () => {
beforeEach(() => {
cy.intercept('GET', '/internal/apm/service-map?*').as('serviceMap');
cy.visitKibana(serviceMapHref);
cy.contains('h1', 'Services');

cy.wait('@serviceMap');
});

it('shows nodes in service map', { retries: 3 }, () => {
cy.wait(500);
cy.getByTestSubj('serviceMap').matchImage();
});

it('opens detailed service map', () => {
it('shows nodes in detailed service map', () => {
cy.visitKibana(detailedServiceMap);
cy.contains('h1', 'opbeans-java');
cy.wait(500);
cy.getByTestSubj('serviceMap').matchImage();
});

describe('When there is no data', () => {
describe('when there is no data', () => {
it('shows empty state', () => {
cy.visitKibana(serviceMapHref);
// we need to dismiss the service-group call out first
cy.contains('Dismiss').click();
cy.getByTestSubj('apmUnifiedSearchBar').type('_id : foo{enter}');
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'cypress-real-events/support';
import { Interception } from 'cypress/types/net-stubbing';
import 'cypress-axe';
import moment from 'moment';
import '@frsource/cypress-plugin-visual-regression-diff';
import { AXE_CONFIG, AXE_OPTIONS } from '@kbn/axe-config';
import { ApmUsername } from '../../../server/test_helpers/create_apm_users/authentication';

Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/apm/ftr_e2e/setup_cypress_node_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
LogLevel,
} from '@kbn/apm-synthtrace';
import { createEsClientForTesting } from '@kbn/test';
// eslint-disable-next-line @kbn/imports/no_unresolvable_imports
import { initPlugin } from '@frsource/cypress-plugin-visual-regression-diff/plugins';
import del from 'del';
import { some } from 'lodash';
import { Readable } from 'stream';
Expand All @@ -35,6 +37,8 @@ export function setupNodeEvents(

synthtraceEsClient.pipeline(synthtraceEsClient.getDefaultPipeline(false));

initPlugin(on, config);

on('task', {
// send logs to node process
log(message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ export function registerGetApmTimeseriesFunction({
description: 'The name of the service',
},
'service.environment': {
...NON_EMPTY_STRING,
description:
'The environment that the service is running in.',
'The environment that the service is running in. If undefined, all environments will be included. Only use this if you have confirmed the environment that the service is running in.',
},
filter: {
type: 'string',
Expand All @@ -160,12 +159,7 @@ export function registerGetApmTimeseriesFunction({
'The offset. Right: 15m. 8h. 1d. Wrong: -15m. -8h. -1d.',
},
},
required: [
'service.name',
'service.environment',
'timeseries',
'title',
],
required: ['service.name', 'timeseries', 'title'],
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function ServiceMap({
<SearchBar showTimeComparison />
<EuiPanel hasBorder={true} paddingSize="none">
<div
data-test-subj="ServiceMap"
data-test-subj="serviceMap"
style={{ height: heightWithPadding }}
ref={ref}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { environmentQuery } from '../../../../common/utils/environment_query';
import { getBucketSize } from '../../../../common/utils/get_bucket_size';
import { termQuery } from '../../../../common/utils/term_query';
import { APMEventClient } from '../../../lib/helpers/create_es_client/create_apm_event_client';
import { environmentRt } from '../../default_api_types';
import { getErrorEventRate } from './get_error_event_rate';
import { getExitSpanFailureRate } from './get_exit_span_failure_rate';
import { getExitSpanLatency } from './get_exit_span_latency';
Expand All @@ -37,7 +36,6 @@ export const getApmTimeseriesRt = t.type({
stats: t.array(
t.intersection([
t.type({
'service.environment': environmentRt.props.environment,
'service.name': t.string,
title: t.string,
timeseries: t.union([
Expand Down Expand Up @@ -85,6 +83,7 @@ export const getApmTimeseriesRt = t.type({
t.partial({
filter: t.string,
offset: t.string,
'service.environment': t.string,
}),
])
),
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/observability_ai_assistant/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ interface FunctionOptions<TParameters extends CompatibleJSONSchema = CompatibleJ
}

type RespondFunction<TArguments, TResponse extends FunctionResponse> = (
options: { arguments: TArguments },
options: { arguments: TArguments; messages: Message[] },
signal: AbortSignal
) => Promise<TResponse>;

Expand All @@ -99,7 +99,10 @@ type RenderFunction<TArguments, TResponse extends FunctionResponse> = (options:

export interface FunctionDefinition {
options: FunctionOptions;
respond: (options: { arguments: any }, signal: AbortSignal) => Promise<FunctionResponse>;
respond: (
options: { arguments: any; messages: Message[] },
signal: AbortSignal
) => Promise<FunctionResponse>;
render?: RenderFunction<any, any>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function ObservabilityAIAssistantActionMenuItem() {
<>
<EuiHeaderLink
color="primary"
data-test-subj="observabilityAiAssistantNewChatHeaderLink"
onClick={() => {
setIsOpen(() => true);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,26 @@ export function AskAssistantButton({
switch (variant) {
case 'basic':
return (
<EuiButton fill={fill} size={size} iconType="sparkles" onClick={onClick}>
<EuiButton
data-test-subj="observabilityAiAssistantAskAssistantButton"
fill={fill}
size={size}
iconType="sparkles"
onClick={onClick}
>
{buttonLabel}
</EuiButton>
);

case 'empty':
return (
<EuiButtonEmpty size={size} flush={flush} iconType="sparkles" onClick={onClick}>
<EuiButtonEmpty
data-test-subj="observabilityAiAssistantAskAssistantButton"
size={size}
flush={flush}
iconType="sparkles"
onClick={onClick}
>
{buttonLabel}
</EuiButtonEmpty>
);
Expand All @@ -89,8 +101,9 @@ export function AskAssistantButton({
defaultMessage: 'Elastic Assistant',
}
)}
iconType="sparkles"
data-test-subj="observabilityAiAssistantAskAssistantButtonButtonIcon"
display={fill ? 'fill' : 'base'}
iconType="sparkles"
size={size}
style={{ minWidth: 'auto' }}
onClick={onClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export type HideExpandConversationListButtonProps = React.ComponentProps<typeof

export function HideExpandConversationListButton(props: HideExpandConversationListButtonProps) {
return (
<EuiButtonEmpty iconType={props.isExpanded ? 'menuLeft' : 'menuRight'} size="xs" {...props}>
<EuiButtonEmpty
data-test-subj="observabilityAiAssistantHideExpandConversationListButton"
iconType={props.isExpanded ? 'menuLeft' : 'menuRight'}
size="xs"
{...props}
>
{props.isExpanded
? i18n.translate('xpack.observabilityAiAssistant.hideExpandConversationButton.hide', {
defaultMessage: 'Hide chats',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { i18n } from '@kbn/i18n';

export function NewChatButton(props: React.ComponentProps<typeof EuiButton>) {
return (
<EuiButton {...props} fill iconType="discuss">
<EuiButton
data-test-subj="observabilityAiAssistantNewChatButton"
fill
iconType="discuss"
{...props}
>
{i18n.translate('xpack.observabilityAiAssistant.newChatButton', {
defaultMessage: 'New chat',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import { i18n } from '@kbn/i18n';

export function RegenerateResponseButton(props: Partial<EuiButtonEmptyProps>) {
return (
<EuiButtonEmpty size="s" {...props} iconType="sparkles">
<EuiButtonEmpty
size="s"
data-test-subj="observabilityAiAssistantRegenerateResponseButton"
iconType="sparkles"
{...props}
>
{i18n.translate('xpack.observabilityAiAssistant.regenerateResponseButtonLabel', {
defaultMessage: 'Regenerate',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ import { i18n } from '@kbn/i18n';

export function StartChatButton(props: React.ComponentProps<typeof EuiButton>) {
return (
<EuiButton {...props} fill iconType="discuss" size="s">
<EuiButton
data-test-subj="observabilityAiAssistantStartChatButton"
fill
iconType="discuss"
size="s"
{...props}
>
{i18n.translate('xpack.observabilityAiAssistant.insight.response.startChat', {
defaultMessage: 'Start chat',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import { i18n } from '@kbn/i18n';

export function StopGeneratingButton(props: Partial<EuiButtonEmptyProps>) {
return (
<EuiButtonEmpty size="s" {...props} iconType="stop" color="text">
<EuiButtonEmpty
data-test-subj="observabilityAiAssistantStopGeneratingButton"
color="text"
iconType="stop"
size="s"
{...props}
>
{i18n.translate('xpack.observabilityAiAssistant.stopGeneratingButtonLabel', {
defaultMessage: 'Stop generating',
})}
Expand Down
Loading

0 comments on commit 49936d7

Please sign in to comment.