Skip to content

Commit

Permalink
Merge branch 'feature/98382-uptime-migrate-to-observability-rules-reg…
Browse files Browse the repository at this point in the history
…istry' of https://github.com/dominiqueclarke/kibana into feature/98382-uptime-migrate-to-observability-rules-registry
  • Loading branch information
dominiqueclarke committed Jul 6, 2021
2 parents 294137a + d541c85 commit 1f4f4d7
Show file tree
Hide file tree
Showing 181 changed files with 4,487 additions and 1,179 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-core
/src/plugins/security_oss/ @elastic/kibana-security
/src/plugins/spaces_oss/ @elastic/kibana-security
/src/plugins/user_setup/ @elastic/kibana-security
/test/security_functional/ @elastic/kibana-security
/x-pack/plugins/spaces/ @elastic/kibana-security
/x-pack/plugins/encrypted_saved_objects/ @elastic/kibana-security
Expand Down
Binary file added dev_docs/assets/pr_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dev_docs/assets/pr_header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dev_docs/assets/pr_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions dev_docs/tutorials/submit_a_pull_request.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
id: kibDevTutorialSubmitPullRequest
slug: /kibana-dev-docs/tutorial/submit-pull-request
title: Submitting a Kibana pull request
summary: Learn how to submit a Kibana pull request
date: 2021-06-24
tags: ['kibana', 'onboarding', 'dev', 'tutorials', 'github', 'pr', 'pull request', 'ci']
---

## Create and clone a fork of Kibana

Kibana has hundreds of developers, some of whom are outside of Elastic, so we use a fork-based approach for creating branches and pull requests.

To create and clone a fork:

1. Login to [GitHub](https://github.com)
2. Navigate to the [Kibana repository](https://github.com/elastic/kibana)
3. Follow the [GitHub instructions](https://docs.github.com/en/get-started/quickstart/fork-a-repo) for forking and cloning repos

## Create a branch

After cloning your fork and navigating to the directory containing your fork:

```bash
# Make sure you currently have the branch checked out off of which you'd like to work
git checkout master

# Create a new branch
git checkout -b fix-typos-in-readme

# Edit some code
vi README.md

# Add/commit the change
git add README.md
git commit -m "Fixed all of the typos in the README"

# Push the branch to your fork
git push -u origin fix-typos-in-readme
```

If this is a new branch, you will see a link in your terminal that points you directly to a page to create a pull request for that branch.

## Create a pull request

1. Navigate to your fork in Github
2. If you see your branch at the top of the screen with a `Compare & pull request` button, click that. Otherwise:
1. Navigate to your branch
2. Click Contribute, followed by `Open pull request`
3. Fill out the details that are relevant for your change in the pull request template
1. If your pull request relates to an open issue, you can also reference that issue here, e.g. `Closes #12345`
4. [Elastic employees only] Add any teams/people that need to review your code under Reviewers. There's a good chance one or more teams will automatically be added based on which part of the codebase in which your changes were made.
5. [Elastic employees only] Add any relevant labels
1. Versions: Add a label for each version of Kibana in which your change will ship. For example, `v8.0.0`, `v7.14.0`
2. Features: Add labels for any relevant feature areas, e.g. `Feature:Development`
3. Team: Most PRs should have at least one `Team:` label. Add labels for teams that should follow or are responsible for the pull request.
4. Release Note: Add `release_note:skip` if this pull request should not automatically get added to release notes for Kibana
5. Auto Backport: Add `auto-backport` if you'd like your pull request automatically backported to all labeled versions.
6. Submit the pull request. If it's not quite ready for review, it can also be submitted as a Draft pull request.

![Screenshot of Compare and pull request header](../assets/pr_header.png)

![Screenshot of opening a pull request from the branch page](../assets/pr_open.png)

![Screenshot of pull request details](../assets/pr_details.png)

## Sign the Contributor Agreement

If this is your first pull request, a bot will post a comment asking you to sign our [CLA / Contributor Agreement](https://www.elastic.co/contributor-agreement). Your pull request won't be able to be merged until you've reviewed and signed the agreement.

## Review Process

At this point, your pull request will be reviewed, discussed, etc. Changes will likely be requested. For complex pull requests, this process could take several weeks. Please be patient and understand we hold our code base to a high standard.

See [Pull request review guidelines](https://www.elastic.co/guide/en/kibana/master/pr-review.html) for our general philosophy for pull request reviews.

## Updating your PR with upstream

If your pull request hasn't been updated with the latest code from the upstream/target branch, e.g. `master`, in the last 48 hours, it won't be able to merge until it is updated. This is to help prevent problems that could occur by merging stale code into upstream, e.g. something new was recently merged that is incompatible with something in your pull request.

As an alternative to using `git` to manually update your branch, you can leave a comment on your pull request with the text `@elasticmachine merge upstream`. This will automatically update your branch and kick off CI for it.

## Re-triggering CI

The easiest way to re-trigger CI is to simply update your branch (see above) with the latest code from upstream. This has the added benefit of ensuring that your branch is up-to-date and compatible.
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ In general this plugin provides:
|The Usage Collection Service defines a set of APIs for other plugins to report the usage of their features. At the same time, it provides necessary the APIs for other services (i.e.: telemetry, monitoring, ...) to consume that usage data.
|{kib-repo}blob/{branch}/src/plugins/user_setup/README.md[userSetup]
|The plugin provides UI and APIs for the interactive setup mode.
|{kib-repo}blob/{branch}/src/plugins/vis_default_editor/README.md[visDefaultEditor]
|The default editor is used in most primary visualizations, e.x. Area, Data table, Pie, etc.
It acts as a container for a particular visualization and options tabs. Contains the default "Data" tab in public/components/sidebar/data_tab.tsx.
Expand Down
2 changes: 1 addition & 1 deletion docs/user/ml/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ browser so that it does not block pop-up windows or create an exception for your

For more information about the {anomaly-detect} feature, see
https://www.elastic.co/what-is/elastic-stack-machine-learning[{ml-cap} in the {stack}]
and {ml-docs}/xpack-ml.html[{ml-cap} {anomaly-detect}].
and {ml-docs}/ml-ad-overview.html[{ml-cap} {anomaly-detect}].

[[xpack-ml-dfanalytics]]
== {dfanalytics-cap}
Expand Down
4 changes: 4 additions & 0 deletions docs/user/security/authentication/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ image::user/security/images/kibana-login.png["Login Selector UI"]

For more information, refer to <<authentication-security-settings, authentication security settings>>.

TIP: If you have multiple authentication providers configured, you can use the `auth_provider_hint` URL query parameter to create a deep
link to any provider and bypass the Login Selector UI. Using the `kibana.yml` above as an example, you can add `?auth_provider_hint=basic1`
to the login page URL, which will take you directly to the basic login page.

[[basic-authentication]]
==== Basic authentication

Expand Down
21 changes: 20 additions & 1 deletion examples/locator_explorer/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EuiFieldText } from '@elastic/eui';
import { EuiPageHeader } from '@elastic/eui';
import { EuiLink } from '@elastic/eui';
import { AppMountParameters } from '../../../src/core/public';
import { SharePluginSetup } from '../../../src/plugins/share/public';
import { formatSearchParams, SharePluginSetup } from '../../../src/plugins/share/public';
import {
HelloLocatorV1Params,
HelloLocatorV2Params,
Expand All @@ -34,6 +34,7 @@ interface MigratedLink {
linkText: string;
link: string;
version: string;
params: HelloLocatorV1Params | HelloLocatorV2Params;
}

const ActionsExplorer = ({ share }: Props) => {
Expand Down Expand Up @@ -93,6 +94,7 @@ const ActionsExplorer = ({ share }: Props) => {
linkText: savedLink.linkText,
link,
version: savedLink.version,
params: savedLink.params,
} as MigratedLink;
})
);
Expand Down Expand Up @@ -157,7 +159,24 @@ const ActionsExplorer = ({ share }: Props) => {
target="_blank"
>
{link.linkText}
</EuiLink>{' '}
(
<EuiLink
color={link.version !== '0.0.2' ? 'danger' : 'primary'}
data-test-subj="linkToHelloPage"
href={
'/app/r?' +
formatSearchParams({
id: 'HELLO_LOCATOR',
version: link.version,
params: link.params,
}).toString()
}
target="_blank"
>
through redirect app
</EuiLink>
)
<br />
</React.Fragment>
))
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/src/certs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { resolve } from 'path';

export const CA_CERT_PATH = resolve(__dirname, '../certs/ca.crt');
export const CA_CERT_PATH = process.env.TEST_CA_CERT_PATH || resolve(__dirname, '../certs/ca.crt');
export const ES_KEY_PATH = resolve(__dirname, '../certs/elasticsearch.key');
export const ES_CERT_PATH = resolve(__dirname, '../certs/elasticsearch.crt');
export const ES_P12_PATH = resolve(__dirname, '../certs/elasticsearch.p12');
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ pageLoadAssetSize:
visTypePie: 35583
expressionRevealImage: 25675
cases: 144442
userSetup: 18532
4 changes: 2 additions & 2 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class DocLinksService {
ml: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/index.html`,
aggregations: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-aggregation.html`,
anomalyDetection: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/xpack-ml.html`,
anomalyDetection: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-overview.html`,
anomalyDetectionJobs: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-jobs.html`,
anomalyDetectionConfiguringCategories: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-categories.html`,
anomalyDetectionBucketSpan: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/create-jobs.html#bucket-span`,
Expand All @@ -249,7 +249,7 @@ export class DocLinksService {
customUrls: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-url.html`,
dataFrameAnalytics: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics.html`,
featureImportance: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-feature-importance.html`,
outlierDetectionRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-roc`,
outlierDetectionRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-finding-outliers.html#ml-dfanalytics-roc`,
regressionEvaluation: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-regression-evaluation`,
classificationAucRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics-evaluate.html#ml-dfanalytics-class-aucroc`,
},
Expand Down
3 changes: 2 additions & 1 deletion src/core/public/http/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface Params {

const JSON_CONTENT = /^(application\/(json|x-javascript)|text\/(x-)?javascript|x-json)(;.*)?$/;
const NDJSON_CONTENT = /^(application\/ndjson)(;.*)?$/;
const ZIP_CONTENT = /^(application\/zip)(;.*)?$/;

const removedUndefined = (obj: Record<string, any> | undefined) => {
return omitBy(obj, (v) => v === undefined);
Expand Down Expand Up @@ -153,7 +154,7 @@ export class Fetch {
const contentType = response.headers.get('Content-Type') || '';

try {
if (NDJSON_CONTENT.test(contentType)) {
if (NDJSON_CONTENT.test(contentType) || ZIP_CONTENT.test(contentType)) {
body = await response.blob();
} else if (JSON_CONTENT.test(contentType)) {
body = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana-encryption-keys.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If Not Exist "%NODE%" (
)

set CONFIG_DIR=%KBN_PATH_CONF%
If [%KBN_PATH_CONF%] == [] (
If ["%KBN_PATH_CONF%"] == [] (
set "CONFIG_DIR=%DIR%\config"
)

Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana-keystore.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If Not Exist "%NODE%" (
)

set CONFIG_DIR=%KBN_PATH_CONF%
If [%KBN_PATH_CONF%] == [] (
If ["%KBN_PATH_CONF%"] == [] (
set "CONFIG_DIR=%DIR%\config"
)

Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana-plugin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If Not Exist "%NODE%" (
)

set CONFIG_DIR=%KBN_PATH_CONF%
If [%KBN_PATH_CONF%] == [] (
If ["%KBN_PATH_CONF%"] == [] (
set "CONFIG_DIR=%DIR%\config"
)

Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If Not Exist "%NODE%" (
)

set CONFIG_DIR=%KBN_PATH_CONF%
If [%KBN_PATH_CONF%] == [] (
If ["%KBN_PATH_CONF%"] == [] (
set "CONFIG_DIR=%DIR%\config"
)

Expand Down
48 changes: 48 additions & 0 deletions src/plugins/data/server/autocomplete/terms_agg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const mockResponse = {
},
} as ApiResponse<SearchResponse<any>>;

jest.mock('../index_patterns');

describe('terms agg suggestions', () => {
beforeEach(() => {
const requestHandlerContext = coreMock.createRequestHandlerContext();
Expand Down Expand Up @@ -86,4 +88,50 @@ describe('terms agg suggestions', () => {
]
`);
});

it('calls the _search API with a terms agg and fallback to fieldName when field is null', async () => {
const result = await termsAggSuggestions(
configMock,
savedObjectsClientMock,
esClientMock,
'index',
'fieldName',
'query',
[]
);

const [[args]] = esClientMock.search.mock.calls;

expect(args).toMatchInlineSnapshot(`
Object {
"body": Object {
"aggs": Object {
"suggestions": Object {
"terms": Object {
"execution_hint": "map",
"field": "fieldName",
"include": "query.*",
"shard_size": 10,
},
},
},
"query": Object {
"bool": Object {
"filter": Array [],
},
},
"size": 0,
"terminate_after": 98430,
"timeout": "4513ms",
},
"index": "index",
}
`);
expect(result).toMatchInlineSnapshot(`
Array [
"whoa",
"amazing",
]
`);
});
});
43 changes: 43 additions & 0 deletions src/plugins/data/server/autocomplete/terms_enum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const mockResponse = {
body: { terms: ['whoa', 'amazing'] },
};

jest.mock('../index_patterns');

describe('_terms_enum suggestions', () => {
beforeEach(() => {
const requestHandlerContext = coreMock.createRequestHandlerContext();
Expand Down Expand Up @@ -71,4 +73,45 @@ describe('_terms_enum suggestions', () => {
`);
expect(result).toEqual(mockResponse.body.terms);
});

it('calls the _terms_enum API and fallback to fieldName when field is null', async () => {
const result = await termsEnumSuggestions(
configMock,
savedObjectsClientMock,
esClientMock,
'index',
'fieldName',
'query',
[]
);

const [[args]] = esClientMock.transport.request.mock.calls;

expect(args).toMatchInlineSnapshot(`
Object {
"body": Object {
"field": "fieldName",
"index_filter": Object {
"bool": Object {
"must": Array [
Object {
"terms": Object {
"_tier": Array [
"data_hot",
"data_warm",
"data_content",
],
},
},
],
},
},
"string": "query",
},
"method": "POST",
"path": "/index/_terms_enum",
}
`);
expect(result).toEqual(mockResponse.body.terms);
});
});
2 changes: 1 addition & 1 deletion src/plugins/data/server/autocomplete/terms_enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function termsEnumSuggestions(
method: 'POST',
path: encodeURI(`/${index}/_terms_enum`),
body: {
field: field?.name ?? field,
field: field?.name ?? fieldName,
string: query,
index_filter: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const applicationUsageSchema = {
error: commonSchema,
status: commonSchema,
kibanaOverview: commonSchema,
r: commonSchema,

// X-Pack
apm: commonSchema,
Expand Down
Loading

0 comments on commit 1f4f4d7

Please sign in to comment.