Skip to content

Commit

Permalink
Merge branch 'master' into lens/field-list-error-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jul 6, 2020
2 parents 3b5ef08 + 564e91f commit dab58e6
Show file tree
Hide file tree
Showing 104 changed files with 2,670 additions and 666 deletions.
1 change: 1 addition & 0 deletions .ci/end2end.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pipeline {
HOME = "${env.WORKSPACE}"
E2E_DIR = 'x-pack/plugins/apm/e2e'
PIPELINE_LOG_LEVEL = 'DEBUG'
KBN_OPTIMIZER_THEMES = 'v7light'
}
options {
timeout(time: 1, unit: 'HOURS')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/register": "^7.10.1",
"@elastic/apm-rum": "^5.2.0",
"@elastic/charts": "19.6.3",
"@elastic/charts": "19.7.0",
"@elastic/datemath": "5.0.3",
"@elastic/ems-client": "7.9.3",
"@elastic/eui": "24.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ afterAll(async () => {
await del(TMP_DIR);
});

it('builds expected bundles, saves bundle counts to metadata', async () => {
// FLAKY: https://github.com/elastic/kibana/issues/70762
it.skip('builds expected bundles, saves bundle counts to metadata', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
Expand Down Expand Up @@ -167,7 +168,8 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
`);
});

it('uses cache on second run and exist cleanly', async () => {
// FLAKY: https://github.com/elastic/kibana/issues/70764
it.skip('uses cache on second run and exist cleanly', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@elastic/charts": "19.6.3",
"@elastic/charts": "19.7.0",
"@elastic/eui": "24.1.0",
"@elastic/numeral": "^2.5.0",
"@kbn/i18n": "1.0.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface TutorialSchema {
name: string;
isBeta?: boolean;
shortDescription: string;
euiIconType?: IconType; // EUI icon type string, one of https://elastic.github.io/eui/#/icon;
euiIconType?: IconType; // EUI icon type string, one of https://elastic.github.io/eui/#/display/icons;
longDescription: string;
completionTimeMinutes?: number;
previewImagePath?: string;
Expand Down
77 changes: 77 additions & 0 deletions src/plugins/home/server/tutorials/googlecloud_metrics/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* 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 { i18n } from '@kbn/i18n';
import { TutorialsCategory } from '../../services/tutorials';
import {
onPremInstructions,
cloudInstructions,
onPremCloudInstructions,
} from '../instructions/metricbeat_instructions';
import {
TutorialContext,
TutorialSchema,
} from '../../services/tutorials/lib/tutorials_registry_types';

export function googlecloudMetricsSpecProvider(context: TutorialContext): TutorialSchema {
const moduleName = 'googlecloud';
return {
id: 'googlecloudMetrics',
name: i18n.translate('home.tutorials.googlecloudMetrics.nameTitle', {
defaultMessage: 'Google Cloud metrics',
}),
category: TutorialsCategory.METRICS,
shortDescription: i18n.translate('home.tutorials.googlecloudMetrics.shortDescription', {
defaultMessage:
'Fetch monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API.',
}),
longDescription: i18n.translate('home.tutorials.googlecloudMetrics.longDescription', {
defaultMessage:
'The `googlecloud` Metricbeat module fetches monitoring metrics from Google Cloud Platform using Stackdriver Monitoring API. \
[Learn more]({learnMoreLink}).',
values: {
learnMoreLink: '{config.docs.beats.metricbeat}/metricbeat-module-googlecloud.html',
},
}),
euiIconType: 'logoGCP',
isBeta: false,
artifacts: {
dashboards: [
{
id: 'f40ee870-5e4a-11ea-a4f6-717338406083',
linkLabel: i18n.translate(
'home.tutorials.googlecloudMetrics.artifacts.dashboards.linkLabel',
{
defaultMessage: 'Google Cloud metrics dashboard',
}
),
isOverview: true,
},
],
exportedFields: {
documentationUrl: '{config.docs.beats.metricbeat}/exported-fields-googlecloud.html',
},
},
completionTimeMinutes: 10,
previewImagePath: '/plugins/home/assets/googlecloud_metrics/screenshot.png',
onPrem: onPremInstructions(moduleName, context),
elasticCloud: cloudInstructions(moduleName),
onPremElasticCloud: onPremCloudInstructions(moduleName),
};
}
2 changes: 2 additions & 0 deletions src/plugins/home/server/tutorials/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ import { openmetricsMetricsSpecProvider } from './openmetrics_metrics';
import { oracleMetricsSpecProvider } from './oracle_metrics';
import { iisMetricsSpecProvider } from './iis_metrics';
import { azureLogsSpecProvider } from './azure_logs';
import { googlecloudMetricsSpecProvider } from './googlecloud_metrics';

export const builtInTutorials = [
systemLogsSpecProvider,
Expand Down Expand Up @@ -168,4 +169,5 @@ export const builtInTutorials = [
oracleMetricsSpecProvider,
iisMetricsSpecProvider,
azureLogsSpecProvider,
googlecloudMetricsSpecProvider,
];
1 change: 1 addition & 0 deletions test/functional/apps/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default function ({ getService, loadTestFile }) {
after(unloadCurrentData);

loadTestFile(require.resolve('./empty_dashboard'));
loadTestFile(require.resolve('./url_field_formatter'));
loadTestFile(require.resolve('./embeddable_rendering'));
loadTestFile(require.resolve('./create_and_add_embeddables'));
loadTestFile(require.resolve('./edit_embeddable_redirects'));
Expand Down
91 changes: 91 additions & 0 deletions test/functional/apps/dashboard/url_field_formatter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* 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 { WebElementWrapper } from 'test/functional/services/lib/web_element_wrapper';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const { common, dashboard, settings, timePicker, visChart } = getPageObjects([
'common',
'dashboard',
'settings',
'timePicker',
'visChart',
]);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const browser = getService('browser');
const fieldName = 'clientip';

const clickFieldAndCheckUrl = async (fieldLink: WebElementWrapper) => {
const fieldValue = await fieldLink.getVisibleText();
await fieldLink.click();
const windowHandlers = await browser.getAllWindowHandles();
expect(windowHandlers.length).to.equal(2);
await browser.switchToWindow(windowHandlers[1]);
const currentUrl = await browser.getCurrentUrl();
const fieldUrl = common.getHostPort() + '/app/' + fieldValue;
expect(currentUrl).to.equal(fieldUrl);
};

describe('Changing field formatter to Url', () => {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await common.navigateToApp('settings');
await settings.clickKibanaIndexPatterns();
await settings.clickIndexPatternLogstash();
await settings.filterField(fieldName);
await settings.openControlsByName(fieldName);
await settings.setFieldFormat('url');
await settings.controlChangeSave();
});

it('applied on dashboard', async () => {
await common.navigateToApp('dashboard');
await dashboard.loadSavedDashboard('dashboard with everything');
await dashboard.waitForRenderComplete();
const fieldLink = await visChart.getFieldLinkInVisTable(`${fieldName}: Descending`, 1);
await clickFieldAndCheckUrl(fieldLink);
});

it('applied on discover', async () => {
await common.navigateToApp('discover');
await timePicker.setAbsoluteRange(
'Sep 19, 2017 @ 06:31:44.000',
'Sep 23, 2018 @ 18:31:44.000'
);
await testSubjects.click('docTableExpandToggleColumn');
const fieldLink = await testSubjects.find(`tableDocViewRow-${fieldName}-value`);
await clickFieldAndCheckUrl(fieldLink);
});

afterEach(async function () {
const windowHandlers = await browser.getAllWindowHandles();
if (windowHandlers.length > 1) {
await browser.closeCurrentWindow();
await browser.switchToWindow(windowHandlers[0]);
}
});
});
}
14 changes: 14 additions & 0 deletions test/functional/page_objects/visualize_chart_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ export function VisualizeChartPageProvider({ getService, getPageObjects }: FtrPr
return element.getVisibleText();
}

public async getFieldLinkInVisTable(fieldName: string, rowIndex: number = 1) {
const tableVis = await testSubjects.find('tableVis');
const $ = await tableVis.parseDomContent();
const headers = $('span[ng-bind="::col.title"]')
.toArray()
.map((header: any) => $(header).text());
const fieldColumnIndex = headers.indexOf(fieldName);
return await find.byCssSelector(
`[data-test-subj="paginated-table-body"] tr:nth-of-type(${rowIndex}) td:nth-of-type(${
fieldColumnIndex + 1
}) a`
);
}

/**
* If you are writing new tests, you should rather look into getTableVisContent method instead.
* @deprecated Use getTableVisContent instead.
Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/infra/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const DEFAULT_SOURCE_ID = 'default';
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './log_entry_categories';
export * from './log_entry_category_datasets';
export * from './log_entry_category_examples';
export * from './log_entry_rate';
export * from './log_entry_rate_examples';
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ export type GetLogEntryRateRequestPayload = rt.TypeOf<typeof getLogEntryRateRequ
*/

export const logEntryRateAnomalyRT = rt.type({
id: rt.string,
actualLogEntryRate: rt.number,
anomalyScore: rt.number,
duration: rt.number,
startTime: rt.number,
typicalLogEntryRate: rt.number,
});

export type LogEntryRateAnomaly = rt.TypeOf<typeof logEntryRateAnomalyRT>;

export const logEntryRatePartitionRT = rt.type({
analysisBucketCount: rt.number,
anomalies: rt.array(logEntryRateAnomalyRT),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import * as rt from 'io-ts';

import {
badRequestErrorRT,
forbiddenErrorRT,
timeRangeRT,
routeTimingMetadataRT,
} from '../../shared';

export const LOG_ANALYSIS_GET_LOG_ENTRY_RATE_EXAMPLES_PATH =
'/api/infra/log_analysis/results/log_entry_rate_examples';

/**
* request
*/

export const getLogEntryRateExamplesRequestPayloadRT = rt.type({
data: rt.type({
// the dataset to fetch the log rate examples from
dataset: rt.string,
// the number of examples to fetch
exampleCount: rt.number,
// the id of the source configuration
sourceId: rt.string,
// the time range to fetch the log rate examples from
timeRange: timeRangeRT,
}),
});

export type GetLogEntryRateExamplesRequestPayload = rt.TypeOf<
typeof getLogEntryRateExamplesRequestPayloadRT
>;

/**
* response
*/

const logEntryRateExampleRT = rt.type({
id: rt.string,
dataset: rt.string,
message: rt.string,
timestamp: rt.number,
tiebreaker: rt.number,
});

export type LogEntryRateExample = rt.TypeOf<typeof logEntryRateExampleRT>;

export const getLogEntryRateExamplesSuccessReponsePayloadRT = rt.intersection([
rt.type({
data: rt.type({
examples: rt.array(logEntryRateExampleRT),
}),
}),
rt.partial({
timing: routeTimingMetadataRT,
}),
]);

export type GetLogEntryRateExamplesSuccessReponsePayload = rt.TypeOf<
typeof getLogEntryRateExamplesSuccessReponsePayloadRT
>;

export const getLogEntryRateExamplesResponsePayloadRT = rt.union([
getLogEntryRateExamplesSuccessReponsePayloadRT,
badRequestErrorRT,
forbiddenErrorRT,
]);

export type GetLogEntryRateExamplesResponsePayload = rt.TypeOf<
typeof getLogEntryRateExamplesResponsePayloadRT
>;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
formatAnomalyScore,
getSeverityCategoryForScore,
ML_SEVERITY_COLORS,
} from '../../../../../../common/log_analysis';
} from '../../../../common/log_analysis';

export const AnomalySeverityIndicator: React.FunctionComponent<{
anomalyScore: number;
Expand Down
Loading

0 comments on commit dab58e6

Please sign in to comment.