Skip to content

Commit

Permalink
Merge branch 'master' into fix-chart-bg-color
Browse files Browse the repository at this point in the history
  • Loading branch information
nickofthyme committed Jul 1, 2020
2 parents fd7046f + d8d24be commit 21953cc
Show file tree
Hide file tree
Showing 286 changed files with 10,602 additions and 9,309 deletions.
4 changes: 2 additions & 2 deletions .ci/Jenkinsfile_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def handleIngestion(timestamp) {
kibanaCoverage.collectVcsInfo("### Collect VCS Info")
kibanaCoverage.generateReports("### Merge coverage reports")
kibanaCoverage.uploadCombinedReports()
kibanaCoverage.ingest(timestamp, '### Injest && Upload')
kibanaCoverage.ingest(env.JOB_NAME, BUILD_NUMBER, BUILD_URL, timestamp, '### Ingest && Upload')
kibanaCoverage.uploadCoverageStaticSite(timestamp)
}

def handleFail() {
def buildStatus = buildUtils.getBuildStatus()
if(params.NOTIFY_ON_FAILURE && buildStatus != 'SUCCESS' && buildStatus != 'ABORTED') {
if(params.NOTIFY_ON_FAILURE && buildStatus != 'SUCCESS' && buildStatus != 'ABORTED' && buildStatus != 'UNSTABLE') {
slackNotifications.sendFailedBuild(
channel: '#kibana-qa',
username: 'Kibana QA'
Expand Down
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
/x-pack/plugins/infra/ @elastic/logs-metrics-ui
/x-pack/plugins/ingest_manager/ @elastic/ingest-management
/x-pack/legacy/plugins/ingest_manager/ @elastic/ingest-management
/x-pack/plugins/observability/ @elastic/logs-metrics-ui @elastic/apm-ui @elastic/uptime @elastic/ingest-management
/x-pack/plugins/observability/ @elastic/observability-ui
/x-pack/legacy/plugins/monitoring/ @elastic/stack-monitoring-ui
/x-pack/plugins/monitoring/ @elastic/stack-monitoring-ui
/x-pack/plugins/uptime @elastic/uptime
Expand Down Expand Up @@ -132,6 +132,7 @@

# Quality Assurance
/src/dev/code_coverage @elastic/kibana-qa
/vars/*Coverage.groovy @elastic/kibana-qa
/test/functional/services/common @elastic/kibana-qa
/test/functional/services/lib @elastic/kibana-qa
/test/functional/services/remote @elastic/kibana-qa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
SearchBar: React.ComponentClass<Pick<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "timeHistory" | "onFiltersUpdated">, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "timeHistory" | "onFiltersUpdated">, any> & {
WrappedComponent: React.ComponentType<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "timeHistory" | "onFiltersUpdated"> & ReactIntl.InjectedIntlProps>;
SearchBar: React.ComponentClass<Pick<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "indicateNoData" | "timeHistory" | "onFiltersUpdated">, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "indexPatterns" | "dataTestSubj" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "indicateNoData" | "timeHistory" | "onFiltersUpdated">, any> & {
WrappedComponent: React.ComponentType<Pick<SearchBarProps, "query" | "isLoading" | "filters" | "onRefresh" | "onRefreshChange" | "refreshInterval" | "intl" | "indexPatterns" | "dataTestSubj" | "customSubmitButton" | "screenTitle" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "indicateNoData" | "timeHistory" | "onFiltersUpdated"> & ReactIntl.InjectedIntlProps>;
}
```
8 changes: 4 additions & 4 deletions docs/glossary.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ See {kibana-ref}/alerting-getting-started.html[Alerts and Actions].
[[glossary-annotation]] annotation ::
// tag::annotation-def[]
A way to augment a data display with descriptive domain knowledge.
// end::alerts-annotation-def[]
// end::annotation-def[]


[[glossary-app]] app ::
Expand Down Expand Up @@ -90,7 +90,7 @@ See {kibana-ref}/canvas.html[Canvas].
// end::canvas-def[]

[[glossary-canvas-language]] Canvas expression language::
// tag::ccanvas-language-def[]
// tag::canvas-language-def[]
A pipeline-based expression language for manipulating and visualizing data.
Includes dozens of functions and other capabilities, such as table transforms,
type casting, and sub-expressions. Supports TinyMath functions for complex math calculations.
Expand Down Expand Up @@ -354,11 +354,11 @@ Timestamped data such as logs, metrics, and events that is indexed on an ongoing


[[glossary-TSVB-data]] TSVB ::
// tag::TSVB-def[]
// tag::tsvb-def[]
A time series data visualizer that allows you to combine an
infinite number of aggregations to display complex data.
See {kibana-ref}/TSVB.html[TSVB].
// end::TSVB-def[]
// end::tsvb-def[]


[float]
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-kibana/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ module.exports = {
}],
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'constructor-super': 'error',
'dot-notation': 'error',
'eqeqeq': ['error', 'always', {'null': 'ignore'}],
Expand Down
161 changes: 161 additions & 0 deletions src/core/server/logging/integration_tests/logging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/

import * as kbnTestServer from '../../../../test_utils/kbn_server';
import { InternalCoreSetup } from '../../internal_types';
import { LoggerContextConfigInput } from '../logging_config';
import { Subject } from 'rxjs';

function createRoot() {
return kbnTestServer.createRoot({
Expand Down Expand Up @@ -111,4 +114,162 @@ describe('logging service', () => {
expect(mockConsoleLog).toHaveBeenCalledTimes(0);
});
});

describe('custom context configuration', () => {
const CUSTOM_LOGGING_CONFIG: LoggerContextConfigInput = {
appenders: {
customJsonConsole: {
kind: 'console',
layout: {
kind: 'json',
},
},
customPatternConsole: {
kind: 'console',
layout: {
kind: 'pattern',
pattern: 'CUSTOM - PATTERN [%logger][%level] %message',
},
},
},

loggers: [
{ context: 'debug_json', appenders: ['customJsonConsole'], level: 'debug' },
{ context: 'debug_pattern', appenders: ['customPatternConsole'], level: 'debug' },
{ context: 'info_json', appenders: ['customJsonConsole'], level: 'info' },
{ context: 'info_pattern', appenders: ['customPatternConsole'], level: 'info' },
{
context: 'all',
appenders: ['customJsonConsole', 'customPatternConsole'],
level: 'debug',
},
],
};

let root: ReturnType<typeof createRoot>;
let setup: InternalCoreSetup;
let mockConsoleLog: jest.SpyInstance;
const loggingConfig$ = new Subject<LoggerContextConfigInput>();
const setContextConfig = (enable: boolean) =>
enable ? loggingConfig$.next(CUSTOM_LOGGING_CONFIG) : loggingConfig$.next({});
beforeAll(async () => {
mockConsoleLog = jest.spyOn(global.console, 'log');
root = kbnTestServer.createRoot();

setup = await root.setup();
setup.logging.configure(['plugins', 'myplugin'], loggingConfig$);
}, 30000);

beforeEach(() => {
mockConsoleLog.mockClear();
});

afterAll(async () => {
mockConsoleLog.mockRestore();
await root.shutdown();
});

it('does not write to custom appenders when not configured', async () => {
const logger = root.logger.get('plugins.myplugin.debug_pattern');
setContextConfig(false);
logger.info('log1');
setContextConfig(true);
logger.debug('log2');
logger.info('log3');
setContextConfig(false);
logger.info('log4');
expect(mockConsoleLog).toHaveBeenCalledTimes(2);
expect(mockConsoleLog).toHaveBeenCalledWith(
'CUSTOM - PATTERN [plugins.myplugin.debug_pattern][DEBUG] log2'
);
expect(mockConsoleLog).toHaveBeenCalledWith(
'CUSTOM - PATTERN [plugins.myplugin.debug_pattern][INFO ] log3'
);
});

it('writes debug_json context to custom JSON appender', async () => {
setContextConfig(true);
const logger = root.logger.get('plugins.myplugin.debug_json');
logger.debug('log1');
logger.info('log2');
expect(mockConsoleLog).toHaveBeenCalledTimes(2);

const [firstCall, secondCall] = mockConsoleLog.mock.calls.map(([jsonString]) =>
JSON.parse(jsonString)
);
expect(firstCall).toMatchObject({
level: 'DEBUG',
context: 'plugins.myplugin.debug_json',
message: 'log1',
});
expect(secondCall).toMatchObject({
level: 'INFO',
context: 'plugins.myplugin.debug_json',
message: 'log2',
});
});

it('writes info_json context to custom JSON appender', async () => {
setContextConfig(true);
const logger = root.logger.get('plugins.myplugin.info_json');
logger.debug('i should not be logged!');
logger.info('log2');

expect(mockConsoleLog).toHaveBeenCalledTimes(1);
expect(JSON.parse(mockConsoleLog.mock.calls[0][0])).toMatchObject({
level: 'INFO',
context: 'plugins.myplugin.info_json',
message: 'log2',
});
});

it('writes debug_pattern context to custom pattern appender', async () => {
setContextConfig(true);
const logger = root.logger.get('plugins.myplugin.debug_pattern');
logger.debug('log1');
logger.info('log2');

expect(mockConsoleLog).toHaveBeenCalledTimes(2);
expect(mockConsoleLog).toHaveBeenCalledWith(
'CUSTOM - PATTERN [plugins.myplugin.debug_pattern][DEBUG] log1'
);
expect(mockConsoleLog).toHaveBeenCalledWith(
'CUSTOM - PATTERN [plugins.myplugin.debug_pattern][INFO ] log2'
);
});

it('writes info_pattern context to custom pattern appender', async () => {
setContextConfig(true);
const logger = root.logger.get('plugins.myplugin.info_pattern');
logger.debug('i should not be logged!');
logger.info('log2');
expect(mockConsoleLog).toHaveBeenCalledTimes(1);
expect(mockConsoleLog).toHaveBeenCalledWith(
'CUSTOM - PATTERN [plugins.myplugin.info_pattern][INFO ] log2'
);
});

it('writes all context to both appenders', async () => {
setContextConfig(true);
const logger = root.logger.get('plugins.myplugin.all');
logger.debug('log1');
logger.info('log2');

expect(mockConsoleLog).toHaveBeenCalledTimes(4);
const logs = mockConsoleLog.mock.calls.map(([jsonString]) => jsonString);

expect(JSON.parse(logs[0])).toMatchObject({
level: 'DEBUG',
context: 'plugins.myplugin.all',
message: 'log1',
});
expect(logs[1]).toEqual('CUSTOM - PATTERN [plugins.myplugin.all][DEBUG] log1');
expect(JSON.parse(logs[2])).toMatchObject({
level: 'INFO',
context: 'plugins.myplugin.all',
message: 'log2',
});
expect(logs[3]).toEqual('CUSTOM - PATTERN [plugins.myplugin.all][INFO ] log2');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import expect from '@kbn/expect';
import { maybeTeamAssign, whichIndex } from '../ingest_helpers';
import {
TOTALS_INDEX,
RESEARCH_TOTALS_INDEX,
RESEARCH_COVERAGE_INDEX,
// COVERAGE_INDEX,
} from '../constants';

describe(`Ingest Helper fns`, () => {
describe(`whichIndex`, () => {
describe(`against the research job`, () => {
const whichIndexAgainstResearchJob = whichIndex(true);
describe(`against the totals index`, () => {
const isTotal = true;
it(`should return the Research Totals Index`, () => {
const actual = whichIndexAgainstResearchJob(isTotal);
expect(actual).to.be(RESEARCH_TOTALS_INDEX);
});
});
describe(`against the coverage index`, () => {
it(`should return the Research Totals Index`, () => {
const isTotal = false;
const actual = whichIndexAgainstResearchJob(isTotal);
expect(actual).to.be(RESEARCH_COVERAGE_INDEX);
});
});
});
describe(`against the "prod" job`, () => {
const whichIndexAgainstProdJob = whichIndex(false);
describe(`against the totals index`, () => {
const isTotal = true;
it(`should return the "Prod" Totals Index`, () => {
const actual = whichIndexAgainstProdJob(isTotal);
expect(actual).to.be(TOTALS_INDEX);
});
});
});
});
describe(`maybeTeamAssign`, () => {
describe(`against a coverage index`, () => {
it(`should have the pipeline prop`, () => {
const actual = maybeTeamAssign(true, { a: 'blah' });
expect(actual).to.have.property('pipeline');
});
});
describe(`against a totals index`, () => {
describe(`for "prod"`, () => {
it(`should not have the pipeline prop`, () => {
const actual = maybeTeamAssign(false, { b: 'blah' });
expect(actual).not.to.have.property('pipeline');
});
});
});
});
});
38 changes: 27 additions & 11 deletions src/dev/code_coverage/ingest_coverage/__tests__/transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,33 @@ describe(`Transform fn`, () => {
});
});
describe(`coveredFilePath`, () => {
it(`should remove the jenkins workspace path`, () => {
const obj = {
staticSiteUrl:
'/var/lib/jenkins/workspace/elastic+kibana+code-coverage/kibana/x-pack/plugins/reporting/server/browsers/extract/unzip.js',
COVERAGE_INGESTION_KIBANA_ROOT:
'/var/lib/jenkins/workspace/elastic+kibana+code-coverage/kibana',
};
expect(coveredFilePath(obj)).to.have.property(
'coveredFilePath',
'x-pack/plugins/reporting/server/browsers/extract/unzip.js'
);
describe(`in the code-coverage job`, () => {
it(`should remove the jenkins workspace path`, () => {
const obj = {
staticSiteUrl:
'/var/lib/jenkins/workspace/elastic+kibana+code-coverage/kibana/x-pack/plugins/reporting/server/browsers/extract/unzip.js',
COVERAGE_INGESTION_KIBANA_ROOT:
'/var/lib/jenkins/workspace/elastic+kibana+code-coverage/kibana',
};
expect(coveredFilePath(obj)).to.have.property(
'coveredFilePath',
'x-pack/plugins/reporting/server/browsers/extract/unzip.js'
);
});
});
describe(`in the qa research job`, () => {
it(`should remove the jenkins workspace path`, () => {
const obj = {
staticSiteUrl:
'/var/lib/jenkins/workspace/elastic+kibana+qa-research/kibana/x-pack/plugins/reporting/server/browsers/extract/unzip.js',
COVERAGE_INGESTION_KIBANA_ROOT:
'/var/lib/jenkins/workspace/elastic+kibana+qa-research/kibana',
};
expect(coveredFilePath(obj)).to.have.property(
'coveredFilePath',
'x-pack/plugins/reporting/server/browsers/extract/unzip.js'
);
});
});
});
describe(`itemizeVcs`, () => {
Expand Down
13 changes: 13 additions & 0 deletions src/dev/code_coverage/ingest_coverage/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@
*/

export const COVERAGE_INDEX = process.env.COVERAGE_INDEX || 'kibana_code_coverage';

export const TOTALS_INDEX = process.env.TOTALS_INDEX || `kibana_total_code_coverage`;

export const RESEARCH_COVERAGE_INDEX =
process.env.RESEARCH_COVERAGE_INDEX || 'qa_research_code_coverage';

export const RESEARCH_TOTALS_INDEX =
process.env.RESEARCH_TOTALS_INDEX || `qa_research_total_code_coverage`;

export const TEAM_ASSIGNMENT_PIPELINE_NAME = process.env.PIPELINE_NAME || 'team_assignment';

export const CODE_COVERAGE_CI_JOB_NAME = 'elastic+kibana+code-coverage';
export const RESEARCH_CI_JOB_NAME = 'elastic+kibana+qa-research';
export const CI_JOB_NAME = process.env.COVERAGE_JOB_NAME || RESEARCH_CI_JOB_NAME;
Loading

0 comments on commit 21953cc

Please sign in to comment.