Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into threshold-mul…
Browse files Browse the repository at this point in the history
…tiple-aggs
  • Loading branch information
madirey committed Feb 18, 2021
2 parents db6dfa5 + 2bb2629 commit 9ba09b6
Show file tree
Hide file tree
Showing 56 changed files with 923 additions and 632 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ readonly links: {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
Expand Down

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/user/introduction.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,20 @@ No matter your data, {kib} can help you uncover patterns and relationships and v
[[kibana-home-page]]
=== Where to start

Start with the home page, where you’re guided toward the most common use cases.
For a quick reference of {kib} use cases, refer to <<whats-the-right-app,What’s the right app for you?>>
Start with the home page, where you’re presented options for adding your data.
You can collect data from an app or service or upload a file that contains your data.
If you’re not ready to use your own data, you can add a sample data set.

The home page provides access to the *Enterprise Search*, *Observability*, and *Security* solutions,
and everything you need to visualize and analyze your data.

[role="screenshot"]
image::images/home-page.png[Kibana home page]

The main menu gets you to where you need to go. Like the home page,
the menu is organized by use case. Want to work with your logs, metrics, APM, or
Uptime data? The apps you need are under *Observability*. The main menu also includes
*Recently viewed*, so you can easily access your previously opened apps.

Hidden by default, you open the main menu by clicking the
hamburger icon. To keep the main menu visible at all times, click the *Dock navigation* item.
To access all of {kib} features, use the main menu.
Open this menu by clicking the
menu icon. To keep the main menu visible at all times, click *Dock navigation*.
For a quick reference of all {kib} features, refer to <<whats-the-right-app,What’s the right app for you?>>

[role="screenshot"]
image::images/kibana-main-menu.png[Kibana main menu]
Expand Down Expand Up @@ -91,8 +92,7 @@ image::images/visualization-journey.png[User data analysis journey]

| *1*
| *Add data.* The best way to add {es} data to {kib} is to use one of our guided processes,
available from the <<kibana-home-page,home page>>. You can collect data from an app or service, upload a
file, or add a sample data set.
available from the <<kibana-home-page,home page>>.

| *2*
| *Explore.* With <<discover,*Discover*>>, you can search your data for hidden
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@
"babel-plugin-require-context-hook": "^1.0.0",
"babel-plugin-styled-components": "^1.10.7",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"backport": "^5.6.4",
"backport": "^5.6.6",
"base64-js": "^1.3.1",
"base64url": "^3.0.1",
"broadcast-channel": "^3.0.3",
Expand Down
4 changes: 4 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export class DocLinksService {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/winlogbeat/${DOC_LINK_VERSION}`,
},
aggs: {
composite: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-composite-aggregation.html`,
composite_missing_bucket: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-composite-aggregation.html#_missing_bucket`,
date_histogram: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-datehistogram-aggregation.html`,
date_range: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-daterange-aggregation.html`,
date_format_pattern: `${ELASTICSEARCH_DOCS}search-aggregations-bucket-daterange-aggregation.html#date-format-pattern`,
Expand Down Expand Up @@ -301,6 +303,8 @@ export interface DocLinksStart {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
Expand Down
2 changes: 2 additions & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ export interface DocLinksStart {
readonly base: string;
};
readonly aggs: {
readonly composite: string;
readonly composite_missing_bucket: string;
readonly date_histogram: string;
readonly date_range: string;
readonly date_format_pattern: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ import {
} from '@elastic/charts';
import { EuiIcon } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import moment from 'moment';
import React from 'react';
import { useHistory } from 'react-router-dom';
import { useChartTheme } from '../../../../../observability/public';
import { asAbsoluteDateTime } from '../../../../common/utils/formatters';
import { RectCoordinate, TimeSeries } from '../../../../typings/timeseries';
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import { useTheme } from '../../../hooks/use_theme';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
import { useAnnotationsContext } from '../../../context/annotations/use_annotations_context';
import { useChartPointerEventContext } from '../../../context/chart_pointer_event/use_chart_pointer_event_context';
import { unit } from '../../../style/variables';
Expand Down Expand Up @@ -78,14 +76,13 @@ export function TimeseriesChart({
const history = useHistory();
const { annotations } = useAnnotationsContext();
const { setPointerEvent, chartRef } = useChartPointerEventContext();
const { urlParams } = useUrlParams();
const theme = useTheme();
const chartTheme = useChartTheme();

const { start, end } = urlParams;
const xValues = timeseries.flatMap(({ data }) => data.map(({ x }) => x));

const min = moment.utc(start).valueOf();
const max = moment.utc(end).valueOf();
const min = Math.min(...xValues);
const max = Math.max(...xValues);

const xFormatter = niceTimeFormatter([min, max]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@ describe('url_params_context helpers', () => {
describe('getDateRange', () => {
describe('with non-rounded dates', () => {
describe('one minute', () => {
it('rounds the values', () => {
it('rounds the start value to minute', () => {
expect(
helpers.getDateRange({
state: {},
rangeFrom: '2021-01-28T05:47:52.134Z',
rangeTo: '2021-01-28T05:48:55.304Z',
})
).toEqual({
start: '2021-01-28T05:47:50.000Z',
end: '2021-01-28T05:49:00.000Z',
start: '2021-01-28T05:47:00.000Z',
end: '2021-01-28T05:48:55.304Z',
});
});
});
describe('one day', () => {
it('rounds the values', () => {
it('rounds the start value to minute', () => {
expect(
helpers.getDateRange({
state: {},
rangeFrom: '2021-01-27T05:46:07.377Z',
rangeTo: '2021-01-28T05:46:13.367Z',
})
).toEqual({
start: '2021-01-27T03:00:00.000Z',
end: '2021-01-28T06:00:00.000Z',
start: '2021-01-27T05:46:00.000Z',
end: '2021-01-28T05:46:13.367Z',
});
});
});

describe('one year', () => {
it('rounds the values', () => {
it('rounds the start value to minute', () => {
expect(
helpers.getDateRange({
state: {},
rangeFrom: '2020-01-28T05:52:36.290Z',
rangeTo: '2021-01-28T05:52:39.741Z',
})
).toEqual({
start: '2020-01-01T00:00:00.000Z',
end: '2021-02-01T00:00:00.000Z',
start: '2020-01-28T05:52:00.000Z',
end: '2021-01-28T05:52:39.741Z',
});
});
});
Expand Down
11 changes: 5 additions & 6 deletions x-pack/plugins/apm/public/context/url_params_context/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import datemath from '@elastic/datemath';
import { scaleUtc } from 'd3-scale';
import { compact, pickBy } from 'lodash';
import moment from 'moment';
import { IUrlParams } from './types';

function getParsedDate(rawDate?: string, options = {}) {
Expand Down Expand Up @@ -42,13 +42,12 @@ export function getDateRange({
return { start: state.start, end: state.end };
}

// Calculate ticks for the time ranges to produce nicely rounded values.
const ticks = scaleUtc().domain([start, end]).nice().ticks();
// rounds down start to minute
const roundedStart = moment(start).startOf('minute');

// Return the first and last tick values.
return {
start: ticks[0].toISOString(),
end: ticks[ticks.length - 1].toISOString(),
start: roundedStart.toISOString(),
end: end.toISOString(),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe('UrlParamsContext', () => {
const params = getDataFromOutput(wrapper);

expect([params.start, params.end]).toEqual([
'2010-03-15T00:00:00.000Z',
'2010-04-11T00:00:00.000Z',
'2010-03-15T12:00:00.000Z',
'2010-04-10T12:00:00.000Z',
]);
});

Expand All @@ -71,8 +71,8 @@ describe('UrlParamsContext', () => {
const params = getDataFromOutput(wrapper);

expect([params.start, params.end]).toEqual([
'2009-03-15T00:00:00.000Z',
'2009-04-11T00:00:00.000Z',
'2009-03-15T12:00:00.000Z',
'2009-04-10T12:00:00.000Z',
]);
});

Expand All @@ -92,7 +92,7 @@ describe('UrlParamsContext', () => {

expect([params.start, params.end]).toEqual([
'1969-12-31T00:00:00.000Z',
'1970-01-01T00:00:00.000Z',
'1969-12-31T23:59:59.999Z',
]);

nowSpy.mockRestore();
Expand Down Expand Up @@ -145,8 +145,8 @@ describe('UrlParamsContext', () => {
const params = getDataFromOutput(wrapper);

expect([params.start, params.end]).toEqual([
'2005-09-19T00:00:00.000Z',
'2005-10-23T00:00:00.000Z',
'2005-09-20T12:00:00.000Z',
'2005-10-21T12:00:00.000Z',
]);
});

Expand Down Expand Up @@ -196,7 +196,7 @@ describe('UrlParamsContext', () => {

expect([params.start, params.end]).toEqual([
'2000-06-14T00:00:00.000Z',
'2000-06-15T00:00:00.000Z',
'2000-06-14T23:59:59.999Z',
]);
});
});
5 changes: 5 additions & 0 deletions x-pack/plugins/monitoring/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,11 @@ export const ALERT_ACTION_TYPE_EMAIL = '.email';
*/
export const ALERT_ACTION_TYPE_LOG = '.server-log';

/**
* To enable modifing of alerts in under actions
*/
export const ALERT_REQUIRES_APP_CONTEXT = false;

export const ALERT_EMAIL_SERVICES = ['gmail', 'hotmail', 'icloud', 'outlook365', 'ses', 'yahoo'];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import React from 'react';
import { i18n } from '@kbn/i18n';
import { Expression, Props } from '../components/param_details_form/expression';
import { AlertTypeModel, ValidationResult } from '../../../../triggers_actions_ui/public';
import { ALERT_CCR_READ_EXCEPTIONS, ALERT_DETAILS } from '../../../common/constants';
import {
ALERT_CCR_READ_EXCEPTIONS,
ALERT_DETAILS,
ALERT_REQUIRES_APP_CONTEXT,
} from '../../../common/constants';
import { AlertTypeParams } from '../../../../alerts/common';

interface ValidateOptions extends AlertTypeParams {
Expand Down Expand Up @@ -45,6 +49,6 @@ export function createCCRReadExceptionsAlertType(): AlertTypeModel<ValidateOptio
),
validate,
defaultActionMessage: '{{context.internalFullMessage}}',
requiresAppContext: true,
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import React from 'react';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
import { ALERT_CPU_USAGE, ALERT_DETAILS } from '../../../common/constants';
import {
ALERT_CPU_USAGE,
ALERT_DETAILS,
ALERT_REQUIRES_APP_CONTEXT,
} from '../../../common/constants';
import { validate, MonitoringAlertTypeParams } from '../components/param_details_form/validation';
import { Expression, Props } from '../components/param_details_form/expression';

Expand All @@ -25,6 +29,6 @@ export function createCpuUsageAlertType(): AlertTypeModel<MonitoringAlertTypePar
),
validate,
defaultActionMessage: '{{context.internalFullMessage}}',
requiresAppContext: true,
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import { Expression, Props } from '../components/param_details_form/expression';

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
import { ALERT_DISK_USAGE, ALERT_DETAILS } from '../../../common/constants';
import {
ALERT_DISK_USAGE,
ALERT_DETAILS,
ALERT_REQUIRES_APP_CONTEXT,
} from '../../../common/constants';

export function createDiskUsageAlertType(): AlertTypeModel<MonitoringAlertTypeParams> {
return {
Expand All @@ -26,6 +30,6 @@ export function createDiskUsageAlertType(): AlertTypeModel<MonitoringAlertTypePa
),
validate,
defaultActionMessage: '{{context.internalFullMessage}}',
requiresAppContext: true,
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import React from 'react';
import { i18n } from '@kbn/i18n';
import { Expression, Props } from '../components/param_details_form/expression';
import { AlertTypeModel, ValidationResult } from '../../../../triggers_actions_ui/public';
import { ALERT_LARGE_SHARD_SIZE, ALERT_DETAILS } from '../../../common/constants';
import {
ALERT_LARGE_SHARD_SIZE,
ALERT_DETAILS,
ALERT_REQUIRES_APP_CONTEXT,
} from '../../../common/constants';
import { AlertTypeParams } from '../../../../alerts/common';

interface ValidateOptions extends AlertTypeParams {
Expand Down Expand Up @@ -45,6 +49,6 @@ export function createLargeShardSizeAlertType(): AlertTypeModel<ValidateOptions>
),
validate,
defaultActionMessage: '{{context.internalFullMessage}}',
requiresAppContext: true,
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { i18n } from '@kbn/i18n';
import { EuiTextColor, EuiSpacer } from '@elastic/eui';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
import { LEGACY_ALERTS, LEGACY_ALERT_DETAILS } from '../../../common/constants';
import {
LEGACY_ALERTS,
LEGACY_ALERT_DETAILS,
ALERT_REQUIRES_APP_CONTEXT,
} from '../../../common/constants';

export function createLegacyAlertTypes(): AlertTypeModel[] {
return LEGACY_ALERTS.map((legacyAlert) => {
Expand All @@ -34,7 +38,7 @@ export function createLegacyAlertTypes(): AlertTypeModel[] {
),
defaultActionMessage: '{{context.internalFullMessage}}',
validate: () => ({ errors: {} }),
requiresAppContext: true,
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
};
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import { Expression, Props } from '../components/param_details_form/expression';

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types';
import { ALERT_MEMORY_USAGE, ALERT_DETAILS } from '../../../common/constants';
import {
ALERT_MEMORY_USAGE,
ALERT_DETAILS,
ALERT_REQUIRES_APP_CONTEXT,
} from '../../../common/constants';

export function createMemoryUsageAlertType(): AlertTypeModel<MonitoringAlertTypeParams> {
return {
Expand All @@ -26,6 +30,6 @@ export function createMemoryUsageAlertType(): AlertTypeModel<MonitoringAlertType
),
validate,
defaultActionMessage: '{{context.internalFullMessage}}',
requiresAppContext: true,
requiresAppContext: ALERT_REQUIRES_APP_CONTEXT,
};
}
Loading

0 comments on commit 9ba09b6

Please sign in to comment.