{readOnlyMode && ( <> diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/account_settings_sidebar.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/account_settings_sidebar.tsx index 490f3ff0ae4a5..8ab654aaebf60 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/account_settings_sidebar.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/account_settings_sidebar.tsx @@ -12,6 +12,10 @@ import { ViewContentHeader } from '../../shared/view_content_header'; export const AccountSettingsSidebar = () => { return ( - + ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/private_sources_sidebar.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/private_sources_sidebar.tsx index 3f6863175e29b..ac497f5ae3a28 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/private_sources_sidebar.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/personal_dashboard_sidebar/private_sources_sidebar.tsx @@ -42,7 +42,7 @@ export const PrivateSourcesSidebar = () => { return ( <> - + {id && } ); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.test.tsx index d37af01287c46..9301ebb85582f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.test.tsx @@ -31,10 +31,20 @@ describe('ContentSection', () => { it('displays title and description', () => { const wrapper = shallow(); + const header = wrapper.find(ViewContentHeader); - expect(wrapper.find(ViewContentHeader)).toHaveLength(1); - expect(wrapper.find(ViewContentHeader).prop('title')).toEqual('foo'); - expect(wrapper.find(ViewContentHeader).prop('description')).toEqual('bar'); + expect(header.prop('title')).toEqual('foo'); + expect(header.prop('description')).toEqual('bar'); + expect(header.prop('headingLevel')).toEqual(3); + }); + + it('sets heading level for personal dashboard', () => { + const wrapper = shallow( + + ); + const header = wrapper.find(ViewContentHeader); + + expect(header.prop('headingLevel')).toEqual(2); }); it('displays header content', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.tsx index f0b86e0cc925b..79cb82817e2bc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/content_section/content_section.tsx @@ -14,6 +14,7 @@ import { ViewContentHeader } from '../view_content_header'; interface ContentSectionProps { children: React.ReactNode; + isOrganization?: boolean; className?: string; title?: React.ReactNode; description?: React.ReactNode; @@ -25,6 +26,7 @@ interface ContentSectionProps { export const ContentSection: React.FC = ({ children, + isOrganization = true, className = '', title, description, @@ -35,7 +37,13 @@ export const ContentSection: React.FC = ({
{title && ( <> - + {headerChildren} )} diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.test.tsx index 6deb37d850076..97abb3929f985 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.test.tsx @@ -17,7 +17,6 @@ describe('LicenseBadge', () => { it('renders', () => { const wrapper = shallow(); - expect(wrapper.find(EuiBadge)).toHaveLength(1); - expect(wrapper.find('span').text()).toEqual('Platinum Feature'); + expect(wrapper.find(EuiBadge).prop('children')).toEqual('Platinum feature'); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.tsx index 37211d8cad43e..3d286c8da005b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/license_badge/license_badge.tsx @@ -9,12 +9,6 @@ import React from 'react'; import { EuiBadge } from '@elastic/eui'; -import './license_badge.scss'; +import { PLATINUM_FEATURE } from '../../../constants'; -const licenseColor = '#00A7B1'; - -export const LicenseBadge: React.FC = () => ( - - Platinum Feature - -); +export const LicenseBadge: React.FC = () => {PLATINUM_FEATURE}; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx index 34d6c2401b300..2d5ffe183632a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx @@ -21,5 +21,10 @@ interface SourceIconProps { } export const SourceIcon: React.FC = ({ name, serviceType, className, size }) => ( - + ); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.test.tsx index f54f7ccdf24bd..63ca5e8153d41 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.test.tsx @@ -11,9 +11,8 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { EuiTable } from '@elastic/eui'; +import { EuiTable, EuiTableHeaderCell } from '@elastic/eui'; -import { TableHeader } from '../../../../shared/table_header/table_header'; import { SourceRow } from '../source_row'; import { SourcesTable } from './'; @@ -25,14 +24,15 @@ describe('SourcesTable', () => { const wrapper = shallow(); expect(wrapper.find(EuiTable)).toHaveLength(1); + expect(wrapper.find(EuiTableHeaderCell)).toHaveLength(3); expect(wrapper.find(SourceRow)).toHaveLength(2); }); it('renders "Searchable" header item when toggle fn present', () => { const wrapper = shallow( - + ); - expect(wrapper.find(TableHeader).prop('headerItems')).toContain('Searchable'); + expect(wrapper.find(EuiTableHeaderCell)).toHaveLength(5); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.tsx index 9bc3d6ec2f1f4..8081dbff5b3fe 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/sources_table/sources_table.tsx @@ -7,10 +7,12 @@ import React from 'react'; -import { EuiTable, EuiTableBody } from '@elastic/eui'; +import { EuiTable, EuiTableBody, EuiTableHeader, EuiTableHeaderCell } from '@elastic/eui'; -import { TableHeader } from '../../../../shared/table_header/table_header'; +import { ACTIONS_HEADER } from '../../../../shared/constants'; +import { SOURCE, DOCUMENTS_HEADER, SEARCHABLE_HEADER } from '../../../constants'; import { ContentSourceDetails } from '../../../types'; +import { STATUS_HEADER } from '../../../views/content_sources/constants'; import { SourceRow, ISourceRow } from '../source_row'; interface SourcesTableProps extends ISourceRow { @@ -23,12 +25,15 @@ export const SourcesTable: React.FC = ({ isOrganization, onSearchableToggle, }) => { - const headerItems = ['Source', 'Status', 'Documents']; - if (onSearchableToggle) headerItems.push('Searchable'); - return ( - + + {SOURCE} + {STATUS_HEADER} + {DOCUMENTS_HEADER} + {onSearchableToggle && {SEARCHABLE_HEADER}} + {isOrganization && {ACTIONS_HEADER}} + {sources.map((source) => ( { it('renders with title and alignItems', () => { const wrapper = shallow(); - expect(wrapper.find('h3').text()).toEqual('Header'); + expect(wrapper.find('h2').text()).toEqual('Header'); expect(wrapper.find(EuiFlexGroup).prop('alignItems')).toEqual('flexStart'); }); @@ -39,19 +39,29 @@ describe('ViewContentHeader', () => { expect(wrapper.find('.action')).toHaveLength(1); }); - it('renders small heading', () => { + it('renders h1 heading', () => { const wrapper = shallow( - } /> + } + /> ); - expect(wrapper.find('h4')).toHaveLength(1); + expect(wrapper.find('h1')).toHaveLength(1); }); - it('renders large heading', () => { + it('renders h3 heading', () => { const wrapper = shallow( - } /> + } + /> ); - expect(wrapper.find('h2')).toHaveLength(1); + expect(wrapper.find('h3')).toHaveLength(1); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/view_content_header/view_content_header.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/view_content_header/view_content_header.tsx index fa3a1d3ccb2e4..d8361a115d883 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/view_content_header/view_content_header.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/view_content_header/view_content_header.tsx @@ -13,6 +13,7 @@ import { FlexGroupAlignItems } from '@elastic/eui/src/components/flex/flex_group interface ViewContentHeaderProps { title: React.ReactNode; description?: React.ReactNode; + headingLevel?: 1 | 2 | 3; action?: React.ReactNode; alignItems?: FlexGroupAlignItems; titleSize?: 's' | 'm' | 'l'; @@ -21,24 +22,24 @@ interface ViewContentHeaderProps { export const ViewContentHeader: React.FC = ({ title, titleSize = 'm', + headingLevel = 2, description, action, alignItems = 'center', }) => { let titleElement; - switch (titleSize) { - case 's': - titleElement =

{title}

; + switch (headingLevel) { + case 1: + titleElement =

{title}

; break; - case 'l': + case 2: titleElement =

{title}

; break; default: titleElement =

{title}

; break; } - return ( <> diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts index 0e56ee8f67241..d4fa2059f62fb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts @@ -805,3 +805,24 @@ export const STATUS_POPOVER_TOOLTIP = i18n.translate( defaultMessage: 'Click to view info', } ); + +export const DOCUMENTS_HEADER = i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.documentsHeader', + { + defaultMessage: 'Documents', + } +); + +export const SEARCHABLE_HEADER = i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.searchableHeader', + { + defaultMessage: 'Searchable', + } +); + +export const PLATINUM_FEATURE = i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.platinumFeature', + { + defaultMessage: 'Platinum feature', + } +); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_header.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_header.tsx index a4910f3a68ea2..64f297ae4bdbb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_header.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/add_source_header.tsx @@ -9,7 +9,14 @@ import React from 'react'; import { startCase } from 'lodash'; -import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText, EuiTextColor } from '@elastic/eui'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiSpacer, + EuiText, + EuiTitle, + EuiTextColor, +} from '@elastic/eui'; import { SourceIcon } from '../../../../components/shared/source_icon'; @@ -42,11 +49,11 @@ export const AddSourceHeader: React.FC = ({ /> - -

+ +

{name} -

- +

+ {categories.map((category) => startCase(category)).join(', ')} diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.test.tsx index 2ebc021925abf..b3ce53a0321dc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.test.tsx @@ -25,7 +25,7 @@ describe('ConfigurationIntro', () => { const wrapper = shallow(); expect(wrapper.find('[data-test-subj="ConfigureStepButton"]')).toHaveLength(1); - expect(wrapper.find(EuiText)).toHaveLength(5); - expect(wrapper.find(EuiTitle)).toHaveLength(1); + expect(wrapper.find(EuiText)).toHaveLength(3); + expect(wrapper.find(EuiTitle)).toHaveLength(3); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.tsx index 23bd34cfeb944..d17e8b84efb2b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configuration_intro.tsx @@ -96,9 +96,9 @@ export const ConfigurationIntro: React.FC = ({ >
- -

{CONFIG_INTRO_STEP1_HEADING}

-
+ +

{CONFIG_INTRO_STEP1_HEADING}

+
@@ -125,9 +125,9 @@ export const ConfigurationIntro: React.FC = ({ >
- +

{CONFIG_INTRO_STEP2_HEADING}

-
+
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configured_sources_list.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configured_sources_list.tsx index 6da09acf45cbe..b5b22afec39b1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configured_sources_list.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/configured_sources_list.tsx @@ -122,7 +122,7 @@ export const ConfiguredSourcesList: React.FC = ({ return ( <> -

{CONFIGURED_SOURCES_TITLE}

+

{CONFIGURED_SOURCES_TITLE}

{CONFIGURED_SOURCES_EMPTY_BODY}

diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.tsx index e3b34050593fa..d8b5a9eedbaa7 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/connect_instance.tsx @@ -67,8 +67,6 @@ export const ConnectInstance: React.FC = ({ objTypes, name, serviceType, - sourceDescription, - connectStepDescription, needsPermissions, onFormCreated, header, @@ -162,9 +160,9 @@ export const ConnectInstance: React.FC = ({ <> -

+

{CONNECT_DOC_PERMISSIONS_TITLE} -

+
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/constants.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/constants.ts index 712be15e7c046..2bf185ee048bd 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/constants.ts @@ -307,6 +307,13 @@ export const SAVE_CUSTOM_DOC_PERMISSIONS_TITLE = i18n.translate( } ); +export const INCLUDED_FEATURES_TITLE = i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.contentSource.includedFeaturesTitle', + { + defaultMessage: 'Included features', + } +); + export const SOURCE_FEATURES_SEARCHABLE = i18n.translate( 'xpack.enterpriseSearch.workplaceSearch.contentSource.sourceFeatures.searchable.text', { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.tsx index 0f170be8ba076..02856320aa535 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/source_features.tsx @@ -25,6 +25,7 @@ import { AppLogic } from '../../../../app_logic'; import { Features, FeatureIds } from '../../../../types'; import { + INCLUDED_FEATURES_TITLE, SOURCE_FEATURES_SEARCHABLE, SOURCE_FEATURES_REMOTE_FEATURE, SOURCE_FEATURES_PRIVATE_FEATURE, @@ -179,9 +180,7 @@ export const SourceFeatures: React.FC = ({ features, objTy return ( <> -

- Included features -

+

{INCLUDED_FEATURES_TITLE}

diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.scss b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.scss index e5b680c5edec3..90f0613df57d9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.scss +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/display_settings/display_settings.scss @@ -29,7 +29,7 @@ align-items: center; padding: 0 .25rem; background: #E9EDF2; - color: #647487; + color: #3F4B58; font-size: 10px; font-weight: 600; text-transform: uppercase; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.tsx index e9b8574032916..f44d15c27f002 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/overview.tsx @@ -51,6 +51,7 @@ import { } from '../../../routes'; import { SOURCES_NO_CONTENT_TITLE, + SOURCE_OVERVIEW_TITLE, CONTENT_SUMMARY_TITLE, CONTENT_TYPE_HEADER, ITEMS_HEADER, @@ -133,7 +134,7 @@ export const Overview: React.FC = () => { return ( <> -

{CONTENT_SUMMARY_TITLE}

+

{CONTENT_SUMMARY_TITLE}

{!summary && } @@ -218,7 +219,7 @@ export const Overview: React.FC = () => { return ( <> -

{RECENT_ACTIVITY_TITLE}

+

{RECENT_ACTIVITY_TITLE}

{activities.length === 0 ? emptyState : activitiesTable} @@ -228,9 +229,9 @@ export const Overview: React.FC = () => { const groupsSummary = ( <> - -

{GROUP_ACCESS_TITLE}

-
+ +
{GROUP_ACCESS_TITLE}
+
{groups.map((group, index) => ( @@ -254,9 +255,9 @@ export const Overview: React.FC = () => { const detailsSummary = ( <> - -

{CONFIGURATION_TITLE}

-
+ +

{CONFIGURATION_TITLE}

+
@@ -427,7 +428,7 @@ export const Overview: React.FC = () => { -

{title}

+ {title}
{children}
@@ -438,7 +439,7 @@ export const Overview: React.FC = () => { -

{DOCUMENT_PERMISSIONS_TITLE}

+ {DOCUMENT_PERMISSIONS_TITLE}

{DOC_PERMISSIONS_DESCRIPTION}

@@ -454,7 +455,7 @@ export const Overview: React.FC = () => { return ( - + diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_info_card.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_info_card.tsx index 1c3c44887946a..d98b4f6b1e67d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_info_card.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_info_card.tsx @@ -41,7 +41,7 @@ export const SourceInfoCard: React.FC = ({ -
{sourceName}
+

{sourceName}

diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/constants.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/constants.ts index d57afc6699c1a..7e4918929f1ce 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/constants.ts @@ -477,3 +477,10 @@ export const PERSONAL_DASHBOARD_SOURCE_ERROR = (error: string) => 'Could not connect the source, reach out to your admin for help. Error message: {error}', values: { error }, }); + +export const SOURCE_OVERVIEW_TITLE = i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.sources.sourceOverviewTitle', + { + defaultMessage: 'Source overview', + } +); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.tsx index 693c1e8bd5e40..57574ce14df67 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/private_sources.tsx @@ -97,6 +97,7 @@ export const PrivateSources: React.FC = () => { const privateSourcesSection = ( { const sharedSourcesSection = ( = ({ id, name, updatedAt, contentSources - + diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.tsx index 45175e489f94a..3c44261cc911f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/groups_table.tsx @@ -18,6 +18,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { ACTIONS_HEADER } from '../../../../shared/constants'; import { TablePaginationBar } from '../../../components/shared/table_pagination_bar'; import { GroupsLogic } from '../groups_logic'; @@ -71,7 +72,7 @@ export const GroupsTable: React.FC<{}> = () => { {GROUP_TABLE_HEADER} {SOURCES_TABLE_HEADER} - + {ACTIONS_HEADER} {groups.map((group, index) => ( diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.tsx index 338eda0214ea2..652fb89f41c7c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_card.tsx @@ -70,7 +70,7 @@ export const OnboardingCard: React.FC = ({ {title}} + title={

{title}

} body={description} actions={complete ? completeButton : incompleteButton} /> diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.tsx index 44d09ed73ed1f..9f525235af6f2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/overview/onboarding_steps.tsx @@ -145,12 +145,12 @@ export const OrgNameOnboarding: React.FC = () => {
-

+

-

+
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.tsx index 68f2a2289c1f2..d2f8232168eb1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/components/private_sources_table.tsx @@ -16,6 +16,7 @@ import { EuiFlexItem, EuiSwitch, EuiText, + EuiTitle, EuiTable, EuiTableBody, EuiTableHeader, @@ -129,9 +130,9 @@ export const PrivateSourcesTable: React.FC = ({ /> - -

{isRemote ? REMOTE_SOURCES_TOGGLE_TEXT : STANDARD_SOURCES_TOGGLE_TEXT}

-
+ +

{isRemote ? REMOTE_SOURCES_TOGGLE_TEXT : STANDARD_SOURCES_TOGGLE_TEXT}

+
{isRemote ? REMOTE_SOURCES_TABLE_DESCRIPTION : STANDARD_SOURCES_TABLE_DESCRIPTION} diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.tsx index 6cf1831dc07e7..a971df8f89914 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/security/security.tsx @@ -16,7 +16,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiSwitch, - EuiText, + EuiTitle, EuiSpacer, EuiPanel, EuiConfirmModal, @@ -109,9 +109,9 @@ export const Security: React.FC = () => { />
- -

{PRIVATE_SOURCES_TOGGLE_DESCRIPTION}

-
+ +

{PRIVATE_SOURCES_TOGGLE_DESCRIPTION}

+
diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.tsx index c3d01a3410d70..98662585ce330 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/settings/components/customize.tsx @@ -48,6 +48,7 @@ export const Customize: React.FC = () => { isInvalid={false} required value={orgNameInputValue} + aria-label={CUSTOMIZE_NAME_LABEL} data-test-subj="OrgNameInput" onChange={(e) => onOrgNameInputChange(e.target.value)} /> diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx index 476a5d8e029d3..dd24f1091843a 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx @@ -31,6 +31,11 @@ export const CreatePackagePolicyPageLayout: React.FunctionComponent<{ packageInfo?: PackageInfo; integrationInfo?: RegistryPolicyTemplate; 'data-test-subj'?: string; + tabs?: Array<{ + title: string; + isSelected: boolean; + onClick: React.ReactEventHandler; + }>; }> = memo( ({ from, @@ -41,6 +46,7 @@ export const CreatePackagePolicyPageLayout: React.FunctionComponent<{ integrationInfo, children, 'data-test-subj': dataTestSubj, + tabs = [], }) => { const pageTitle = useMemo(() => { if ( @@ -184,6 +190,7 @@ export const CreatePackagePolicyPageLayout: React.FunctionComponent<{ rightColumn={rightColumn} rightColumnGrow={false} data-test-subj={dataTestSubj} + tabs={tabs.map(({ title, ...rest }) => ({ name: title, ...rest }))} > {children} diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 65496afc1a101..3dc88c7565e73 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -332,30 +332,58 @@ export const EditPackagePolicyForm = memo<{ } }; + const extensionView = useUIExtension(packagePolicy.package?.name ?? '', 'package-policy-edit'); + const extensionTabsView = useUIExtension( + packagePolicy.package?.name ?? '', + 'package-policy-edit-tabs' + ); + const tabsViews = extensionTabsView?.tabs; + const [selectedTab, setSelectedTab] = useState(0); + const layoutProps = { from, cancelUrl, agentPolicy, packageInfo, + tabs: tabsViews?.length + ? [ + { + title: i18n.translate('xpack.fleet.editPackagePolicy.settingsTabName', { + defaultMessage: 'Settings', + }), + isSelected: selectedTab === 0, + onClick: () => { + setSelectedTab(0); + }, + }, + ...tabsViews.map(({ title }, index) => ({ + title, + isSelected: selectedTab === index + 1, + onClick: () => { + setSelectedTab(index + 1); + }, + })), + ] + : [], }; - const extensionView = useUIExtension(packagePolicy.package?.name ?? '', 'package-policy-edit'); - const configurePackage = useMemo( () => agentPolicy && packageInfo ? ( <> - + {selectedTab === 0 && ( + + )} {/* Only show the out-of-box configuration step if a UI extension is NOT registered */} - {!extensionView && ( + {!extensionView && selectedTab === 0 && ( - + {selectedTab > 0 && tabsViews ? ( + React.createElement(tabsViews[selectedTab - 1].Component, { + policy: originalPackagePolicy, + newPolicy: packagePolicy, + onChange: handleExtensionViewOnChange, + }) + ) : ( + + )} )} @@ -389,6 +425,8 @@ export const EditPackagePolicyForm = memo<{ originalPackagePolicy, extensionView, handleExtensionViewOnChange, + selectedTab, + tabsViews, ] ); diff --git a/x-pack/plugins/fleet/public/types/ui_extensions.ts b/x-pack/plugins/fleet/public/types/ui_extensions.ts index bc692fe1caa7d..40e92fe86555d 100644 --- a/x-pack/plugins/fleet/public/types/ui_extensions.ts +++ b/x-pack/plugins/fleet/public/types/ui_extensions.ts @@ -52,6 +52,16 @@ export interface PackagePolicyEditExtension { Component: LazyExoticComponent; } +/** Extension point registration contract for Integration Policy Edit tabs views */ +export interface PackagePolicyEditTabsExtension { + package: string; + view: 'package-policy-edit-tabs'; + tabs: Array<{ + title: EuiStepProps['title']; + Component: LazyExoticComponent; + }>; +} + /** * UI Component Extension is used on the pages displaying the ability to Create an * Integration Policy @@ -120,6 +130,7 @@ export interface AgentEnrollmentFlyoutFinalStepExtension { /** Fleet UI Extension Point */ export type UIExtensionPoint = | PackagePolicyEditExtension + | PackagePolicyEditTabsExtension | PackageCustomExtension | PackagePolicyCreateExtension | PackageAssetsExtension diff --git a/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts b/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts index 365c2d1d8a902..eb70aff3238a0 100644 --- a/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts +++ b/x-pack/plugins/fleet/server/constants/fleet_es_assets.ts @@ -23,6 +23,7 @@ export const FLEET_GLOBAL_COMPONENT_TEMPLATE_CONTENT = { properties: { ingested: { type: 'date', + format: 'strict_date_time_no_millis||strict_date_optional_time||epoch_millis', }, agent_id_status: { ignore_above: 1024, @@ -42,7 +43,12 @@ processors: - set: description: Add time when event was ingested. field: event.ingested - value: '{{{_ingest.timestamp}}}' + copy_from: _ingest.timestamp + - script: + description: Remove sub-seconds from event.ingested to improve storage efficiency. + tag: truncate-subseconds-event-ingested + source: ctx.event.ingested = ctx.event.ingested.withNano(0).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + ignore_failure: true - remove: description: Remove any pre-existing untrusted values. field: diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts index ed7db67433130..5ea4b896e7fa1 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.test.ts @@ -84,6 +84,9 @@ function getPutPreconfiguredPackagesMock() { references: [], }; }); + + soClient.delete.mockResolvedValue({}); + return soClient; } @@ -239,7 +242,7 @@ describe('policy preconfiguration', () => { ); }); - it('should return nonFatalErrors', async () => { + it('should not create a policy if we are not able to add packages ', async () => { const soClient = getPutPreconfiguredPackagesMock(); const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; const policies: PreconfiguredAgentPolicy[] = [ @@ -256,17 +259,21 @@ describe('policy preconfiguration', () => { }, ]; - const { nonFatalErrors } = await ensurePreconfiguredPackagesAndPolicies( - soClient, - esClient, - policies, - [{ name: 'CANNOT_MATCH', version: 'x.y.z' }], - mockDefaultOutput - ); + let error; + try { + await ensurePreconfiguredPackagesAndPolicies( + soClient, + esClient, + policies, + [{ name: 'CANNOT_MATCH', version: 'x.y.z' }], + mockDefaultOutput + ); + } catch (err) { + error = err; + } - expect(nonFatalErrors.length).toBe(1); - expect(nonFatalErrors[0].agentPolicy).toEqual({ name: 'Test policy' }); - expect(nonFatalErrors[0].error.message).toEqual( + expect(error).toBeDefined(); + expect(error.message).toEqual( 'Test policy could not be added. test_package is not installed, add test_package to `xpack.fleet.packages` or remove it from Test package.' ); }); diff --git a/x-pack/plugins/fleet/server/services/preconfiguration.ts b/x-pack/plugins/fleet/server/services/preconfiguration.ts index 28f21f38b48ee..334df17a8d3a8 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration.ts @@ -18,6 +18,8 @@ import type { PreconfiguredPackage, PreconfigurationError, } from '../../common'; +import { AGENT_POLICY_SAVED_OBJECT_TYPE } from '../../common'; + import { PRECONFIGURATION_DELETION_RECORD_SAVED_OBJECT_TYPE, PRECONFIGURATION_LATEST_KEYWORD, @@ -32,6 +34,7 @@ import { bulkInstallPackages } from './epm/packages/bulk_install_packages'; import { agentPolicyService, addPackageToAgentPolicy } from './agent_policy'; import type { InputsOverride } from './package_policy'; import { overridePackageInputs } from './package_policy'; +import { appContextService } from './app_context'; interface PreconfigurationResult { policies: Array<{ id: string; updated_at: string }>; @@ -153,36 +156,10 @@ export async function ensurePreconfiguredPackagesAndPolicies( } return { created, policy }; } - const { package_policies: packagePolicies } = preconfiguredAgentPolicy; - - const installedPackagePolicies = await Promise.all( - packagePolicies.map(async ({ package: pkg, name, ...newPackagePolicy }) => { - const installedPackage = await getInstallation({ - savedObjectsClient: soClient, - pkgName: pkg.name, - }); - if (!installedPackage) { - throw new Error( - i18n.translate('xpack.fleet.preconfiguration.packageMissingError', { - defaultMessage: - '{agentPolicyName} could not be added. {pkgName} is not installed, add {pkgName} to `{packagesConfigValue}` or remove it from {packagePolicyName}.', - values: { - agentPolicyName: preconfiguredAgentPolicy.name, - packagePolicyName: name, - pkgName: pkg.name, - packagesConfigValue: 'xpack.fleet.packages', - }, - }) - ); - } - return { name, installedPackage, ...newPackagePolicy }; - }) - ); return { created, policy, - installedPackagePolicies, shouldAddIsManagedFlag: preconfiguredAgentPolicy.is_managed, }; }) @@ -200,20 +177,51 @@ export async function ensurePreconfiguredPackagesAndPolicies( continue; } fulfilledPolicies.push(policyResult.value); - const { - created, - policy, - installedPackagePolicies, - shouldAddIsManagedFlag, - } = policyResult.value; + const { created, policy, shouldAddIsManagedFlag } = policyResult.value; if (created) { - await addPreconfiguredPolicyPackages( - soClient, - esClient, - policy!, - installedPackagePolicies!, - defaultOutput - ); + try { + const preconfiguredAgentPolicy = policies[i]; + const { package_policies: packagePolicies } = preconfiguredAgentPolicy; + + const installedPackagePolicies = await Promise.all( + packagePolicies.map(async ({ package: pkg, name, ...newPackagePolicy }) => { + const installedPackage = await getInstallation({ + savedObjectsClient: soClient, + pkgName: pkg.name, + }); + if (!installedPackage) { + throw new Error( + i18n.translate('xpack.fleet.preconfiguration.packageMissingError', { + defaultMessage: + '{agentPolicyName} could not be added. {pkgName} is not installed, add {pkgName} to `{packagesConfigValue}` or remove it from {packagePolicyName}.', + values: { + agentPolicyName: preconfiguredAgentPolicy.name, + packagePolicyName: name, + pkgName: pkg.name, + packagesConfigValue: 'xpack.fleet.packages', + }, + }) + ); + } + return { name, installedPackage, ...newPackagePolicy }; + }) + ); + await addPreconfiguredPolicyPackages( + soClient, + esClient, + policy!, + installedPackagePolicies!, + defaultOutput + ); + // If ann error happens while adding a package to the policy we will delete the policy so the setup can be retried later + } catch (err) { + await soClient + .delete(AGENT_POLICY_SAVED_OBJECT_TYPE, policy!.id) + // swallow error + .catch((deleteErr) => appContextService.getLogger().error(deleteErr)); + + throw err; + } // Add the is_managed flag after configuring package policies to avoid errors if (shouldAddIsManagedFlag) { agentPolicyService.update(soClient, esClient, policy!.id, { is_managed: true }); diff --git a/x-pack/plugins/index_lifecycle_management/server/plugin.ts b/x-pack/plugins/index_lifecycle_management/server/plugin.ts index 95793c0cad465..533d8736931a4 100644 --- a/x-pack/plugins/index_lifecycle_management/server/plugin.ts +++ b/x-pack/plugins/index_lifecycle_management/server/plugin.ts @@ -6,44 +6,36 @@ */ import { i18n } from '@kbn/i18n'; -import { - CoreSetup, - Plugin, - Logger, - PluginInitializerContext, - LegacyAPICaller, -} from 'src/core/server'; -import { handleEsError } from './shared_imports'; +import { CoreSetup, Plugin, Logger, PluginInitializerContext } from 'src/core/server'; +import { IScopedClusterClient } from 'kibana/server'; import { Index as IndexWithoutIlm } from '../../index_management/common/types'; import { PLUGIN } from '../common/constants'; -import { Index, IndexLifecyclePolicy } from '../common/types'; +import { Index } from '../common/types'; import { Dependencies } from './types'; import { registerApiRoutes } from './routes'; import { License } from './services'; import { IndexLifecycleManagementConfig } from './config'; +import { handleEsError } from './shared_imports'; const indexLifecycleDataEnricher = async ( indicesList: IndexWithoutIlm[], - // TODO replace deprecated ES client after Index Management is updated - callAsCurrentUser: LegacyAPICaller + client: IScopedClusterClient ): Promise => { if (!indicesList || !indicesList.length) { return []; } - const params = { - path: '/*/_ilm/explain', - method: 'GET', - }; - - const { indices: ilmIndicesData } = await callAsCurrentUser<{ - indices: { [indexName: string]: IndexLifecyclePolicy }; - }>('transport.request', params); + const { + body: { indices: ilmIndicesData }, + } = await client.asCurrentUser.ilm.explainLifecycle({ + index: '*', + }); return indicesList.map((index: IndexWithoutIlm) => { return { ...index, + // @ts-expect-error @elastic/elasticsearch Element implicitly has an 'any' type ilm: { ...(ilmIndicesData[index.name] || {}) }, }; }); diff --git a/x-pack/plugins/index_management/README.md b/x-pack/plugins/index_management/README.md index 07c5b9317b5cb..39f4821403a8d 100644 --- a/x-pack/plugins/index_management/README.md +++ b/x-pack/plugins/index_management/README.md @@ -1,5 +1,16 @@ # Index Management UI +## Indices tab + +### Quick steps for testing + +Create an index with special characters and verify it renders correctly: + +``` +# Renders as %{[@metadata][beat]}-%{[@metadata][version]}-2020.08.23 +PUT %25%7B%5B%40metadata%5D%5Bbeat%5D%7D-%25%7B%5B%40metadata%5D%5Bversion%5D%7D-2020.08.23 +``` + ## Data streams tab ### Quick steps for testing @@ -19,4 +30,56 @@ POST ds/_doc { "@timestamp": "2020-01-27" } -``` \ No newline at end of file +``` + +Create a data stream with special characters and verify it renders correctly: + +``` +# Configure template for creating a data stream +PUT _index_template/special_ds +{ + "index_patterns": ["%{[@metadata][beat]}-%{[@metadata][version]}-2020.08.23"], + "data_stream": {} +} + +# Add a document to the data stream, which will render as %{[@metadata][beat]}-%{[@metadata][version]}-2020.08.23 +POST %25%7B%5B%40metadata%5D%5Bbeat%5D%7D-%25%7B%5B%40metadata%5D%5Bversion%5D%7D-2020.08.23/_doc +{ + "@timestamp": "2020-01-27" +} +``` + +## Index templates tab + +### Quick steps for testing + +By default, **legacy index templates** are not shown in the UI. Make them appear by creating one in Console: + +``` +PUT _template/template_1 +{ + "index_patterns": ["foo*"] +} +``` + +To test **Cloud-managed templates**: + +1. Add `cluster.metadata.managed_index_templates` setting via Dev Tools: +``` +PUT /_cluster/settings +{ + "persistent": { + "cluster.metadata.managed_index_templates": ".cloud-" + } +} +``` + +2. Create a template with the format: `.cloud-` via Dev Tools. +``` +PUT _template/.cloud-example +{ + "index_patterns": [ "foobar*"] +} +``` + +The UI will now prevent you from editing or deleting this template. \ No newline at end of file diff --git a/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/simulate_template.tsx b/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/simulate_template.tsx index 946ce46ba2626..82c3b35e0a91b 100644 --- a/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/simulate_template.tsx +++ b/x-pack/plugins/index_management/public/application/components/index_templates/simulate_template/simulate_template.tsx @@ -6,7 +6,6 @@ */ import React, { useState, useCallback, useEffect } from 'react'; -import uuid from 'uuid'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiCodeBlock, EuiCallOut } from '@elastic/eui'; @@ -37,11 +36,6 @@ export const SimulateTemplate = React.memo(({ template, filters }: Props) => { } const indexTemplate = serializeTemplate(stripEmptyFields(template) as TemplateDeserialized); - - // Until ES fixes a bug on their side we will send a random index pattern to the simulate API. - // Issue: https://github.com/elastic/elasticsearch/issues/59152 - indexTemplate.index_patterns = [uuid.v4()]; - const { data, error } = await simulateIndexTemplate(indexTemplate); let filteredTemplate = data; diff --git a/x-pack/plugins/index_management/server/client/elasticsearch.ts b/x-pack/plugins/index_management/server/client/elasticsearch.ts deleted file mode 100644 index 9585680ce3b6d..0000000000000 --- a/x-pack/plugins/index_management/server/client/elasticsearch.ts +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export const elasticsearchJsPlugin = (Client: any, config: any, components: any) => { - const ca = components.clientAction.factory; - - Client.prototype.dataManagement = components.clientAction.namespaceFactory(); - const dataManagement = Client.prototype.dataManagement.prototype; - - // Data streams - - // We don't allow the user to create a data stream in the UI or API. We're just adding this here - // to enable the API integration tests. - dataManagement.createDataStream = ca({ - urls: [ - { - fmt: '/_data_stream/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'PUT', - }); - - dataManagement.deleteDataStream = ca({ - urls: [ - { - fmt: '/_data_stream/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'DELETE', - }); - - // Component templates - dataManagement.getComponentTemplates = ca({ - urls: [ - { - fmt: '/_component_template', - }, - ], - method: 'GET', - }); - - dataManagement.getComponentTemplate = ca({ - urls: [ - { - fmt: '/_component_template/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'GET', - }); - - dataManagement.saveComponentTemplate = ca({ - urls: [ - { - fmt: '/_component_template/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'PUT', - }); - - dataManagement.deleteComponentTemplate = ca({ - urls: [ - { - fmt: '/_component_template/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'DELETE', - }); - - // Composable index templates - dataManagement.getComposableIndexTemplates = ca({ - urls: [ - { - fmt: '/_index_template', - }, - ], - method: 'GET', - }); - - dataManagement.getComposableIndexTemplate = ca({ - urls: [ - { - fmt: '/_index_template/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'GET', - }); - - dataManagement.saveComposableIndexTemplate = ca({ - urls: [ - { - fmt: '/_index_template/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - needBody: true, - method: 'PUT', - }); - - dataManagement.deleteComposableIndexTemplate = ca({ - urls: [ - { - fmt: '/_index_template/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'DELETE', - }); - - dataManagement.existsTemplate = ca({ - urls: [ - { - fmt: '/_index_template/<%=name%>', - req: { - name: { - type: 'string', - }, - }, - }, - ], - method: 'HEAD', - }); - - dataManagement.simulateTemplate = ca({ - urls: [ - { - fmt: '/_index_template/_simulate', - }, - ], - needBody: true, - method: 'POST', - }); -}; diff --git a/x-pack/plugins/index_management/server/index.ts b/x-pack/plugins/index_management/server/index.ts index 1ca2705dc93ea..507401398a407 100644 --- a/x-pack/plugins/index_management/server/index.ts +++ b/x-pack/plugins/index_management/server/index.ts @@ -10,7 +10,7 @@ import { PluginInitializerContext } from 'src/core/server'; import { IndexMgmtServerPlugin } from './plugin'; import { configSchema } from './config'; -export const plugin = (ctx: PluginInitializerContext) => new IndexMgmtServerPlugin(ctx); +export const plugin = (context: PluginInitializerContext) => new IndexMgmtServerPlugin(context); export const config = { schema: configSchema, diff --git a/x-pack/plugins/index_management/server/lib/fetch_indices.ts b/x-pack/plugins/index_management/server/lib/fetch_indices.ts index b83843f0c615d..48f633a8dc102 100644 --- a/x-pack/plugins/index_management/server/lib/fetch_indices.ts +++ b/x-pack/plugins/index_management/server/lib/fetch_indices.ts @@ -5,99 +5,57 @@ * 2.0. */ -import { CatIndicesParams } from 'elasticsearch'; +import { IScopedClusterClient } from 'kibana/server'; import { IndexDataEnricher } from '../services'; -import { CallAsCurrentUser } from '../types'; import { Index } from '../index'; -interface Hit { - health: string; - status: string; - index: string; - uuid: string; - pri: string; - rep: string; - 'docs.count': any; - 'store.size': any; - sth: 'true' | 'false'; - hidden: boolean; -} - -interface IndexInfo { - aliases: { [aliasName: string]: unknown }; - mappings: unknown; - data_stream?: string; - settings: { - index: { - hidden: 'true' | 'false'; - }; - }; -} - -interface GetIndicesResponse { - [indexName: string]: IndexInfo; -} - async function fetchIndicesCall( - callAsCurrentUser: CallAsCurrentUser, + client: IScopedClusterClient, indexNames?: string[] ): Promise { const indexNamesString = indexNames && indexNames.length ? indexNames.join(',') : '*'; // This call retrieves alias and settings (incl. hidden status) information about indices - const indices: GetIndicesResponse = await callAsCurrentUser('transport.request', { - method: 'GET', - // transport.request doesn't do any URI encoding, unlike other JS client APIs. This enables - // working with Logstash indices with names like %{[@metadata][beat]}-%{[@metadata][version]}. - path: `/${encodeURIComponent(indexNamesString)}`, - query: { - expand_wildcards: 'hidden,all', - }, + const { body: indices } = await client.asCurrentUser.indices.get({ + index: indexNamesString, + expand_wildcards: 'hidden,all', }); if (!Object.keys(indices).length) { return []; } - const catQuery: Pick & { - expand_wildcards: string; - index?: string; - } = { + const { body: catHits } = await client.asCurrentUser.cat.indices({ format: 'json', h: 'health,status,index,uuid,pri,rep,docs.count,sth,store.size', expand_wildcards: 'hidden,all', index: indexNamesString, - }; - - // This call retrieves health and other high-level information about indices. - const catHits: Hit[] = await callAsCurrentUser('transport.request', { - method: 'GET', - path: '/_cat/indices', - query: catQuery, }); // System indices may show up in _cat APIs, as these APIs are primarily used for troubleshooting // For now, we filter them out and only return index information for the indices we have // In the future, we should migrate away from using cat APIs (https://github.com/elastic/kibana/issues/57286) return catHits.reduce((decoratedIndices, hit) => { - const index = indices[hit.index]; + const index = indices[hit.index!]; if (typeof index !== 'undefined') { - const aliases = Object.keys(index.aliases); + const aliases = Object.keys(index.aliases!); decoratedIndices.push({ - health: hit.health, - status: hit.status, - name: hit.index, - uuid: hit.uuid, - primary: hit.pri, - replica: hit.rep, + health: hit.health!, + status: hit.status!, + name: hit.index!, + uuid: hit.uuid!, + primary: hit.pri!, + replica: hit.rep!, documents: hit['docs.count'], size: hit['store.size'], isFrozen: hit.sth === 'true', // sth value coming back as a string from ES aliases: aliases.length ? aliases : 'none', + // @ts-expect-error @elastic/elasticsearch Property 'index' does not exist on type 'IndicesIndexSettings | IndicesIndexStatePrefixedSettings'. hidden: index.settings.index.hidden === 'true', - data_stream: index.data_stream, + // @ts-expect-error @elastic/elasticsearch Property 'data_stream' does not exist on type 'IndicesIndexState'. + data_stream: index.data_stream!, }); } @@ -106,10 +64,10 @@ async function fetchIndicesCall( } export const fetchIndices = async ( - callAsCurrentUser: CallAsCurrentUser, + client: IScopedClusterClient, indexDataEnricher: IndexDataEnricher, indexNames?: string[] ) => { - const indices = await fetchIndicesCall(callAsCurrentUser, indexNames); - return await indexDataEnricher.enrichIndices(indices, callAsCurrentUser); + const indices = await fetchIndicesCall(client, indexNames); + return await indexDataEnricher.enrichIndices(indices, client); }; diff --git a/x-pack/plugins/index_management/server/lib/get_managed_templates.ts b/x-pack/plugins/index_management/server/lib/get_managed_templates.ts index df0f4f12d9719..8e60044dc4951 100644 --- a/x-pack/plugins/index_management/server/lib/get_managed_templates.ts +++ b/x-pack/plugins/index_management/server/lib/get_managed_templates.ts @@ -5,16 +5,20 @@ * 2.0. */ +import { IScopedClusterClient } from 'kibana/server'; + // Cloud has its own system for managing templates and we want to make // this clear in the UI when a template is used in a Cloud deployment. export const getCloudManagedTemplatePrefix = async ( - callAsCurrentUser: any + client: IScopedClusterClient ): Promise => { try { - const { persistent, transient, defaults } = await callAsCurrentUser('cluster.getSettings', { - filterPath: '*.*managed_index_templates', - flatSettings: true, - includeDefaults: true, + const { + body: { persistent, transient, defaults }, + } = await client.asCurrentUser.cluster.getSettings({ + filter_path: '*.*managed_index_templates', + flat_settings: true, + include_defaults: true, }); const { 'cluster.metadata.managed_index_templates': managedTemplatesPrefix = undefined } = { diff --git a/x-pack/plugins/index_management/server/plugin.ts b/x-pack/plugins/index_management/server/plugin.ts index 35d25eb452b84..a339349c0a5a9 100644 --- a/x-pack/plugins/index_management/server/plugin.ts +++ b/x-pack/plugins/index_management/server/plugin.ts @@ -5,20 +5,13 @@ * 2.0. */ -import { - CoreSetup, - Plugin, - PluginInitializerContext, - ILegacyCustomClusterClient, -} from 'src/core/server'; +import { CoreSetup, Plugin, PluginInitializerContext } from 'src/core/server'; import { PLUGIN } from '../common/constants/plugin'; import { Dependencies } from './types'; import { ApiRoutes } from './routes'; import { IndexDataEnricher } from './services'; -import { isEsError, handleEsError, parseEsError } from './shared_imports'; -import { elasticsearchJsPlugin } from './client/elasticsearch'; -import type { IndexManagementRequestHandlerContext } from './types'; +import { handleEsError } from './shared_imports'; export interface IndexManagementPluginSetup { indexDataEnricher: { @@ -26,16 +19,9 @@ export interface IndexManagementPluginSetup { }; } -async function getCustomEsClient(getStartServices: CoreSetup['getStartServices']) { - const [core] = await getStartServices(); - const esClientConfig = { plugins: [elasticsearchJsPlugin] }; - return core.elasticsearch.legacy.createClient('dataManagement', esClientConfig); -} - export class IndexMgmtServerPlugin implements Plugin { private readonly apiRoutes: ApiRoutes; private readonly indexDataEnricher: IndexDataEnricher; - private dataManagementESClient?: ILegacyCustomClusterClient; constructor(initContext: PluginInitializerContext) { this.apiRoutes = new ApiRoutes(); @@ -46,8 +32,6 @@ export class IndexMgmtServerPlugin implements Plugin(); - features.registerElasticsearchFeature({ id: PLUGIN.id, management: { @@ -63,27 +47,13 @@ export class IndexMgmtServerPlugin implements Plugin( - 'dataManagement', - async (ctx, request) => { - this.dataManagementESClient = - this.dataManagementESClient ?? (await getCustomEsClient(getStartServices)); - - return { - client: this.dataManagementESClient.asScoped(request), - }; - } - ); - this.apiRoutes.setup({ - router, + router: http.createRouter(), config: { isSecurityEnabled: () => security !== undefined && security.license.isEnabled(), }, indexDataEnricher: this.indexDataEnricher, lib: { - isEsError, - parseEsError, handleEsError, }, }); @@ -97,9 +67,5 @@ export class IndexMgmtServerPlugin implements Plugin { +export const registerCreateRoute = ({ + router, + lib: { handleEsError }, +}: RouteDependencies): void => { router.post( { path: addBasePath('/component_templates'), @@ -20,24 +23,23 @@ export const registerCreateRoute = ({ router, lib: { isEsError } }: RouteDepende body: componentTemplateSchema, }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; + async (context, request, response) => { + const { client } = context.core.elasticsearch; - const serializedComponentTemplate = serializeComponentTemplate(req.body); + const serializedComponentTemplate = serializeComponentTemplate(request.body); - const { name } = req.body; + const { name } = request.body; try { // Check that a component template with the same name doesn't already exist - const componentTemplateResponse = await callAsCurrentUser( - 'dataManagement.getComponentTemplate', - { name } - ); - - const { component_templates: componentTemplates } = componentTemplateResponse; + const { + body: { component_templates: componentTemplates }, + } = await client.asCurrentUser.cluster.getComponentTemplate({ + name, + }); if (componentTemplates.length) { - return res.conflict({ + return response.conflict({ body: new Error( i18n.translate('xpack.idxMgmt.componentTemplates.createRoute.duplicateErrorMessage', { defaultMessage: "There is already a component template with name '{name}'.", @@ -53,21 +55,15 @@ export const registerCreateRoute = ({ router, lib: { isEsError } }: RouteDepende } try { - const response = await callAsCurrentUser('dataManagement.saveComponentTemplate', { + const { body: responseBody } = await client.asCurrentUser.cluster.putComponentTemplate({ name, + // @ts-expect-error @elastic/elasticsearch Type 'ComponentTemplateSerialized' is not assignable body: serializedComponentTemplate, }); - return res.ok({ body: response }); + return response.ok({ body: responseBody }); } catch (error) { - if (isEsError(error)) { - return res.customError({ - statusCode: error.statusCode, - body: error, - }); - } - - throw error; + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/delete.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/delete.ts index d30f54f6e44ad..67991ec708946 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/delete.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/delete.ts @@ -14,7 +14,10 @@ const paramsSchema = schema.object({ names: schema.string(), }); -export const registerDeleteRoute = ({ router }: RouteDependencies): void => { +export const registerDeleteRoute = ({ + router, + lib: { handleEsError }, +}: RouteDependencies): void => { router.delete( { path: addBasePath('/component_templates/{names}'), @@ -22,32 +25,34 @@ export const registerDeleteRoute = ({ router }: RouteDependencies): void => { params: paramsSchema, }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const { names } = req.params; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { names } = request.params; const componentNames = names.split(','); - const response: { itemsDeleted: string[]; errors: any[] } = { + const responseBody: { itemsDeleted: string[]; errors: any[] } = { itemsDeleted: [], errors: [], }; await Promise.all( - componentNames.map((componentName) => { - return callAsCurrentUser('dataManagement.deleteComponentTemplate', { - name: componentName, - }) - .then(() => response.itemsDeleted.push(componentName)) - .catch((e) => - response.errors.push({ - name: componentName, - error: e, - }) - ); + componentNames.map(async (componentName) => { + try { + await client.asCurrentUser.cluster.deleteComponentTemplate({ + name: componentName, + }); + + return responseBody.itemsDeleted.push(componentName); + } catch (error) { + return responseBody.errors.push({ + name: componentName, + error: handleEsError({ error, response }), + }); + } }) ); - return res.ok({ body: response }); + return response.ok({ body: responseBody }); } ); }; diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/get.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/get.ts index a5d70e65f870a..a77aa90c52f73 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/get.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/get.ts @@ -19,25 +19,23 @@ const paramsSchema = schema.object({ name: schema.string(), }); -export function registerGetAllRoute({ router, lib: { isEsError } }: RouteDependencies) { +export function registerGetAllRoute({ router, lib: { handleEsError } }: RouteDependencies) { // Get all component templates router.get( { path: addBasePath('/component_templates'), validate: false }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; + async (context, request, response) => { + const { client } = context.core.elasticsearch; try { const { - component_templates: componentTemplates, - }: { component_templates: ComponentTemplateFromEs[] } = await callAsCurrentUser( - 'dataManagement.getComponentTemplates' - ); + body: { component_templates: componentTemplates }, + } = await client.asCurrentUser.cluster.getComponentTemplate(); - const { index_templates: indexTemplates } = await callAsCurrentUser( - 'dataManagement.getComposableIndexTemplates' - ); + const { + body: { index_templates: indexTemplates }, + } = await client.asCurrentUser.indices.getIndexTemplate(); - const body = componentTemplates.map((componentTemplate) => { + const body = componentTemplates.map((componentTemplate: ComponentTemplateFromEs) => { const deserializedComponentTemplateListItem = deserializeComponentTemplateList( componentTemplate, indexTemplates @@ -45,16 +43,9 @@ export function registerGetAllRoute({ router, lib: { isEsError } }: RouteDepende return deserializedComponentTemplateListItem; }); - return res.ok({ body }); + return response.ok({ body }); } catch (error) { - if (isEsError(error)) { - return res.customError({ - statusCode: error.statusCode, - body: error, - }); - } - - throw error; + return handleEsError({ error, response }); } } ); @@ -67,34 +58,26 @@ export function registerGetAllRoute({ router, lib: { isEsError } }: RouteDepende params: paramsSchema, }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const { name } = req.params; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { name } = request.params; try { - const { component_templates: componentTemplates } = await callAsCurrentUser( - 'dataManagement.getComponentTemplates', - { - name, - } - ); + const { + body: { component_templates: componentTemplates }, + } = await client.asCurrentUser.cluster.getComponentTemplate({ + name, + }); - const { index_templates: indexTemplates } = await callAsCurrentUser( - 'dataManagement.getComposableIndexTemplates' - ); + const { + body: { index_templates: indexTemplates }, + } = await client.asCurrentUser.indices.getIndexTemplate(); - return res.ok({ + return response.ok({ body: deserializeComponentTemplate(componentTemplates[0], indexTemplates), }); } catch (error) { - if (isEsError(error)) { - return res.customError({ - statusCode: error.statusCode, - body: error, - }); - } - - throw error; + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.test.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.test.ts index eccf2d945785f..992c2f9ed29dd 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.test.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.test.ts @@ -18,17 +18,15 @@ const httpService = httpServiceMock.createSetupContract(); const mockedIndexDataEnricher = new IndexDataEnricher(); -const mockRouteContext = ({ - callAsCurrentUser, -}: { - callAsCurrentUser: any; -}): RequestHandlerContext => { +const mockRouteContext = ({ hasPrivileges }: { hasPrivileges: unknown }): RequestHandlerContext => { const routeContextMock = ({ core: { elasticsearch: { - legacy: { - client: { - callAsCurrentUser, + client: { + asCurrentUser: { + security: { + hasPrivileges, + }, }, }, }, @@ -51,8 +49,6 @@ describe('GET privileges', () => { }, indexDataEnricher: mockedIndexDataEnricher, lib: { - isEsError: jest.fn(), - parseEsError: jest.fn(), handleEsError: jest.fn(), }, }); @@ -62,15 +58,17 @@ describe('GET privileges', () => { it('should return the correct response when a user has privileges', async () => { const privilegesResponseMock = { - username: 'elastic', - has_all_requested: true, - cluster: { manage_index_templates: true }, - index: {}, - application: {}, + body: { + username: 'elastic', + has_all_requested: true, + cluster: { manage_index_templates: true }, + index: {}, + application: {}, + }, }; const routeContextMock = mockRouteContext({ - callAsCurrentUser: jest.fn().mockResolvedValueOnce(privilegesResponseMock), + hasPrivileges: jest.fn().mockResolvedValueOnce(privilegesResponseMock), }); const request = httpServerMock.createKibanaRequest(); @@ -86,15 +84,17 @@ describe('GET privileges', () => { it('should return the correct response when a user does not have privileges', async () => { const privilegesResponseMock = { - username: 'elastic', - has_all_requested: false, - cluster: { manage_index_templates: false }, - index: {}, - application: {}, + body: { + username: 'elastic', + has_all_requested: false, + cluster: { manage_index_templates: false }, + index: {}, + application: {}, + }, }; const routeContextMock = mockRouteContext({ - callAsCurrentUser: jest.fn().mockResolvedValueOnce(privilegesResponseMock), + hasPrivileges: jest.fn().mockResolvedValueOnce(privilegesResponseMock), }); const request = httpServerMock.createKibanaRequest(); @@ -119,8 +119,6 @@ describe('GET privileges', () => { }, indexDataEnricher: mockedIndexDataEnricher, lib: { - isEsError: jest.fn(), - parseEsError: jest.fn(), handleEsError: jest.fn(), }, }); @@ -130,7 +128,7 @@ describe('GET privileges', () => { it('should return the default privileges response', async () => { const routeContextMock = mockRouteContext({ - callAsCurrentUser: jest.fn(), + hasPrivileges: jest.fn(), }); const request = httpServerMock.createKibanaRequest(); diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.ts index 62ad93453091e..327e6421525c6 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/privileges.ts @@ -17,13 +17,17 @@ const extractMissingPrivileges = (privilegesObject: { [key: string]: boolean } = return privileges; }, []); -export const registerPrivilegesRoute = ({ router, config }: RouteDependencies) => { +export const registerPrivilegesRoute = ({ + router, + config, + lib: { handleEsError }, +}: RouteDependencies) => { router.get( { path: addBasePath('/component_templates/privileges'), validate: false, }, - async (ctx, req, res) => { + async (context, request, response) => { const privilegesResult: Privileges = { hasAllPrivileges: true, missingPrivileges: { @@ -33,38 +37,28 @@ export const registerPrivilegesRoute = ({ router, config }: RouteDependencies) = // Skip the privileges check if security is not enabled if (!config.isSecurityEnabled()) { - return res.ok({ body: privilegesResult }); + return response.ok({ body: privilegesResult }); } - const { - core: { - elasticsearch: { - legacy: { client }, - }, - }, - } = ctx; + const { client } = context.core.elasticsearch; try { - const { has_all_requested: hasAllPrivileges, cluster } = await client.callAsCurrentUser( - 'transport.request', - { - path: '/_security/user/_has_privileges', - method: 'POST', - body: { - cluster: ['manage_index_templates'], - }, - } - ); + const { + body: { has_all_requested: hasAllPrivileges, cluster }, + } = await client.asCurrentUser.security.hasPrivileges({ + body: { + cluster: ['manage_index_templates'], + }, + }); if (!hasAllPrivileges) { privilegesResult.missingPrivileges.cluster = extractMissingPrivileges(cluster); } privilegesResult.hasAllPrivileges = hasAllPrivileges; - - return res.ok({ body: privilegesResult }); - } catch (e) { - throw e; + return response.ok({ body: privilegesResult }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/component_templates/update.ts b/x-pack/plugins/index_management/server/routes/api/component_templates/update.ts index ee94b8f2b0082..17e14f1a39c42 100644 --- a/x-pack/plugins/index_management/server/routes/api/component_templates/update.ts +++ b/x-pack/plugins/index_management/server/routes/api/component_templates/update.ts @@ -15,7 +15,10 @@ const paramsSchema = schema.object({ name: schema.string(), }); -export const registerUpdateRoute = ({ router, lib: { isEsError } }: RouteDependencies): void => { +export const registerUpdateRoute = ({ + router, + lib: { handleEsError }, +}: RouteDependencies): void => { router.put( { path: addBasePath('/component_templates/{name}'), @@ -24,34 +27,28 @@ export const registerUpdateRoute = ({ router, lib: { isEsError } }: RouteDepende params: paramsSchema, }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const { name } = req.params; - const { template, version, _meta } = req.body; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { name } = request.params; + const { template, version, _meta } = request.body; try { // Verify component exists; ES will throw 404 if not - await callAsCurrentUser('dataManagement.getComponentTemplate', { name }); + await client.asCurrentUser.cluster.getComponentTemplate({ name }); - const response = await callAsCurrentUser('dataManagement.saveComponentTemplate', { + const { body: responseBody } = await client.asCurrentUser.cluster.putComponentTemplate({ name, body: { + // @ts-expect-error @elastic/elasticsearch Not assignable to type 'IndicesIndexState' template, version, _meta, }, }); - return res.ok({ body: response }); + return response.ok({ body: responseBody }); } catch (error) { - if (isEsError(error)) { - return res.customError({ - statusCode: error.statusCode, - body: error, - }); - } - - throw error; + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/data_streams/register_delete_route.ts b/x-pack/plugins/index_management/server/routes/api/data_streams/register_delete_route.ts index 49166f4823a02..9e7b57079cc3c 100644 --- a/x-pack/plugins/index_management/server/routes/api/data_streams/register_delete_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/data_streams/register_delete_route.ts @@ -9,23 +9,22 @@ import { schema, TypeOf } from '@kbn/config-schema'; import { RouteDependencies } from '../../../types'; import { addBasePath } from '../index'; -import { wrapEsError } from '../../helpers'; const bodySchema = schema.object({ dataStreams: schema.arrayOf(schema.string()), }); -export function registerDeleteRoute({ router }: RouteDependencies) { +export function registerDeleteRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/delete_data_streams'), validate: { body: bodySchema }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const { dataStreams } = req.body as TypeOf; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { dataStreams } = request.body as TypeOf; - const response: { dataStreamsDeleted: string[]; errors: any[] } = { + const responseBody: { dataStreamsDeleted: string[]; errors: any[] } = { dataStreamsDeleted: [], errors: [], }; @@ -33,21 +32,21 @@ export function registerDeleteRoute({ router }: RouteDependencies) { await Promise.all( dataStreams.map(async (name: string) => { try { - await callAsCurrentUser('dataManagement.deleteDataStream', { + await client.asCurrentUser.indices.deleteDataStream({ name, }); - return response.dataStreamsDeleted.push(name); - } catch (e) { - return response.errors.push({ + return responseBody.dataStreamsDeleted.push(name); + } catch (error) { + return responseBody.errors.push({ name, - error: wrapEsError(e), + error: handleEsError({ error, response }), }); } }) ); - return res.ok({ body: response }); + return response.ok({ body: responseBody }); } ); } diff --git a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts index 1ce7c14f0a209..c7b28b46e8f00 100644 --- a/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/data_streams/register_get_route.ts @@ -7,7 +7,7 @@ import { schema, TypeOf } from '@kbn/config-schema'; -import { ElasticsearchClient } from 'kibana/server'; +import { IScopedClusterClient } from 'kibana/server'; import { deserializeDataStream, deserializeDataStreamList } from '../../../../common/lib'; import { DataStreamFromEs } from '../../../../common/types'; import { RouteDependencies } from '../../../types'; @@ -68,30 +68,23 @@ const enhanceDataStreams = ({ }); }; -const getDataStreams = (client: ElasticsearchClient, name = '*') => { - // TODO update when elasticsearch client has update requestParams for 'indices.getDataStream' - return client.transport.request({ - path: `/_data_stream/${encodeURIComponent(name)}`, - method: 'GET', - querystring: { - expand_wildcards: 'all', - }, +const getDataStreams = (client: IScopedClusterClient, name = '*') => { + return client.asCurrentUser.indices.getDataStream({ + name, + expand_wildcards: 'all', }); }; -const getDataStreamsStats = (client: ElasticsearchClient, name = '*') => { - return client.transport.request({ - path: `/_data_stream/${encodeURIComponent(name)}/_stats`, - method: 'GET', - querystring: { - human: true, - expand_wildcards: 'all', - }, +const getDataStreamsStats = (client: IScopedClusterClient, name = '*') => { + return client.asCurrentUser.indices.dataStreamsStats({ + name, + expand_wildcards: 'all', + human: true, }); }; -const getDataStreamsPrivileges = (client: ElasticsearchClient, names: string[]) => { - return client.security.hasPrivileges({ +const getDataStreamsPrivileges = (client: IScopedClusterClient, names: string[]) => { + return client.asCurrentUser.security.hasPrivileges({ body: { index: [ { @@ -109,15 +102,15 @@ export function registerGetAllRoute({ router, lib: { handleEsError }, config }: }); router.get( { path: addBasePath('/data_streams'), validate: { query: querySchema } }, - async (ctx, req, response) => { - const { asCurrentUser } = ctx.core.elasticsearch.client; + async (context, request, response) => { + const { client } = context.core.elasticsearch; - const includeStats = (req.query as TypeOf).includeStats === 'true'; + const includeStats = (request.query as TypeOf).includeStats === 'true'; try { - let { + const { body: { data_streams: dataStreams }, - } = await getDataStreams(asCurrentUser); + } = await getDataStreams(client); let dataStreamsStats; let dataStreamsPrivileges; @@ -125,24 +118,26 @@ export function registerGetAllRoute({ router, lib: { handleEsError }, config }: if (includeStats) { ({ body: { data_streams: dataStreamsStats }, - } = await getDataStreamsStats(asCurrentUser)); + } = await getDataStreamsStats(client)); } if (config.isSecurityEnabled() && dataStreams.length > 0) { ({ body: dataStreamsPrivileges } = await getDataStreamsPrivileges( - asCurrentUser, - dataStreams.map((dataStream: DataStreamFromEs) => dataStream.name) + client, + dataStreams.map((dataStream) => dataStream.name) )); } - dataStreams = enhanceDataStreams({ + const enhancedDataStreams = enhanceDataStreams({ + // @ts-expect-error @elastic/elasticsearch DataStreamFromEs incompatible with IndicesGetDataStreamIndicesGetDataStreamItem dataStreams, + // @ts-expect-error @elastic/elasticsearch StatsFromEs incompatible with IndicesDataStreamsStatsDataStreamsStatsItem dataStreamsStats, - // @ts-expect-error PrivilegesFromEs incompatible with ApplicationsPrivileges + // @ts-expect-error @elastic/elasticsearch PrivilegesFromEs incompatible with ApplicationsPrivileges dataStreamsPrivileges, }); - return response.ok({ body: deserializeDataStreamList(dataStreams) }); + return response.ok({ body: deserializeDataStreamList(enhancedDataStreams) }); } catch (error) { return handleEsError({ error, response }); } @@ -159,9 +154,9 @@ export function registerGetOneRoute({ router, lib: { handleEsError }, config }: path: addBasePath('/data_streams/{name}'), validate: { params: paramsSchema }, }, - async (ctx, req, response) => { - const { name } = req.params as TypeOf; - const { asCurrentUser } = ctx.core.elasticsearch.client; + async (context, request, response) => { + const { name } = request.params as TypeOf; + const { client } = context.core.elasticsearch; try { const [ { @@ -170,23 +165,22 @@ export function registerGetOneRoute({ router, lib: { handleEsError }, config }: { body: { data_streams: dataStreamsStats }, }, - ] = await Promise.all([ - getDataStreams(asCurrentUser, name), - getDataStreamsStats(asCurrentUser, name), - ]); + ] = await Promise.all([getDataStreams(client, name), getDataStreamsStats(client, name)]); if (dataStreams[0]) { let dataStreamsPrivileges; if (config.isSecurityEnabled()) { - ({ body: dataStreamsPrivileges } = await getDataStreamsPrivileges(asCurrentUser, [ + ({ body: dataStreamsPrivileges } = await getDataStreamsPrivileges(client, [ dataStreams[0].name, ])); } const enhancedDataStreams = enhanceDataStreams({ + // @ts-expect-error @elastic/elasticsearch DataStreamFromEs incompatible with IndicesGetDataStreamIndicesGetDataStreamItem dataStreams, + // @ts-expect-error @elastic/elasticsearch StatsFromEs incompatible with IndicesDataStreamsStatsDataStreamsStatsItem dataStreamsStats, - // @ts-expect-error PrivilegesFromEs incompatible with ApplicationsPrivileges + // @ts-expect-error @elastic/elasticsearch PrivilegesFromEs incompatible with ApplicationsPrivileges dataStreamsPrivileges, }); const body = deserializeDataStream(enhancedDataStreams[0]); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_clear_cache_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_clear_cache_route.ts index 593f0cda6886e..e9b34e9a72d9b 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_clear_cache_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_clear_cache_route.ts @@ -14,31 +14,24 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerClearCacheRoute({ router, lib }: RouteDependencies) { +export function registerClearCacheRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/clear_cache'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const payload = req.body as typeof bodySchema.type; - const { indices = [] } = payload; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; const params = { - expandWildcards: 'none', + expand_wildcards: 'none', format: 'json', index: indices, }; try { - await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('indices.clearCache', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.clearCache(params); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_close_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_close_route.ts index 777adcd055709..9b9bb8238038a 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_close_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_close_route.ts @@ -14,31 +14,24 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerCloseRoute({ router, lib }: RouteDependencies) { +export function registerCloseRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/close'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const payload = req.body as typeof bodySchema.type; - const { indices = [] } = payload; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; const params = { - expandWildcards: 'none', + expand_wildcards: 'none', format: 'json', index: indices, }; try { - await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('indices.close', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.close(params); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_delete_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_delete_route.ts index 914835089a438..2bd564e8a4c92 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_delete_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_delete_route.ts @@ -14,31 +14,24 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerDeleteRoute({ router, lib }: RouteDependencies) { +export function registerDeleteRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/delete'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const body = req.body as typeof bodySchema.type; - const { indices = [] } = body; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; const params = { - expandWildcards: 'none', + expand_wildcards: 'none', format: 'json', index: indices, }; try { - await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('indices.delete', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.delete(params); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_flush_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_flush_route.ts index bb1759a034cc7..b008494ab8157 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_flush_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_flush_route.ts @@ -14,31 +14,24 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerFlushRoute({ router, lib }: RouteDependencies) { +export function registerFlushRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/flush'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const body = req.body as typeof bodySchema.type; - const { indices = [] } = body; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; const params = { - expandWildcards: 'none', + expand_wildcards: 'none', format: 'json', index: indices, }; try { - await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('indices.flush', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.flush(params); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_forcemerge_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_forcemerge_route.ts index 6f0e8f0fec567..48d0e1bc974c6 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_forcemerge_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_forcemerge_route.ts @@ -15,7 +15,7 @@ const bodySchema = schema.object({ maxNumSegments: schema.maybe(schema.number()), }); -export function registerForcemergeRoute({ router, lib }: RouteDependencies) { +export function registerForcemergeRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/forcemerge'), @@ -23,10 +23,11 @@ export function registerForcemergeRoute({ router, lib }: RouteDependencies) { body: bodySchema, }, }, - async (ctx, req, res) => { - const { maxNumSegments, indices = [] } = req.body as typeof bodySchema.type; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { maxNumSegments, indices = [] } = request.body as typeof bodySchema.type; const params = { - expandWildcards: 'none', + expand_wildcards: 'none', index: indices, }; @@ -35,17 +36,10 @@ export function registerForcemergeRoute({ router, lib }: RouteDependencies) { } try { - await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('indices.forcemerge', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.forcemerge(params); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_freeze_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_freeze_route.ts index 4b1281e0f2121..fcab1d6338b6f 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_freeze_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_freeze_route.ts @@ -14,33 +14,20 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerFreezeRoute({ router, lib }: RouteDependencies) { +export function registerFreezeRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/freeze'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const body = req.body as typeof bodySchema.type; - const { indices = [] } = body; - - const params = { - path: `/${encodeURIComponent(indices.join(','))}/_freeze`, - method: 'POST', - }; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; try { - await await ctx.core.elasticsearch.legacy.client.callAsCurrentUser( - 'transport.request', - params - ); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.freeze({ + index: indices.join(','), + }); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_list_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_list_route.ts index 47c454e96c8e2..d8a7fcb29bb35 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_list_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_list_route.ts @@ -9,23 +9,21 @@ import { fetchIndices } from '../../../lib/fetch_indices'; import { RouteDependencies } from '../../../types'; import { addBasePath } from '../index'; -export function registerListRoute({ router, indexDataEnricher, lib }: RouteDependencies) { - router.get({ path: addBasePath('/indices'), validate: false }, async (ctx, req, res) => { - try { - const indices = await fetchIndices( - ctx.core.elasticsearch.legacy.client.callAsCurrentUser, - indexDataEnricher - ); - return res.ok({ body: indices }); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); +export function registerListRoute({ + router, + indexDataEnricher, + lib: { handleEsError }, +}: RouteDependencies) { + router.get( + { path: addBasePath('/indices'), validate: false }, + async (context, request, response) => { + const { client } = context.core.elasticsearch; + try { + const indices = await fetchIndices(client, indexDataEnricher); + return response.ok({ body: indices }); + } catch (error) { + return handleEsError({ error, response }); } - // Case: default - throw e; } - }); + ); } diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_open_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_open_route.ts index cad57ce60de65..be4b84fdcda82 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_open_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_open_route.ts @@ -14,31 +14,24 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerOpenRoute({ router, lib }: RouteDependencies) { +export function registerOpenRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/open'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const body = req.body as typeof bodySchema.type; - const { indices = [] } = body; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; const params = { - expandWildcards: 'none', + expand_wildcards: 'none', format: 'json', index: indices, }; try { - await await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('indices.open', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.open(params); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_refresh_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_refresh_route.ts index e2c0155e28086..c747653f0bb80 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_refresh_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_refresh_route.ts @@ -14,31 +14,24 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerRefreshRoute({ router, lib }: RouteDependencies) { +export function registerRefreshRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/refresh'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const body = req.body as typeof bodySchema.type; - const { indices = [] } = body; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; const params = { - expandWildcards: 'none', + expand_wildcards: 'none', format: 'json', index: indices, }; try { - await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('indices.refresh', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.refresh(params); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_reload_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_reload_route.ts index 8d83cd21f427d..4c5bd1fb030e8 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_reload_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_reload_route.ts @@ -17,28 +17,22 @@ const bodySchema = schema.maybe( }) ); -export function registerReloadRoute({ router, indexDataEnricher, lib }: RouteDependencies) { +export function registerReloadRoute({ + router, + indexDataEnricher, + lib: { handleEsError }, +}: RouteDependencies) { router.post( { path: addBasePath('/indices/reload'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const { indexNames = [] } = (req.body as typeof bodySchema.type) ?? {}; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indexNames = [] } = (request.body as typeof bodySchema.type) ?? {}; try { - const indices = await fetchIndices( - ctx.core.elasticsearch.legacy.client.callAsCurrentUser, - indexDataEnricher, - indexNames - ); - return res.ok({ body: indices }); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + const indices = await fetchIndices(client, indexDataEnricher, indexNames); + return response.ok({ body: indices }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/indices/register_unfreeze_route.ts b/x-pack/plugins/index_management/server/routes/api/indices/register_unfreeze_route.ts index 45102f4874129..71a7c27ad2cba 100644 --- a/x-pack/plugins/index_management/server/routes/api/indices/register_unfreeze_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/indices/register_unfreeze_route.ts @@ -14,28 +14,20 @@ const bodySchema = schema.object({ indices: schema.arrayOf(schema.string()), }); -export function registerUnfreezeRoute({ router, lib }: RouteDependencies) { +export function registerUnfreezeRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/indices/unfreeze'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const { indices = [] } = req.body as typeof bodySchema.type; - const params = { - path: `/${encodeURIComponent(indices.join(','))}/_unfreeze`, - method: 'POST', - }; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indices = [] } = request.body as typeof bodySchema.type; try { - await ctx.core.elasticsearch.legacy.client.callAsCurrentUser('transport.request', params); - return res.ok(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + await client.asCurrentUser.indices.unfreeze({ + index: indices.join(','), + }); + return response.ok(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/mapping/register_mapping_route.ts b/x-pack/plugins/index_management/server/routes/api/mapping/register_mapping_route.ts index 406ceba16c8bd..b5891e579a1f6 100644 --- a/x-pack/plugins/index_management/server/routes/api/mapping/register_mapping_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/mapping/register_mapping_route.ts @@ -21,32 +21,23 @@ function formatHit(hit: { [key: string]: { mappings: any } }, indexName: string) }; } -export function registerMappingRoute({ router, lib }: RouteDependencies) { +export function registerMappingRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.get( { path: addBasePath('/mapping/{indexName}'), validate: { params: paramsSchema } }, - async (ctx, req, res) => { - const { indexName } = req.params as typeof paramsSchema.type; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indexName } = request.params as typeof paramsSchema.type; const params = { expand_wildcards: 'none', index: indexName, }; try { - const hit = await ctx.core.elasticsearch.legacy.client.callAsCurrentUser( - 'indices.getMapping', - params - ); - const response = formatHit(hit, indexName); - return res.ok({ body: response }); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + const { body: hit } = await client.asCurrentUser.indices.getMapping(params); + const responseBody = formatHit(hit, indexName); + return response.ok({ body: responseBody }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/settings/register_load_route.ts b/x-pack/plugins/index_management/server/routes/api/settings/register_load_route.ts index 276b326929e8f..a819315f5231f 100644 --- a/x-pack/plugins/index_management/server/routes/api/settings/register_load_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/settings/register_load_route.ts @@ -21,34 +21,25 @@ function formatHit(hit: { [key: string]: {} }) { return hit[key]; } -export function registerLoadRoute({ router, lib }: RouteDependencies) { +export function registerLoadRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.get( { path: addBasePath('/settings/{indexName}'), validate: { params: paramsSchema } }, - async (ctx, req, res) => { - const { indexName } = req.params as typeof paramsSchema.type; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indexName } = request.params as typeof paramsSchema.type; const params = { - expandWildcards: 'none', - flatSettings: false, + expand_wildcards: 'none', + flat_settings: false, local: false, - includeDefaults: true, + include_defaults: true, index: indexName, }; try { - const hit = await ctx.core.elasticsearch.legacy.client.callAsCurrentUser( - 'indices.getSettings', - params - ); - return res.ok({ body: formatHit(hit) }); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + const { body: hit } = await client.asCurrentUser.indices.getSettings(params); + return response.ok({ body: formatHit(hit) }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/settings/register_update_route.ts b/x-pack/plugins/index_management/server/routes/api/settings/register_update_route.ts index b4f12b91083df..5dc825738cfaa 100644 --- a/x-pack/plugins/index_management/server/routes/api/settings/register_update_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/settings/register_update_route.ts @@ -16,37 +16,28 @@ const paramsSchema = schema.object({ indexName: schema.string(), }); -export function registerUpdateRoute({ router, lib }: RouteDependencies) { +export function registerUpdateRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.put( { path: addBasePath('/settings/{indexName}'), validate: { body: bodySchema, params: paramsSchema }, }, - async (ctx, req, res) => { - const { indexName } = req.params as typeof paramsSchema.type; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indexName } = request.params as typeof paramsSchema.type; const params = { - ignoreUnavailable: true, - allowNoIndices: false, - expandWildcards: 'none', + ignore_unavailable: true, + allow_no_indices: false, + expand_wildcards: 'none', index: indexName, - body: req.body, + body: request.body, }; try { - const response = await ctx.core.elasticsearch.legacy.client.callAsCurrentUser( - 'indices.putSettings', - params - ); - return res.ok({ body: response }); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + const { body: responseBody } = await client.asCurrentUser.indices.putSettings(params); + return response.ok({ body: responseBody }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/stats/register_stats_route.ts b/x-pack/plugins/index_management/server/routes/api/stats/register_stats_route.ts index 42a3012ea8e17..7458b98f5092f 100644 --- a/x-pack/plugins/index_management/server/routes/api/stats/register_stats_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/stats/register_stats_route.ts @@ -6,6 +6,7 @@ */ import { schema } from '@kbn/config-schema'; +import type { estypes } from '@elastic/elasticsearch'; import { RouteDependencies } from '../../../types'; import { addBasePath } from '../index'; @@ -14,40 +15,37 @@ const paramsSchema = schema.object({ indexName: schema.string(), }); -function formatHit(hit: { _shards: any; indices: { [key: string]: any } }, indexName: string) { +interface Hit { + _shards: unknown; + indices?: Record; +} + +function formatHit(hit: Hit, indexName: string) { const { _shards, indices } = hit; - const stats = indices[indexName]; + const stats = indices![indexName]; return { _shards, stats, }; } -export function registerStatsRoute({ router, lib }: RouteDependencies) { +export function registerStatsRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.get( { path: addBasePath('/stats/{indexName}'), validate: { params: paramsSchema } }, - async (ctx, req, res) => { - const { indexName } = req.params as typeof paramsSchema.type; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { indexName } = request.params as typeof paramsSchema.type; const params = { expand_wildcards: 'none', index: indexName, }; try { - const hit = await ctx.core.elasticsearch.legacy.client.callAsCurrentUser( - 'indices.stats', - params - ); - return res.ok({ body: formatHit(hit, indexName) }); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + const { body: hit } = await client.asCurrentUser.indices.stats(params); + + return response.ok({ body: formatHit(hit, indexName) }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/templates/lib.ts b/x-pack/plugins/index_management/server/routes/api/templates/lib.ts index d64bb719d23eb..ef2642399d76d 100644 --- a/x-pack/plugins/index_management/server/routes/api/templates/lib.ts +++ b/x-pack/plugins/index_management/server/routes/api/templates/lib.ts @@ -5,32 +5,33 @@ * 2.0. */ +import { IScopedClusterClient } from 'kibana/server'; import { serializeTemplate, serializeLegacyTemplate } from '../../../../common/lib'; import { TemplateDeserialized, LegacyTemplateSerialized } from '../../../../common'; -import { CallAsCurrentUser } from '../../../types'; export const doesTemplateExist = async ({ name, - callAsCurrentUser, + client, isLegacy, }: { name: string; - callAsCurrentUser: CallAsCurrentUser; + client: IScopedClusterClient; isLegacy?: boolean; }) => { if (isLegacy) { - return await callAsCurrentUser('indices.existsTemplate', { name }); + return await client.asCurrentUser.indices.existsTemplate({ name }); } - return await callAsCurrentUser('dataManagement.existsTemplate', { name }); + + return await client.asCurrentUser.indices.existsIndexTemplate({ name }); }; export const saveTemplate = async ({ template, - callAsCurrentUser, + client, isLegacy, }: { template: TemplateDeserialized; - callAsCurrentUser: CallAsCurrentUser; + client: IScopedClusterClient; isLegacy?: boolean; }) => { const serializedTemplate = isLegacy @@ -48,8 +49,9 @@ export const saveTemplate = async ({ aliases, } = serializedTemplate as LegacyTemplateSerialized; - return await callAsCurrentUser('indices.putTemplate', { + return await client.asCurrentUser.indices.putTemplate({ name: template.name, + // @ts-expect-error @elastic/elasticsearch not assignable to parameter of type 'IndicesPutTemplateRequest' order, body: { index_patterns, @@ -61,8 +63,9 @@ export const saveTemplate = async ({ }); } - return await callAsCurrentUser('dataManagement.saveComposableIndexTemplate', { + return await client.asCurrentUser.indices.putIndexTemplate({ name: template.name, + // @ts-expect-error @elastic/elasticsearch Type 'LegacyTemplateSerialized | TemplateSerialized' is not assignable body: serializedTemplate, }); }; diff --git a/x-pack/plugins/index_management/server/routes/api/templates/register_create_route.ts b/x-pack/plugins/index_management/server/routes/api/templates/register_create_route.ts index d8a236bdebd15..21be254eb9d73 100644 --- a/x-pack/plugins/index_management/server/routes/api/templates/register_create_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/templates/register_create_route.ts @@ -15,54 +15,44 @@ import { saveTemplate, doesTemplateExist } from './lib'; const bodySchema = templateSchema; -export function registerCreateRoute({ router, lib }: RouteDependencies) { +export function registerCreateRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/index_templates'), validate: { body: bodySchema } }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const template = req.body as TemplateDeserialized; - const { - _kbnMeta: { isLegacy }, - } = template; - - // Check that template with the same name doesn't already exist - const templateExists = await doesTemplateExist({ - name: template.name, - callAsCurrentUser, - isLegacy, - }); - - if (templateExists) { - return res.conflict({ - body: new Error( - i18n.translate('xpack.idxMgmt.createRoute.duplicateTemplateIdErrorMessage', { - defaultMessage: "There is already a template with name '{name}'.", - values: { - name: template.name, - }, - }) - ), - }); - } + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const template = request.body as TemplateDeserialized; try { - // Otherwise create new index template - const response = await saveTemplate({ template, callAsCurrentUser, isLegacy }); + const { + _kbnMeta: { isLegacy }, + } = template; + + // Check that template with the same name doesn't already exist + const { body: templateExists } = await doesTemplateExist({ + name: template.name, + client, + isLegacy, + }); - return res.ok({ body: response }); - } catch (e) { - if (lib.isEsError(e)) { - const error = lib.parseEsError(e.response); - return res.customError({ - statusCode: e.statusCode, - body: { - message: error.message, - attributes: error, - }, + if (templateExists) { + return response.conflict({ + body: new Error( + i18n.translate('xpack.idxMgmt.createRoute.duplicateTemplateIdErrorMessage', { + defaultMessage: "There is already a template with name '{name}'.", + values: { + name: template.name, + }, + }) + ), }); } - // Case: default - throw e; + + // Otherwise create new index template + const { body: responseBody } = await saveTemplate({ template, client, isLegacy }); + + return response.ok({ body: responseBody }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/templates/register_delete_route.ts b/x-pack/plugins/index_management/server/routes/api/templates/register_delete_route.ts index 083964dec9edc..fbfcab3a8f5ed 100644 --- a/x-pack/plugins/index_management/server/routes/api/templates/register_delete_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/templates/register_delete_route.ts @@ -9,7 +9,6 @@ import { schema, TypeOf } from '@kbn/config-schema'; import { RouteDependencies } from '../../../types'; import { addBasePath } from '../index'; -import { wrapEsError } from '../../helpers'; import { TemplateDeserialized } from '../../../../common'; @@ -22,16 +21,19 @@ const bodySchema = schema.object({ ), }); -export function registerDeleteRoute({ router }: RouteDependencies) { +export function registerDeleteRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/delete_index_templates'), validate: { body: bodySchema }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const { templates } = req.body as TypeOf; - const response: { templatesDeleted: Array; errors: any[] } = { + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { templates } = request.body as TypeOf; + const responseBody: { + templatesDeleted: Array; + errors: any[]; + } = { templatesDeleted: [], errors: [], }; @@ -40,26 +42,26 @@ export function registerDeleteRoute({ router }: RouteDependencies) { templates.map(async ({ name, isLegacy }) => { try { if (isLegacy) { - await callAsCurrentUser('indices.deleteTemplate', { + await client.asCurrentUser.indices.deleteTemplate({ name, }); } else { - await callAsCurrentUser('dataManagement.deleteComposableIndexTemplate', { + await client.asCurrentUser.indices.deleteIndexTemplate({ name, }); } - return response.templatesDeleted.push(name); - } catch (e) { - return response.errors.push({ + return responseBody.templatesDeleted.push(name); + } catch (error) { + return responseBody.errors.push({ name, - error: wrapEsError(e), + error: handleEsError({ error, response }), }); } }) ); - return res.ok({ body: response }); + return response.ok({ body: responseBody }); } ); } diff --git a/x-pack/plugins/index_management/server/routes/api/templates/register_get_routes.ts b/x-pack/plugins/index_management/server/routes/api/templates/register_get_routes.ts index 231a2764d2710..9d0b7302b5587 100644 --- a/x-pack/plugins/index_management/server/routes/api/templates/register_get_routes.ts +++ b/x-pack/plugins/index_management/server/routes/api/templates/register_get_routes.ts @@ -17,41 +17,37 @@ import { getCloudManagedTemplatePrefix } from '../../../lib/get_managed_template import { RouteDependencies } from '../../../types'; import { addBasePath } from '../index'; -export function registerGetAllRoute({ router, lib: { isEsError } }: RouteDependencies) { - router.get({ path: addBasePath('/index_templates'), validate: false }, async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - - try { - const cloudManagedTemplatePrefix = await getCloudManagedTemplatePrefix(callAsCurrentUser); - - const legacyTemplatesEs = await callAsCurrentUser('indices.getTemplate'); - const { index_templates: templatesEs } = await callAsCurrentUser( - 'dataManagement.getComposableIndexTemplates' - ); - - const legacyTemplates = deserializeLegacyTemplateList( - legacyTemplatesEs, - cloudManagedTemplatePrefix - ); - const templates = deserializeTemplateList(templatesEs, cloudManagedTemplatePrefix); - - const body = { - templates, - legacyTemplates, - }; - - return res.ok({ body }); - } catch (error) { - if (isEsError(error)) { - return res.customError({ - statusCode: error.statusCode, - body: error, - }); +export function registerGetAllRoute({ router, lib: { handleEsError } }: RouteDependencies) { + router.get( + { path: addBasePath('/index_templates'), validate: false }, + async (context, request, response) => { + const { client } = context.core.elasticsearch; + + try { + const cloudManagedTemplatePrefix = await getCloudManagedTemplatePrefix(client); + + const { body: legacyTemplatesEs } = await client.asCurrentUser.indices.getTemplate(); + const { + body: { index_templates: templatesEs }, + } = await client.asCurrentUser.indices.getIndexTemplate(); + + const legacyTemplates = deserializeLegacyTemplateList( + legacyTemplatesEs, + cloudManagedTemplatePrefix + ); + const templates = deserializeTemplateList(templatesEs, cloudManagedTemplatePrefix); + + const body = { + templates, + legacyTemplates, + }; + + return response.ok({ body }); + } catch (error) { + return handleEsError({ error, response }); } - // Case: default - throw error; } - }); + ); } const paramsSchema = schema.object({ @@ -63,26 +59,27 @@ const querySchema = schema.object({ legacy: schema.maybe(schema.oneOf([schema.literal('true'), schema.literal('false')])), }); -export function registerGetOneRoute({ router, lib }: RouteDependencies) { +export function registerGetOneRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.get( { path: addBasePath('/index_templates/{name}'), validate: { params: paramsSchema, query: querySchema }, }, - async (ctx, req, res) => { - const { name } = req.params as TypeOf; - const { callAsCurrentUser } = ctx.dataManagement!.client; - - const isLegacy = (req.query as TypeOf).legacy === 'true'; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { name } = request.params as TypeOf; + const isLegacy = (request.query as TypeOf).legacy === 'true'; try { - const cloudManagedTemplatePrefix = await getCloudManagedTemplatePrefix(callAsCurrentUser); + const cloudManagedTemplatePrefix = await getCloudManagedTemplatePrefix(client); if (isLegacy) { - const indexTemplateByName = await callAsCurrentUser('indices.getTemplate', { name }); + const { body: indexTemplateByName } = await client.asCurrentUser.indices.getTemplate({ + name, + }); if (indexTemplateByName[name]) { - return res.ok({ + return response.ok({ body: deserializeLegacyTemplate( { ...indexTemplateByName[name], name }, cloudManagedTemplatePrefix @@ -91,11 +88,11 @@ export function registerGetOneRoute({ router, lib }: RouteDependencies) { } } else { const { - index_templates: indexTemplates, - } = await callAsCurrentUser('dataManagement.getComposableIndexTemplate', { name }); + body: { index_templates: indexTemplates }, + } = await client.asCurrentUser.indices.getIndexTemplate({ name }); if (indexTemplates.length > 0) { - return res.ok({ + return response.ok({ body: deserializeTemplate( { ...indexTemplates[0].index_template, name }, cloudManagedTemplatePrefix @@ -104,16 +101,9 @@ export function registerGetOneRoute({ router, lib }: RouteDependencies) { } } - return res.notFound(); - } catch (e) { - if (lib.isEsError(e)) { - return res.customError({ - statusCode: e.statusCode, - body: e, - }); - } - // Case: default - throw e; + return response.notFound(); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/templates/register_simulate_route.ts b/x-pack/plugins/index_management/server/routes/api/templates/register_simulate_route.ts index 0c3d8faea628c..cd363cbd7d003 100644 --- a/x-pack/plugins/index_management/server/routes/api/templates/register_simulate_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/templates/register_simulate_route.ts @@ -12,35 +12,30 @@ import { addBasePath } from '../index'; const bodySchema = schema.object({}, { unknowns: 'allow' }); -export function registerSimulateRoute({ router, lib }: RouteDependencies) { +export function registerSimulateRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.post( { path: addBasePath('/index_templates/simulate'), validate: { body: bodySchema }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const template = req.body as TypeOf; + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const template = request.body as TypeOf; try { - const templatePreview = await callAsCurrentUser('dataManagement.simulateTemplate', { - body: template, + const { body: templatePreview } = await client.asCurrentUser.indices.simulateTemplate({ + body: { + ...template, + // Until ES fixes a bug on their side we need to send a fake index pattern + // that won't match any indices. + // Issue: https://github.com/elastic/elasticsearch/issues/59152 + index_patterns: ['a_fake_index_pattern_that_wont_match_any_indices'], + }, }); - return res.ok({ body: templatePreview }); - } catch (e) { - if (lib.isEsError(e)) { - const error = lib.parseEsError(e.response); - return res.customError({ - statusCode: e.statusCode, - body: { - message: error.message, - attributes: error, - }, - }); - } - // Case: default - throw e; + return response.ok({ body: templatePreview }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/api/templates/register_update_route.ts b/x-pack/plugins/index_management/server/routes/api/templates/register_update_route.ts index 07a7d457f0473..669a1fff66317 100644 --- a/x-pack/plugins/index_management/server/routes/api/templates/register_update_route.ts +++ b/x-pack/plugins/index_management/server/routes/api/templates/register_update_route.ts @@ -18,45 +18,35 @@ const paramsSchema = schema.object({ name: schema.string(), }); -export function registerUpdateRoute({ router, lib }: RouteDependencies) { +export function registerUpdateRoute({ router, lib: { handleEsError } }: RouteDependencies) { router.put( { path: addBasePath('/index_templates/{name}'), validate: { body: bodySchema, params: paramsSchema }, }, - async (ctx, req, res) => { - const { callAsCurrentUser } = ctx.dataManagement!.client; - const { name } = req.params as typeof paramsSchema.type; - const template = req.body as TemplateDeserialized; - const { - _kbnMeta: { isLegacy }, - } = template; - - // Verify the template exists (ES will throw 404 if not) - const doesExist = await doesTemplateExist({ name, callAsCurrentUser, isLegacy }); - - if (!doesExist) { - return res.notFound(); - } + async (context, request, response) => { + const { client } = context.core.elasticsearch; + const { name } = request.params as typeof paramsSchema.type; + const template = request.body as TemplateDeserialized; try { - // Next, update index template - const response = await saveTemplate({ template, callAsCurrentUser, isLegacy }); - - return res.ok({ body: response }); - } catch (e) { - if (lib.isEsError(e)) { - const error = lib.parseEsError(e.response); - return res.customError({ - statusCode: e.statusCode, - body: { - message: error.message, - attributes: error, - }, - }); + const { + _kbnMeta: { isLegacy }, + } = template; + + // Verify the template exists (ES will throw 404 if not) + const { body: templateExists } = await doesTemplateExist({ name, client, isLegacy }); + + if (!templateExists) { + return response.notFound(); } - // Case: default - throw e; + + // Next, update index template + const { body: responseBody } = await saveTemplate({ template, client, isLegacy }); + + return response.ok({ body: responseBody }); + } catch (error) { + return handleEsError({ error, response }); } } ); diff --git a/x-pack/plugins/index_management/server/routes/helpers.ts b/x-pack/plugins/index_management/server/routes/helpers.ts deleted file mode 100644 index 1f5d0af18279d..0000000000000 --- a/x-pack/plugins/index_management/server/routes/helpers.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -const extractCausedByChain = (causedBy: any = {}, accumulator: any[] = []): any => { - const { reason, caused_by } = causedBy; // eslint-disable-line @typescript-eslint/naming-convention - - if (reason) { - accumulator.push(reason); - } - - if (caused_by) { - return extractCausedByChain(caused_by, accumulator); - } - - return accumulator; -}; - -/** - * Wraps an error thrown by the ES JS client into a Boom error response and returns it - * - * @param err Object Error thrown by ES JS client - * @param statusCodeToMessageMap Object Optional map of HTTP status codes => error messages - * @return Object Boom error response - */ -export const wrapEsError = (err: any, statusCodeToMessageMap: any = {}) => { - const { statusCode, response } = err; - - const { - error: { - root_cause = [], // eslint-disable-line @typescript-eslint/naming-convention - caused_by = {}, // eslint-disable-line @typescript-eslint/naming-convention - } = {}, - } = JSON.parse(response); - - // If no custom message if specified for the error's status code, just - // wrap the error as a Boom error response, include the additional information from ES, and return it - if (!statusCodeToMessageMap[statusCode]) { - // const boomError = Boom.boomify(err, { statusCode }); - const error: any = { statusCode }; - - // The caused_by chain has the most information so use that if it's available. If not then - // settle for the root_cause. - const causedByChain = extractCausedByChain(caused_by); - const defaultCause = root_cause.length ? extractCausedByChain(root_cause[0]) : undefined; - - error.cause = causedByChain.length ? causedByChain : defaultCause; - return error; - } - - // Otherwise, use the custom message to create a Boom error response and - // return it - const message = statusCodeToMessageMap[statusCode]; - return { message, statusCode }; -}; diff --git a/x-pack/plugins/index_management/server/services/index_data_enricher.ts b/x-pack/plugins/index_management/server/services/index_data_enricher.ts index eb2169aebf2c5..532485201b99e 100644 --- a/x-pack/plugins/index_management/server/services/index_data_enricher.ts +++ b/x-pack/plugins/index_management/server/services/index_data_enricher.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { CallAsCurrentUser } from '../types'; +import { IScopedClusterClient } from 'kibana/server'; import { Index } from '../index'; -export type Enricher = (indices: Index[], callAsCurrentUser: CallAsCurrentUser) => Promise; +export type Enricher = (indices: Index[], client: IScopedClusterClient) => Promise; export class IndexDataEnricher { private readonly _enrichers: Enricher[] = []; @@ -19,14 +19,14 @@ export class IndexDataEnricher { public enrichIndices = async ( indices: Index[], - callAsCurrentUser: CallAsCurrentUser + client: IScopedClusterClient ): Promise => { let enrichedIndices = indices; for (let i = 0; i < this.enrichers.length; i++) { const dataEnricher = this.enrichers[i]; try { - const dataEnricherResponse = await dataEnricher(enrichedIndices, callAsCurrentUser); + const dataEnricherResponse = await dataEnricher(enrichedIndices, client); enrichedIndices = dataEnricherResponse; } catch (e) { // silently swallow enricher response errors diff --git a/x-pack/plugins/index_management/server/shared_imports.ts b/x-pack/plugins/index_management/server/shared_imports.ts index 6daa94900e559..7f55d189457c7 100644 --- a/x-pack/plugins/index_management/server/shared_imports.ts +++ b/x-pack/plugins/index_management/server/shared_imports.ts @@ -5,8 +5,4 @@ * 2.0. */ -export { - isEsError, - parseEsError, - handleEsError, -} from '../../../../src/plugins/es_ui_shared/server'; +export { handleEsError } from '../../../../src/plugins/es_ui_shared/server'; diff --git a/x-pack/plugins/index_management/server/types.ts b/x-pack/plugins/index_management/server/types.ts index c980279d5bf30..ba40d22f2eafc 100644 --- a/x-pack/plugins/index_management/server/types.ts +++ b/x-pack/plugins/index_management/server/types.ts @@ -5,17 +5,13 @@ * 2.0. */ -import type { - LegacyScopedClusterClient, - ILegacyScopedClusterClient, - IRouter, - RequestHandlerContext, -} from 'src/core/server'; +import { IRouter } from 'src/core/server'; + import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server'; import { LicensingPluginSetup } from '../../licensing/server'; import { SecurityPluginSetup } from '../../security/server'; import { IndexDataEnricher } from './services'; -import { isEsError, parseEsError, handleEsError } from './shared_imports'; +import { handleEsError } from './shared_imports'; export interface Dependencies { security: SecurityPluginSetup; @@ -24,39 +20,12 @@ export interface Dependencies { } export interface RouteDependencies { - router: IndexManagementRouter; + router: IRouter; config: { isSecurityEnabled: () => boolean; }; indexDataEnricher: IndexDataEnricher; lib: { - isEsError: typeof isEsError; - parseEsError: typeof parseEsError; handleEsError: typeof handleEsError; }; } - -export type CallAsCurrentUser = LegacyScopedClusterClient['callAsCurrentUser']; - -export interface DataManagementContext { - client: ILegacyScopedClusterClient; -} - -/** - * @internal - */ -export interface IndexManagementApiRequestHandlerContext { - client: ILegacyScopedClusterClient; -} - -/** - * @internal - */ -export interface IndexManagementRequestHandlerContext extends RequestHandlerContext { - dataManagement: IndexManagementApiRequestHandlerContext; -} - -/** - * @internal - */ -export type IndexManagementRouter = IRouter; diff --git a/x-pack/plugins/maps/public/embeddable/types.ts b/x-pack/plugins/maps/public/embeddable/types.ts index dfd87bca19ac3..fd8160c567530 100644 --- a/x-pack/plugins/maps/public/embeddable/types.ts +++ b/x-pack/plugins/maps/public/embeddable/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IIndexPattern } from '../../../../../src/plugins/data/common/index_patterns'; +import type { IndexPattern } from '../../../../../src/plugins/data/common/index_patterns'; import { EmbeddableInput, EmbeddableOutput, @@ -41,5 +41,5 @@ export type MapByReferenceInput = SavedObjectEmbeddableInput & { export type MapEmbeddableInput = MapByValueInput | MapByReferenceInput; export type MapEmbeddableOutput = EmbeddableOutput & { - indexPatterns: IIndexPattern[]; + indexPatterns: IndexPattern[]; }; diff --git a/x-pack/plugins/monitoring/common/index.js b/x-pack/plugins/monitoring/common/index.ts similarity index 95% rename from x-pack/plugins/monitoring/common/index.js rename to x-pack/plugins/monitoring/common/index.ts index b71419e8c3dd9..371a4172ebbc0 100644 --- a/x-pack/plugins/monitoring/common/index.js +++ b/x-pack/plugins/monitoring/common/index.ts @@ -5,4 +5,5 @@ * 2.0. */ +// @ts-ignore export { formatTimestampToDuration } from './format_timestamp_to_duration'; diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.test.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.test.ts index ffcab27568597..36d2ef1bdba07 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.test.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.test.ts @@ -46,7 +46,6 @@ describe('fetchStatus', () => { triggeredMS: 0, }; let alertStates: AlertState[] = []; - const licenseService = null; const rulesClient = { find: jest.fn(() => ({ total: 1, @@ -74,7 +73,7 @@ describe('fetchStatus', () => { }); it('should fetch from the alerts client', async () => { - const status = await fetchStatus(rulesClient as any, licenseService as any, alertTypes, [ + const status = await fetchStatus(rulesClient as any, alertTypes, [ defaultClusterState.clusterUuid, ]); expect(status).toEqual({ @@ -96,7 +95,7 @@ describe('fetchStatus', () => { }, ]; - const status = await fetchStatus(rulesClient as any, licenseService as any, alertTypes, [ + const status = await fetchStatus(rulesClient as any, alertTypes, [ defaultClusterState.clusterUuid, ]); expect(Object.values(status).length).toBe(1); @@ -105,9 +104,7 @@ describe('fetchStatus', () => { }); it('should pass in the right filter to the alerts client', async () => { - await fetchStatus(rulesClient as any, licenseService as any, alertTypes, [ - defaultClusterState.clusterUuid, - ]); + await fetchStatus(rulesClient as any, alertTypes, [defaultClusterState.clusterUuid]); expect((rulesClient.find as jest.Mock).mock.calls[0][0].options.filter).toBe( `alert.attributes.alertTypeId:${alertType}` ); @@ -118,7 +115,7 @@ describe('fetchStatus', () => { alertTypeState: null, })) as any; - const status = await fetchStatus(rulesClient as any, licenseService as any, alertTypes, [ + const status = await fetchStatus(rulesClient as any, alertTypes, [ defaultClusterState.clusterUuid, ]); expect(status[alertType].states.length).toEqual(0); @@ -130,7 +127,7 @@ describe('fetchStatus', () => { data: [], })) as any; - const status = await fetchStatus(rulesClient as any, licenseService as any, alertTypes, [ + const status = await fetchStatus(rulesClient as any, alertTypes, [ defaultClusterState.clusterUuid, ]); expect(status).toEqual({}); @@ -146,7 +143,6 @@ describe('fetchStatus', () => { }; await fetchStatus( rulesClient as any, - customLicenseService as any, [ALERT_CLUSTER_HEALTH], [defaultClusterState.clusterUuid] ); @@ -183,7 +179,6 @@ describe('fetchStatus', () => { }; const status = await fetchStatus( customRulesClient as any, - licenseService as any, [ALERT_CPU_USAGE, ALERT_DISK_USAGE, ALERT_MISSING_MONITORING_DATA], [defaultClusterState.clusterUuid] ); diff --git a/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.ts b/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.ts index f4fd792ddf922..4a20dcb0fdf2d 100644 --- a/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.ts +++ b/x-pack/plugins/monitoring/server/lib/alerts/fetch_status.ts @@ -14,11 +14,9 @@ import { CommonAlertFilter, } from '../../../common/types/alerts'; import { ALERTS } from '../../../common/constants'; -import { MonitoringLicenseService } from '../../types'; export async function fetchStatus( rulesClient: RulesClient, - licenseService: MonitoringLicenseService, alertTypes: string[] | undefined, clusterUuids: string[], filters: CommonAlertFilter[] = [] diff --git a/x-pack/plugins/monitoring/server/lib/apm/_apm_stats.js b/x-pack/plugins/monitoring/server/lib/apm/_apm_stats.ts similarity index 73% rename from x-pack/plugins/monitoring/server/lib/apm/_apm_stats.js rename to x-pack/plugins/monitoring/server/lib/apm/_apm_stats.ts index 64450405b3268..0068d521055ef 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/_apm_stats.js +++ b/x-pack/plugins/monitoring/server/lib/apm/_apm_stats.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { get } from 'lodash'; +import type { ElasticsearchResponse } from '../../../common/types/es'; -const getMemPath = (cgroup) => +const getMemPath = (cgroup?: string) => cgroup ? 'beats_stats.metrics.beat.cgroup.memory.mem.usage.bytes' : 'beats_stats.metrics.beat.memstats.rss'; -export const getDiffCalculation = (max, min) => { +export const getDiffCalculation = (max: number | null, min: number | null) => { // no need to test max >= 0, but min <= 0 which is normal for a derivative after restart // because we are aggregating/collapsing on ephemeral_ids if (max !== null && min !== null && max >= 0 && min >= 0 && max >= min) { @@ -30,7 +30,7 @@ export const apmAggFilterPath = [ 'aggregations.max_mem_total.value', 'aggregations.versions.buckets', ]; -export const apmUuidsAgg = (maxBucketSize, cgroup) => ({ +export const apmUuidsAgg = (maxBucketSize?: string, cgroup?: string) => ({ total: { cardinality: { field: 'beats_stats.beat.uuid', @@ -92,14 +92,16 @@ export const apmUuidsAgg = (maxBucketSize, cgroup) => ({ }, }); -export const apmAggResponseHandler = (response) => { - const apmTotal = get(response, 'aggregations.total.value', 0); +export const apmAggResponseHandler = (response: ElasticsearchResponse) => { + const apmTotal = response.aggregations?.total.value ?? 0; - const eventsTotalMax = get(response, 'aggregations.max_events_total.value', 0); - const eventsTotalMin = get(response, 'aggregations.min_events_total.value', 0); - const memMax = get(response, 'aggregations.max_mem_total.value', 0); - const memMin = get(response, 'aggregations.min_mem_total.value', 0); - const versions = get(response, 'aggregations.versions.buckets', []).map(({ key }) => key); + const eventsTotalMax = response.aggregations?.max_events_total.value ?? 0; + const eventsTotalMin = response.aggregations?.min_events_total.value ?? 0; + const memMax = response.aggregations?.max_mem_total.value ?? 0; + const memMin = response.aggregations?.min_mem_total.value ?? 0; + const versions = (response.aggregations?.versions.buckets ?? []).map( + ({ key }: { key: string }) => key + ); return { apmTotal, diff --git a/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts b/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts index 398428f89a4ba..0ad1ff7370a9a 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts +++ b/x-pack/plugins/monitoring/server/lib/apm/_get_time_of_last_event.ts @@ -5,9 +5,7 @@ * 2.0. */ -// @ts-ignore import { createApmQuery } from './create_apm_query'; -// @ts-ignore import { ApmClusterMetric } from '../metrics'; import { LegacyRequest } from '../../types'; import { ElasticsearchResponse } from '../../../common/types/es'; diff --git a/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.js b/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.ts similarity index 63% rename from x-pack/plugins/monitoring/server/lib/apm/create_apm_query.js rename to x-pack/plugins/monitoring/server/lib/apm/create_apm_query.ts index 1680fcdfdb228..63c56607a68e6 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.js +++ b/x-pack/plugins/monitoring/server/lib/apm/create_apm_query.ts @@ -5,8 +5,7 @@ * 2.0. */ -import { defaults } from 'lodash'; -import { ApmMetric } from '../metrics'; +import { ApmMetric, ApmMetricFields } from '../metrics'; import { createQuery } from '../create_query'; /** @@ -14,14 +13,23 @@ import { createQuery } from '../create_query'; * * @param {Object} options The options to pass to {@code createQuery} */ -export function createApmQuery(options = {}) { - options = defaults(options, { - filters: [], +export function createApmQuery(options: { + filters?: any[]; + types?: string[]; + metric?: ApmMetricFields; + uuid?: string; + clusterUuid: string; + start?: number; + end?: number; +}) { + const opts = { + filters: [] as any[], metric: ApmMetric.getMetricFields(), types: ['stats', 'beats_stats'], - }); + ...(options ?? {}), + }; - options.filters.push({ + opts.filters.push({ bool: { must: { term: { @@ -31,5 +39,5 @@ export function createApmQuery(options = {}) { }, }); - return createQuery(options); + return createQuery(opts); } diff --git a/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts b/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts index 3721bf873a417..5b2f8424a566d 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts +++ b/x-pack/plugins/monitoring/server/lib/apm/get_apm_info.ts @@ -66,7 +66,7 @@ export function handleResponse( eventsTotal: getDiffCalculation(eventsTotalLast, eventsTotalFirst), eventsEmitted: getDiffCalculation(eventsEmittedLast, eventsEmittedFirst), eventsDropped: getDiffCalculation(eventsDroppedLast, eventsDroppedFirst), - bytesWritten: getDiffCalculation(bytesWrittenLast, bytesWrittenFirst), + bytesWritten: getDiffCalculation(Number(bytesWrittenLast), Number(bytesWrittenFirst)), config: { container: config.get('monitoring.ui.container.apm.enabled'), }, diff --git a/x-pack/plugins/monitoring/server/lib/apm/get_apms.ts b/x-pack/plugins/monitoring/server/lib/apm/get_apms.ts index be3bb6fdfd661..7089a0507107a 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/get_apms.ts +++ b/x-pack/plugins/monitoring/server/lib/apm/get_apms.ts @@ -49,9 +49,11 @@ export function handleResponse(response: ElasticsearchResponse, start: number, e // add the beat const rateOptions = { - hitTimestamp: stats?.timestamp ?? hit._source['@timestamp'], + hitTimestamp: stats?.timestamp ?? hit._source['@timestamp'] ?? null, earliestHitTimestamp: - earliestStats?.timestamp ?? hit.inner_hits?.earliest.hits?.hits[0]._source['@timestamp'], + earliestStats?.timestamp ?? + hit.inner_hits?.earliest.hits?.hits[0]._source['@timestamp'] ?? + null, timeWindowMin: start, timeWindowMax: end, }; diff --git a/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.js b/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.ts similarity index 85% rename from x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.js rename to x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.ts index 0c96e0e230585..e99ce0da1ef10 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.js +++ b/x-pack/plugins/monitoring/server/lib/apm/get_apms_for_clusters.ts @@ -5,14 +5,15 @@ * 2.0. */ -import { get } from 'lodash'; +import { LegacyRequest, Cluster } from '../../types'; import { checkParam } from '../error_missing_required'; import { createApmQuery } from './create_apm_query'; import { ApmMetric } from '../metrics'; import { apmAggResponseHandler, apmUuidsAgg, apmAggFilterPath } from './_apm_stats'; import { getTimeOfLastEvent } from './_get_time_of_last_event'; +import { ElasticsearchResponse } from '../../../common/types/es'; -export function handleResponse(clusterUuid, response) { +export function handleResponse(clusterUuid: string, response: ElasticsearchResponse) { const { apmTotal, totalEvents, memRss, versions } = apmAggResponseHandler(response); // combine stats @@ -31,7 +32,11 @@ export function handleResponse(clusterUuid, response) { }; } -export function getApmsForClusters(req, apmIndexPattern, clusters) { +export function getApmsForClusters( + req: LegacyRequest, + apmIndexPattern: string, + clusters: Cluster[] +) { checkParam(apmIndexPattern, 'apmIndexPattern in apms/getApmsForClusters'); const start = req.payload.timeRange.min; @@ -42,7 +47,7 @@ export function getApmsForClusters(req, apmIndexPattern, clusters) { return Promise.all( clusters.map(async (cluster) => { - const clusterUuid = get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid); + const clusterUuid = cluster.elasticsearch?.cluster?.id ?? cluster.cluster_uuid; const params = { index: apmIndexPattern, size: 0, diff --git a/x-pack/plugins/monitoring/server/lib/apm/get_stats.js b/x-pack/plugins/monitoring/server/lib/apm/get_stats.ts similarity index 80% rename from x-pack/plugins/monitoring/server/lib/apm/get_stats.js rename to x-pack/plugins/monitoring/server/lib/apm/get_stats.ts index 2abd81e325f5e..ea71229bac816 100644 --- a/x-pack/plugins/monitoring/server/lib/apm/get_stats.js +++ b/x-pack/plugins/monitoring/server/lib/apm/get_stats.ts @@ -6,16 +6,17 @@ */ import moment from 'moment'; +import { LegacyRequest } from '../../types'; import { checkParam } from '../error_missing_required'; import { createApmQuery } from './create_apm_query'; import { apmAggFilterPath, apmUuidsAgg, apmAggResponseHandler } from './_apm_stats'; import { getTimeOfLastEvent } from './_get_time_of_last_event'; +import type { ElasticsearchResponse } from '../../../common/types/es'; -export function handleResponse(...args) { - const { apmTotal, totalEvents, bytesSent } = apmAggResponseHandler(...args); +export function handleResponse(response: ElasticsearchResponse) { + const { apmTotal, totalEvents } = apmAggResponseHandler(response); return { - bytesSent, totalEvents, apms: { total: apmTotal, @@ -23,7 +24,7 @@ export function handleResponse(...args) { }; } -export async function getStats(req, apmIndexPattern, clusterUuid) { +export async function getStats(req: LegacyRequest, apmIndexPattern: string, clusterUuid: string) { checkParam(apmIndexPattern, 'apmIndexPattern in getBeats'); const config = req.server.config(); @@ -60,7 +61,7 @@ export async function getStats(req, apmIndexPattern, clusterUuid) { }), ]); - const formattedResponse = handleResponse(response, start, end); + const formattedResponse = handleResponse(response); return { ...formattedResponse, timeOfLastEvent, diff --git a/x-pack/plugins/monitoring/server/lib/apm/index.js b/x-pack/plugins/monitoring/server/lib/apm/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/apm/index.js rename to x-pack/plugins/monitoring/server/lib/apm/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/beats/__fixtures__/get_listing_response.js b/x-pack/plugins/monitoring/server/lib/beats/__fixtures__/get_listing_response.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/beats/__fixtures__/get_listing_response.js rename to x-pack/plugins/monitoring/server/lib/beats/__fixtures__/get_listing_response.ts diff --git a/x-pack/plugins/monitoring/server/lib/beats/_beats_stats.js b/x-pack/plugins/monitoring/server/lib/beats/_beats_stats.ts similarity index 74% rename from x-pack/plugins/monitoring/server/lib/beats/_beats_stats.js rename to x-pack/plugins/monitoring/server/lib/beats/_beats_stats.ts index 0d4dc0ba59d18..c2ddadcf7ebf4 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/_beats_stats.js +++ b/x-pack/plugins/monitoring/server/lib/beats/_beats_stats.ts @@ -5,9 +5,10 @@ * 2.0. */ -import { upperFirst, get } from 'lodash'; +import { upperFirst } from 'lodash'; +import type { BeatsElasticsearchResponse, BucketCount } from './types'; -export const getDiffCalculation = (max, min) => { +export const getDiffCalculation = (max: number | null, min: number | null) => { // no need to test max >= 0, but min <= 0 which is normal for a derivative after restart // because we are aggregating/collapsing on ephemeral_ids if (max !== null && min !== null && max >= 0 && min >= 0 && max >= min) { @@ -27,7 +28,7 @@ export const beatsAggFilterPath = [ 'aggregations.max_bytes_sent_total.value', ]; -export const beatsUuidsAgg = (maxBucketSize) => ({ +export const beatsUuidsAgg = (maxBucketSize: string) => ({ types: { terms: { field: 'beats_stats.beat.type', @@ -98,24 +99,24 @@ export const beatsUuidsAgg = (maxBucketSize) => ({ }, }); -export const beatsAggResponseHandler = (response) => { +export const beatsAggResponseHandler = (response?: BeatsElasticsearchResponse) => { // beat types stat - const buckets = get(response, 'aggregations.types.buckets', []); - const beatTotal = get(response, 'aggregations.total.value', 0); - const beatTypes = buckets.reduce((types, typeBucket) => { + const buckets = response?.aggregations?.types?.buckets ?? []; + const beatTotal = response?.aggregations?.total.value ?? 0; + const beatTypes = buckets.reduce((types: BucketCount<{ type: string }>, typeBucket) => { return [ ...types, { type: upperFirst(typeBucket.key), - count: get(typeBucket, 'uuids.buckets.length'), + count: typeBucket.uuids.buckets.length, }, ]; }, []); - const eventsTotalMax = get(response, 'aggregations.max_events_total.value', 0); - const eventsTotalMin = get(response, 'aggregations.min_events_total.value', 0); - const bytesSentMax = get(response, 'aggregations.max_bytes_sent_total.value', 0); - const bytesSentMin = get(response, 'aggregations.min_bytes_sent_total.value', 0); + const eventsTotalMax = response?.aggregations?.max_events_total.value ?? 0; + const eventsTotalMin = response?.aggregations?.min_events_total.value ?? 0; + const bytesSentMax = response?.aggregations?.max_bytes_sent_total.value ?? 0; + const bytesSentMin = response?.aggregations?.min_bytes_sent_total.value ?? 0; return { beatTotal, diff --git a/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.js b/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.ts similarity index 71% rename from x-pack/plugins/monitoring/server/lib/beats/create_beats_query.js rename to x-pack/plugins/monitoring/server/lib/beats/create_beats_query.ts index c6ec39ed3ba2b..b013cd8234c40 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.js +++ b/x-pack/plugins/monitoring/server/lib/beats/create_beats_query.ts @@ -5,8 +5,7 @@ * 2.0. */ -import { defaults } from 'lodash'; -import { BeatsMetric } from '../metrics'; +import { BeatsMetric, BeatsMetricFields } from '../metrics'; import { createQuery } from '../create_query'; /** @@ -17,15 +16,24 @@ import { createQuery } from '../create_query'; * * @param {Object} options The options to pass to {@code createQuery} */ -export function createBeatsQuery(options = {}) { - options = defaults(options, { - filters: [], +export function createBeatsQuery(options: { + filters?: any[]; + types?: string[]; + metric?: BeatsMetricFields; + uuid?: string; + clusterUuid: string; + start?: number; + end?: number; +}) { + const opts = { + filters: [] as any[], metric: BeatsMetric.getMetricFields(), types: ['stats', 'beats_stats'], - }); + ...(options ?? {}), + }; // avoid showing APM Server stats alongside other Beats because APM Server will have its own UI - options.filters.push({ + opts.filters.push({ bool: { must_not: { term: { @@ -35,5 +43,5 @@ export function createBeatsQuery(options = {}) { }, }); - return createQuery(options); + return createQuery(opts); } diff --git a/x-pack/plugins/monitoring/server/lib/beats/get_beat_summary.ts b/x-pack/plugins/monitoring/server/lib/beats/get_beat_summary.ts index d67f32e64ba71..07169b54cb61b 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/get_beat_summary.ts +++ b/x-pack/plugins/monitoring/server/lib/beats/get_beat_summary.ts @@ -11,7 +11,7 @@ import { ElasticsearchResponse } from '../../../common/types/es'; // @ts-ignore import { checkParam } from '../error_missing_required'; // @ts-ignore -import { createBeatsQuery } from './create_beats_query.js'; +import { createBeatsQuery } from './create_beats_query'; // @ts-ignore import { getDiffCalculation } from './_beats_stats'; @@ -67,7 +67,7 @@ export function handleResponse(response: ElasticsearchResponse, beatUuid: string eventsTotal: getDiffCalculation(eventsTotalLast, eventsTotalFirst) ?? null, eventsEmitted: getDiffCalculation(eventsEmittedLast, eventsEmittedFirst) ?? null, eventsDropped: getDiffCalculation(eventsDroppedLast, eventsDroppedFirst) ?? null, - bytesWritten: getDiffCalculation(bytesWrittenLast, bytesWrittenFirst) ?? null, + bytesWritten: getDiffCalculation(Number(bytesWrittenLast), Number(bytesWrittenFirst)) ?? null, handlesHardLimit, handlesSoftLimit, }; diff --git a/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts b/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts index fff2b55cf2616..85a4bb61f5573 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts +++ b/x-pack/plugins/monitoring/server/lib/beats/get_beats.ts @@ -19,14 +19,14 @@ import { LegacyRequest } from '../../types'; import { ElasticsearchResponse } from '../../../common/types/es'; interface Beat { - uuid: string | undefined; - name: string | undefined; - type: string | undefined; - output: string | undefined; + uuid?: string; + name?: string; + type?: string; + output?: string; total_events_rate: number; bytes_sent_rate: number; - memory: number | undefined; - version: string | undefined; + memory?: number; + version?: string; errors: any; } @@ -63,9 +63,9 @@ export function handleResponse(response: ElasticsearchResponse, start: number, e // add the beat const rateOptions = { - hitTimestamp: stats?.timestamp ?? hit._source['@timestamp'], + hitTimestamp: stats?.timestamp ?? hit._source['@timestamp']!, earliestHitTimestamp: - earliestStats?.timestamp ?? hit.inner_hits?.earliest.hits?.hits[0]._source['@timestamp'], + earliestStats?.timestamp ?? hit.inner_hits?.earliest.hits?.hits[0]._source['@timestamp']!, timeWindowMin: start, timeWindowMax: end, }; @@ -96,8 +96,8 @@ export function handleResponse(response: ElasticsearchResponse, start: number, e name: stats?.beat?.name, type: upperFirst(stats?.beat?.type), output: upperFirst(statsMetrics?.libbeat?.output?.type), - total_events_rate: totalEventsRate, - bytes_sent_rate: bytesSentRate, + total_events_rate: totalEventsRate!, + bytes_sent_rate: bytesSentRate!, errors, memory: hit._source.beats_stats?.metrics?.beat?.memstats?.memory_alloc ?? diff --git a/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.js b/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.ts similarity index 79% rename from x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.js rename to x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.ts index e7c4771dd601c..3a0720f7ca195 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.js +++ b/x-pack/plugins/monitoring/server/lib/beats/get_beats_for_clusters.ts @@ -5,13 +5,14 @@ * 2.0. */ -import { get } from 'lodash'; import { checkParam } from '../error_missing_required'; import { BeatsClusterMetric } from '../metrics'; import { createBeatsQuery } from './create_beats_query'; import { beatsAggFilterPath, beatsUuidsAgg, beatsAggResponseHandler } from './_beats_stats'; +import type { ElasticsearchResponse } from '../../../common/types/es'; +import { LegacyRequest, Cluster } from '../../types'; -export function handleResponse(clusterUuid, response) { +export function handleResponse(clusterUuid: string, response: ElasticsearchResponse) { const { beatTotal, beatTypes, totalEvents, bytesSent } = beatsAggResponseHandler(response); // combine stats @@ -30,7 +31,11 @@ export function handleResponse(clusterUuid, response) { }; } -export function getBeatsForClusters(req, beatsIndexPattern, clusters) { +export function getBeatsForClusters( + req: LegacyRequest, + beatsIndexPattern: string, + clusters: Cluster[] +) { checkParam(beatsIndexPattern, 'beatsIndexPattern in beats/getBeatsForClusters'); const start = req.payload.timeRange.min; @@ -40,7 +45,7 @@ export function getBeatsForClusters(req, beatsIndexPattern, clusters) { return Promise.all( clusters.map(async (cluster) => { - const clusterUuid = get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid); + const clusterUuid = cluster.elasticsearch?.cluster?.id ?? cluster.cluster_uuid; const params = { index: beatsIndexPattern, size: 0, @@ -53,7 +58,7 @@ export function getBeatsForClusters(req, beatsIndexPattern, clusters) { clusterUuid, metric: BeatsClusterMetric.getMetricFields(), // override default of BeatMetric.getMetricFields }), - aggs: beatsUuidsAgg(maxBucketSize), + aggs: beatsUuidsAgg(maxBucketSize!), }, }; diff --git a/x-pack/plugins/monitoring/server/lib/beats/get_latest_stats.js b/x-pack/plugins/monitoring/server/lib/beats/get_latest_stats.ts similarity index 72% rename from x-pack/plugins/monitoring/server/lib/beats/get_latest_stats.js rename to x-pack/plugins/monitoring/server/lib/beats/get_latest_stats.ts index fb40df115d19a..684b0d6301e1f 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/get_latest_stats.js +++ b/x-pack/plugins/monitoring/server/lib/beats/get_latest_stats.ts @@ -5,17 +5,19 @@ * 2.0. */ -import { upperFirst, get } from 'lodash'; +import { upperFirst } from 'lodash'; +import { LegacyRequest } from '../../types'; import { checkParam } from '../error_missing_required'; import { createBeatsQuery } from './create_beats_query'; +import type { BeatsElasticsearchResponse, BucketCount } from './types'; -export function handleResponse(response) { - const aggs = get(response, 'aggregations'); +export function handleResponse(response?: BeatsElasticsearchResponse) { + const aggs = response?.aggregations; - const getTimeRangeCount = (name) => { - const lastActiveBuckets = get(aggs, 'active_counts.buckets', []); + const getTimeRangeCount = (name: string) => { + const lastActiveBuckets = aggs?.active_counts?.buckets ?? []; const rangeBucket = lastActiveBuckets.find((bucket) => bucket.key === name); - return get(rangeBucket, 'uuids.buckets.length'); + return rangeBucket?.uuids.buckets.length; }; // aggregations are not ordered, so we find the bucket for each timestamp range @@ -34,25 +36,31 @@ export function handleResponse(response) { { range: 'last1d', count: last1dCount }, ]; - const latestVersions = get(aggs, 'versions.buckets', []).reduce((accum, current) => { - return [ - ...accum, - { - version: current.key, - count: get(current, 'uuids.buckets.length'), - }, - ]; - }, []); + const latestVersions = (aggs?.versions?.buckets ?? []).reduce( + (accum: BucketCount<{ version: string }>, current) => { + return [ + ...accum, + { + version: current.key, + count: current.uuids.buckets.length, + }, + ]; + }, + [] + ); - const latestTypes = get(aggs, 'types.buckets', []).reduce((accum, current) => { - return [ - ...accum, - { - type: upperFirst(current.key), - count: get(current, 'uuids.buckets.length'), - }, - ]; - }, []); + const latestTypes = (aggs?.types?.buckets ?? []).reduce( + (accum: BucketCount<{ type: string }>, current) => { + return [ + ...accum, + { + type: upperFirst(current.key), + count: current.uuids.buckets.length, + }, + ]; + }, + [] + ); return { latestActive, @@ -61,7 +69,7 @@ export function handleResponse(response) { }; } -export function getLatestStats(req, beatsIndexPattern, clusterUuid) { +export function getLatestStats(req: LegacyRequest, beatsIndexPattern: string, clusterUuid: string) { checkParam(beatsIndexPattern, 'beatsIndexPattern in getBeats'); const config = req.server.config(); diff --git a/x-pack/plugins/monitoring/server/lib/beats/get_stats.js b/x-pack/plugins/monitoring/server/lib/beats/get_stats.ts similarity index 73% rename from x-pack/plugins/monitoring/server/lib/beats/get_stats.js rename to x-pack/plugins/monitoring/server/lib/beats/get_stats.ts index 3af51d909697f..be3f3d88e0709 100644 --- a/x-pack/plugins/monitoring/server/lib/beats/get_stats.js +++ b/x-pack/plugins/monitoring/server/lib/beats/get_stats.ts @@ -6,12 +6,14 @@ */ import moment from 'moment'; +import type { BeatsElasticsearchResponse } from './types'; +import { LegacyRequest } from '../../types'; import { checkParam } from '../error_missing_required'; import { createBeatsQuery } from './create_beats_query'; import { beatsAggFilterPath, beatsUuidsAgg, beatsAggResponseHandler } from './_beats_stats'; -export function handleResponse(...args) { - const { beatTotal, beatTypes, totalEvents, bytesSent } = beatsAggResponseHandler(...args); +export function handleResponse(response: BeatsElasticsearchResponse) { + const { beatTotal, beatTypes, totalEvents, bytesSent } = beatsAggResponseHandler(response); return { total: beatTotal, @@ -23,7 +25,7 @@ export function handleResponse(...args) { }; } -export async function getStats(req, beatsIndexPattern, clusterUuid) { +export async function getStats(req: LegacyRequest, beatsIndexPattern: string, clusterUuid: string) { checkParam(beatsIndexPattern, 'beatsIndexPattern in getBeats'); const config = req.server.config(); @@ -42,12 +44,12 @@ export async function getStats(req, beatsIndexPattern, clusterUuid) { end, clusterUuid, }), - aggs: beatsUuidsAgg(maxBucketSize), + aggs: beatsUuidsAgg(maxBucketSize!), }, }; const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); - const response = await callWithRequest(req, 'search', params); + const response: BeatsElasticsearchResponse = await callWithRequest(req, 'search', params); - return handleResponse(response, start, end); + return handleResponse(response); } diff --git a/x-pack/plugins/monitoring/server/lib/beats/index.js b/x-pack/plugins/monitoring/server/lib/beats/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/beats/index.js rename to x-pack/plugins/monitoring/server/lib/beats/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/beats/types.ts b/x-pack/plugins/monitoring/server/lib/beats/types.ts new file mode 100644 index 0000000000000..516a4ba587524 --- /dev/null +++ b/x-pack/plugins/monitoring/server/lib/beats/types.ts @@ -0,0 +1,38 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { ElasticsearchResponse } from '../../../common/types/es'; +import type { Aggregation } from '../../types'; + +export type BucketCount = Array< + T & { + count: number; + } +>; + +export interface BeatsElasticsearchResponse extends ElasticsearchResponse { + aggregations?: { + types?: Aggregation; + active_counts?: Aggregation; + versions?: Aggregation; + total: { + value: number; + }; + max_events_total: { + value: number; + }; + min_events_total: { + value: number; + }; + max_bytes_sent_total: { + value: number; + }; + min_bytes_sent_total: { + value: number; + }; + }; +} diff --git a/x-pack/plugins/monitoring/server/lib/calculate_auto.test.js b/x-pack/plugins/monitoring/server/lib/calculate_auto.test.js index 93a1d1a40cedc..934781f7786a9 100644 --- a/x-pack/plugins/monitoring/server/lib/calculate_auto.test.js +++ b/x-pack/plugins/monitoring/server/lib/calculate_auto.test.js @@ -5,7 +5,7 @@ * 2.0. */ -import { calculateAuto } from './calculate_auto.js'; +import { calculateAuto } from './calculate_auto'; import _ from 'lodash'; import moment from 'moment'; diff --git a/x-pack/plugins/monitoring/server/lib/calculate_auto.js b/x-pack/plugins/monitoring/server/lib/calculate_auto.ts similarity index 75% rename from x-pack/plugins/monitoring/server/lib/calculate_auto.js rename to x-pack/plugins/monitoring/server/lib/calculate_auto.ts index a6ffda39c79f8..817f49d1a5868 100644 --- a/x-pack/plugins/monitoring/server/lib/calculate_auto.js +++ b/x-pack/plugins/monitoring/server/lib/calculate_auto.ts @@ -5,7 +5,9 @@ * 2.0. */ -import moment from 'moment'; +import moment, { Duration } from 'moment'; + +type RoundingRule = [number | Duration, Duration]; const d = moment.duration; const roundingRules = [ @@ -25,18 +27,22 @@ const roundingRules = [ [d(3, 'week'), d(1, 'week')], [d(1, 'year'), d(1, 'month')], [Infinity, d(1, 'year')], -]; +] as RoundingRule[]; -function find(rules, check) { - function pick(buckets, duration) { - const target = duration / buckets; +function find( + rules: RoundingRule[], + check: (b: number | Duration, i: Duration, t: number) => Duration | void +) { + function pick(buckets?: number, duration?: Duration): Duration { + if (!buckets || !duration) return moment.duration(0); + const target = duration.asMilliseconds() / buckets; let lastResp; for (let i = 0; i < rules.length; i++) { const rule = rules[i]; const resp = check(rule[0], rule[1], target); - if (resp == null) { + if (resp === null || resp === undefined) { if (lastResp) { return lastResp; } @@ -51,11 +57,9 @@ function find(rules, check) { return moment.duration(ms, 'ms'); } - return function (buckets, duration) { + return function (buckets: number, duration: Duration) { const interval = pick(buckets, duration); - if (interval) { - return moment.duration(interval._data); - } + return interval; }; } diff --git a/x-pack/plugins/monitoring/server/lib/calculate_availability.js b/x-pack/plugins/monitoring/server/lib/calculate_availability.ts similarity index 90% rename from x-pack/plugins/monitoring/server/lib/calculate_availability.js rename to x-pack/plugins/monitoring/server/lib/calculate_availability.ts index 81b8273990793..96a89ee62664b 100644 --- a/x-pack/plugins/monitoring/server/lib/calculate_availability.js +++ b/x-pack/plugins/monitoring/server/lib/calculate_availability.ts @@ -10,7 +10,7 @@ import moment from 'moment'; * Return `true` if timestamp of last update is younger than 10 minutes ago * If older than, it indicates cluster/instance is offline */ -export function calculateAvailability(timestamp) { +export function calculateAvailability(timestamp: string) { const lastUpdate = moment(timestamp); // converts to local time return lastUpdate.isAfter(moment().subtract(10, 'minutes')); // compares with local time } diff --git a/x-pack/plugins/monitoring/server/lib/calculate_overall_status.js b/x-pack/plugins/monitoring/server/lib/calculate_overall_status.ts similarity index 89% rename from x-pack/plugins/monitoring/server/lib/calculate_overall_status.js rename to x-pack/plugins/monitoring/server/lib/calculate_overall_status.ts index 7a0edbdb49e62..78cbb9935045f 100644 --- a/x-pack/plugins/monitoring/server/lib/calculate_overall_status.js +++ b/x-pack/plugins/monitoring/server/lib/calculate_overall_status.ts @@ -9,7 +9,7 @@ * A reduce that takes statuses from different products in a cluster and boil * it down into a single status */ -export function calculateOverallStatus(set) { +export function calculateOverallStatus(set: Array) { return set.reduce((result, current) => { if (!current) { return result; diff --git a/x-pack/plugins/monitoring/server/lib/calculate_rate.js b/x-pack/plugins/monitoring/server/lib/calculate_rate.ts similarity index 81% rename from x-pack/plugins/monitoring/server/lib/calculate_rate.js rename to x-pack/plugins/monitoring/server/lib/calculate_rate.ts index 04d43ca935b9d..3e9bdbb5e20f4 100644 --- a/x-pack/plugins/monitoring/server/lib/calculate_rate.js +++ b/x-pack/plugins/monitoring/server/lib/calculate_rate.ts @@ -20,6 +20,16 @@ import moment from 'moment'; * 4. From that subtract the earliest timestamp from the time picker * This gives you the denominator in millis. Divide it by 1000 to convert to seconds */ + +interface CalculateRateProps { + hitTimestamp: string | null; + earliestHitTimestamp: string | null; + latestTotal?: string | number | null; + earliestTotal?: string | number | null; + timeWindowMin: number; + timeWindowMax: number; +} + export function calculateRate({ hitTimestamp = null, earliestHitTimestamp = null, @@ -27,7 +37,7 @@ export function calculateRate({ earliestTotal = null, timeWindowMin, timeWindowMax, -} = {}) { +}: CalculateRateProps) { const nullResult = { rate: null, isEstimate: false, @@ -58,9 +68,9 @@ export function calculateRate({ let rate = null; let isEstimate = false; if (millisDelta !== 0) { - const totalDelta = latestTotal - earliestTotal; + const totalDelta = Number(latestTotal) - Number(earliestTotal); if (totalDelta < 0) { - rate = latestTotal / (millisDelta / 1000); // a restart caused an unwanted negative rate + rate = Number(latestTotal) / (millisDelta / 1000); // a restart caused an unwanted negative rate isEstimate = true; } else { rate = totalDelta / (millisDelta / 1000); diff --git a/x-pack/plugins/monitoring/server/lib/calculate_timeseries_interval.js b/x-pack/plugins/monitoring/server/lib/calculate_timeseries_interval.ts similarity index 67% rename from x-pack/plugins/monitoring/server/lib/calculate_timeseries_interval.js rename to x-pack/plugins/monitoring/server/lib/calculate_timeseries_interval.ts index c304e75accd34..b4ac193283849 100644 --- a/x-pack/plugins/monitoring/server/lib/calculate_timeseries_interval.js +++ b/x-pack/plugins/monitoring/server/lib/calculate_timeseries_interval.ts @@ -9,11 +9,14 @@ import moment from 'moment'; import { calculateAuto } from './calculate_auto'; export function calculateTimeseriesInterval( - lowerBoundInMsSinceEpoch, - upperBoundInMsSinceEpoch, - minIntervalSeconds + lowerBoundInMsSinceEpoch: number, + upperBoundInMsSinceEpoch: number, + minIntervalSeconds: number ) { const duration = moment.duration(upperBoundInMsSinceEpoch - lowerBoundInMsSinceEpoch, 'ms'); - return Math.max(minIntervalSeconds, calculateAuto(100, duration).asSeconds()); + return Math.max( + !isNaN(minIntervalSeconds) ? minIntervalSeconds : 0, + calculateAuto(100, duration).asSeconds() + ); } diff --git a/x-pack/plugins/monitoring/server/lib/ccs_utils.js b/x-pack/plugins/monitoring/server/lib/ccs_utils.ts similarity index 88% rename from x-pack/plugins/monitoring/server/lib/ccs_utils.js rename to x-pack/plugins/monitoring/server/lib/ccs_utils.ts index 08ed8d5a7b35a..1d899456913b9 100644 --- a/x-pack/plugins/monitoring/server/lib/ccs_utils.js +++ b/x-pack/plugins/monitoring/server/lib/ccs_utils.ts @@ -6,8 +6,18 @@ */ import { isFunction, get } from 'lodash'; +import type { MonitoringConfig } from '../config'; -export function appendMetricbeatIndex(config, indexPattern, ccs, bypass = false) { +type Config = Partial & { + get?: (key: string) => any; +}; + +export function appendMetricbeatIndex( + config: Config, + indexPattern: string, + ccs?: string, + bypass: boolean = false +) { if (bypass) { return indexPattern; } @@ -39,7 +49,12 @@ export function appendMetricbeatIndex(config, indexPattern, ccs, bypass = false) * @param {String} ccs The optional cluster-prefix to prepend. * @return {String} The index pattern with the {@code cluster} prefix appropriately prepended. */ -export function prefixIndexPattern(config, indexPattern, ccs, monitoringIndicesOnly = false) { +export function prefixIndexPattern( + config: Config, + indexPattern: string, + ccs?: string, + monitoringIndicesOnly: boolean = false +) { let ccsEnabled = false; // TODO: NP // This function is called with both NP config and LP config @@ -102,7 +117,7 @@ export function prefixIndexPattern(config, indexPattern, ccs, monitoringIndicesO * @param {String} indexName The index's name, possibly including the cross-cluster prefix * @return {String} {@code null} if none. Otherwise the cluster prefix. */ -export function parseCrossClusterPrefix(indexName) { +export function parseCrossClusterPrefix(indexName: string) { const colonIndex = indexName.indexOf(':'); if (colonIndex === -1) { diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_stats.js b/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_stats.ts similarity index 91% rename from x-pack/plugins/monitoring/server/lib/cluster/get_cluster_stats.js rename to x-pack/plugins/monitoring/server/lib/cluster/get_cluster_stats.ts index 4dece136158ac..c671765a44548 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_stats.js +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_cluster_stats.ts @@ -6,8 +6,9 @@ */ import { badRequest, notFound } from '@hapi/boom'; -import { getClustersStats } from './get_clusters_stats'; import { i18n } from '@kbn/i18n'; +import { LegacyRequest } from '../../types'; +import { getClustersStats } from './get_clusters_stats'; /** * This will fetch the cluster stats and cluster state as a single object for the cluster specified by the {@code req}. @@ -17,7 +18,7 @@ import { i18n } from '@kbn/i18n'; * @param {String} clusterUuid The requested cluster's UUID * @return {Promise} The object cluster response. */ -export function getClusterStats(req, esIndexPattern, clusterUuid) { +export function getClusterStats(req: LegacyRequest, esIndexPattern: string, clusterUuid: string) { if (!clusterUuid) { throw badRequest( i18n.translate('xpack.monitoring.clusterStats.uuidNotSpecifiedErrorMessage', { diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts similarity index 90% rename from x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js rename to x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts index 9ef309cee7312..ab421312244f7 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.ts @@ -6,8 +6,9 @@ */ import { notFound } from '@hapi/boom'; -import { set } from '@elastic/safer-lodash-set'; import { get } from 'lodash'; +import { set } from '@elastic/safer-lodash-set'; +import { i18n } from '@kbn/i18n'; import { getClustersStats } from './get_clusters_stats'; import { flagSupportedClusters } from './flag_supported_clusters'; import { getMlJobsForCluster } from '../elasticsearch'; @@ -15,7 +16,7 @@ import { getKibanasForClusters } from '../kibana'; import { getLogstashForClusters } from '../logstash'; import { getLogstashPipelineIds } from '../logstash/get_pipeline_ids'; import { getBeatsForClusters } from '../beats'; -import { getClustersSummary } from './get_clusters_summary'; +import { getClustersSummary, EnhancedClusters } from './get_clusters_summary'; import { STANDALONE_CLUSTER_CLUSTER_UUID, CODE_PATH_ML, @@ -26,21 +27,27 @@ import { CODE_PATH_BEATS, CODE_PATH_APM, } from '../../../common/constants'; + import { getApmsForClusters } from '../apm/get_apms_for_clusters'; -import { i18n } from '@kbn/i18n'; import { checkCcrEnabled } from '../elasticsearch/ccr'; import { fetchStatus } from '../alerts/fetch_status'; import { getStandaloneClusterDefinition, hasStandaloneClusters } from '../standalone_clusters'; import { getLogTypes } from '../logs'; import { isInCodePath } from './is_in_code_path'; +import { LegacyRequest, Cluster } from '../../types'; /** * Get all clusters or the cluster associated with {@code clusterUuid} when it is defined. */ export async function getClustersFromRequest( - req, - indexPatterns, - { clusterUuid, start, end, codePaths } = {} + req: LegacyRequest, + indexPatterns: { [x: string]: string }, + { + clusterUuid, + start, + end, + codePaths, + }: { clusterUuid: string; start: number; end: number; codePaths: string[] } ) { const { esIndexPattern, @@ -54,7 +61,7 @@ export async function getClustersFromRequest( const config = req.server.config(); const isStandaloneCluster = clusterUuid === STANDALONE_CLUSTER_CLUSTER_UUID; - let clusters = []; + let clusters: Cluster[] = []; if (isStandaloneCluster) { clusters.push(getStandaloneClusterDefinition()); @@ -120,7 +127,6 @@ export async function getClustersFromRequest( const rulesClient = req.getRulesClient(); const alertStatus = await fetchStatus( rulesClient, - req.server.plugins.monitoring.info, undefined, clusters.map((cluster) => get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid)) ); @@ -139,16 +145,16 @@ export async function getClustersFromRequest( list: Object.keys(alertStatus).reduce((accum, alertName) => { const value = alertStatus[alertName]; if (value.states && value.states.length) { - accum[alertName] = { + Reflect.set(accum, alertName, { ...value, states: value.states.filter( (state) => state.state.cluster.clusterUuid === get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid) ), - }; + }); } else { - accum[alertName] = value; + Reflect.set(accum, alertName, value); } return accum; }, {}), @@ -197,7 +203,7 @@ export async function getClustersFromRequest( ); // withhold LS overview stats until there is at least 1 pipeline if (logstash.clusterUuid === clusterUuid && !pipelines.length) { - logstash.stats = {}; + Reflect.set(logstash, 'stats', {}); } set(clusters[clusterIndex], 'logstash', logstash.stats); }); @@ -225,18 +231,18 @@ export async function getClustersFromRequest( get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid) === apm.clusterUuid ); if (clusterIndex >= 0) { - const { stats, config } = apm; - clusters[clusterIndex].apm = { + const { stats, config: apmConfig } = apm; + Reflect.set(clusters[clusterIndex], 'apm', { ...stats, - config, - }; + config: apmConfig, + }); } }); // check ccr configuration const isCcrEnabled = await checkCcrEnabled(req, esIndexPattern); - const kibanaUuid = config.get('server.uuid'); + const kibanaUuid = config.get('server.uuid')!; - return getClustersSummary(req.server, clusters, kibanaUuid, isCcrEnabled); + return getClustersSummary(req.server, clusters as EnhancedClusters[], kibanaUuid, isCcrEnabled); } diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.ts index 955c4d3d3b625..e29c1ad5292f9 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_summary.ts @@ -16,7 +16,7 @@ import { calculateOverallStatus } from '../calculate_overall_status'; // @ts-ignore import { MonitoringLicenseError } from '../errors/custom_errors'; -type EnhancedClusters = ElasticsearchModifiedSource & { +export type EnhancedClusters = ElasticsearchModifiedSource & { license: ElasticsearchLegacySource['license']; [key: string]: any; }; diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.js b/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts similarity index 88% rename from x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.js rename to x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts index 52f2bb7b19736..d908d6180772e 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.js +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_index_patterns.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { LegacyServer } from '../../types'; import { prefixIndexPattern } from '../ccs_utils'; import { INDEX_PATTERN_ELASTICSEARCH, @@ -14,7 +15,11 @@ import { INDEX_ALERTS, } from '../../../common/constants'; -export function getIndexPatterns(server, additionalPatterns = {}, ccs = '*') { +export function getIndexPatterns( + server: LegacyServer, + additionalPatterns: Record = {}, + ccs: string = '*' +) { const config = server.config(); const esIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_ELASTICSEARCH, ccs); const kbnIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_KIBANA, ccs); diff --git a/x-pack/plugins/monitoring/server/lib/cluster/is_in_code_path.js b/x-pack/plugins/monitoring/server/lib/cluster/is_in_code_path.ts similarity index 86% rename from x-pack/plugins/monitoring/server/lib/cluster/is_in_code_path.js rename to x-pack/plugins/monitoring/server/lib/cluster/is_in_code_path.ts index 2b59fb3c460ea..2f795e5997f05 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/is_in_code_path.js +++ b/x-pack/plugins/monitoring/server/lib/cluster/is_in_code_path.ts @@ -7,7 +7,7 @@ import { CODE_PATH_ALL } from '../../../common/constants'; -export function isInCodePath(codePaths, codePathsToTest) { +export function isInCodePath(codePaths: string[], codePathsToTest: string[]) { if (codePaths.includes(CODE_PATH_ALL)) { return true; } diff --git a/x-pack/plugins/monitoring/server/lib/create_query.test.js b/x-pack/plugins/monitoring/server/lib/create_query.test.js index a1f25d8937b49..60fa6faa79e44 100644 --- a/x-pack/plugins/monitoring/server/lib/create_query.test.js +++ b/x-pack/plugins/monitoring/server/lib/create_query.test.js @@ -8,7 +8,7 @@ import { set } from '@elastic/safer-lodash-set'; import { MissingRequiredError } from './error_missing_required'; import { ElasticsearchMetric } from './metrics'; -import { createQuery } from './create_query.js'; +import { createQuery } from './create_query'; let metric; diff --git a/x-pack/plugins/monitoring/server/lib/create_query.js b/x-pack/plugins/monitoring/server/lib/create_query.ts similarity index 72% rename from x-pack/plugins/monitoring/server/lib/create_query.js rename to x-pack/plugins/monitoring/server/lib/create_query.ts index c9a5ffeca3cee..83817280730f2 100644 --- a/x-pack/plugins/monitoring/server/lib/create_query.js +++ b/x-pack/plugins/monitoring/server/lib/create_query.ts @@ -5,23 +5,37 @@ * 2.0. */ -import { defaults, get } from 'lodash'; -import { MissingRequiredError } from './error_missing_required'; +import { defaults } from 'lodash'; import moment from 'moment'; +import { MissingRequiredError } from './error_missing_required'; import { standaloneClusterFilter } from './standalone_clusters'; import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../common/constants'; -export function createTimeFilter(options) { +export interface TimerangeFilter { + range: { + [x: string]: { + format: 'epoch_millis'; + gte?: number; + lte?: number; + }; + }; +} + +export function createTimeFilter(options: { + start?: number; + end?: number; + metric?: { timestampField: string }; +}) { const { start, end } = options; if (!start && !end) { return null; } - const timestampField = get(options, 'metric.timestampField'); + const timestampField = options.metric?.timestampField; if (!timestampField) { throw new MissingRequiredError('metric.timestampField'); } - const timeRangeFilter = { + const timeRangeFilter: TimerangeFilter = { range: { [timestampField]: { format: 'epoch_millis', @@ -50,9 +64,17 @@ export function createTimeFilter(options) { * @param {Date} options.end - numeric timestamp (optional) * @param {Metric} options.metric - Metric instance or metric fields object @see ElasticsearchMetric.getMetricFields */ -export function createQuery(options) { - options = defaults(options, { filters: [] }); - const { type, types, clusterUuid, uuid, filters } = options; +export function createQuery(options: { + type?: string; + types?: string[]; + filters?: any[]; + clusterUuid: string; + uuid?: string; + start?: number; + end?: number; + metric?: { uuidField?: string; timestampField: string }; +}) { + const { type, types, clusterUuid, uuid, filters } = defaults(options, { filters: [] }); const isFromStandaloneCluster = clusterUuid === STANDALONE_CLUSTER_CLUSTER_UUID; @@ -63,8 +85,8 @@ export function createQuery(options) { typeFilter = { bool: { should: [ - ...types.map((type) => ({ term: { type } })), - ...types.map((type) => ({ term: { 'metricset.name': type } })), + ...types.map((t) => ({ term: { type: t } })), + ...types.map((t) => ({ term: { 'metricset.name': t } })), ], }, }; @@ -78,23 +100,26 @@ export function createQuery(options) { let uuidFilter; // options.uuid can be null, for example getting all the clusters if (uuid) { - const uuidField = get(options, 'metric.uuidField'); + const uuidField = options.metric?.uuidField; if (!uuidField) { throw new MissingRequiredError('options.uuid given but options.metric.uuidField is false'); } uuidFilter = { term: { [uuidField]: uuid } }; } - const timestampField = get(options, 'metric.timestampField'); + const timestampField = options.metric?.timestampField; if (!timestampField) { throw new MissingRequiredError('metric.timestampField'); } const timeRangeFilter = createTimeFilter(options); - const combinedFilters = [typeFilter, clusterUuidFilter, uuidFilter, ...filters]; - if (timeRangeFilter) { - combinedFilters.push(timeRangeFilter); - } + const combinedFilters = [ + typeFilter, + clusterUuidFilter, + uuidFilter, + timeRangeFilter ?? undefined, + ...filters, + ]; if (isFromStandaloneCluster) { combinedFilters.push(standaloneClusterFilter); diff --git a/x-pack/plugins/monitoring/server/lib/details/get_metrics.js b/x-pack/plugins/monitoring/server/lib/details/get_metrics.ts similarity index 75% rename from x-pack/plugins/monitoring/server/lib/details/get_metrics.js rename to x-pack/plugins/monitoring/server/lib/details/get_metrics.ts index da0c2e0b3fcdb..83bb18169ae1e 100644 --- a/x-pack/plugins/monitoring/server/lib/details/get_metrics.js +++ b/x-pack/plugins/monitoring/server/lib/details/get_metrics.ts @@ -6,21 +6,23 @@ */ import moment from 'moment'; -import { isPlainObject } from 'lodash'; import Bluebird from 'bluebird'; import { checkParam } from '../error_missing_required'; import { getSeries } from './get_series'; import { calculateTimeseriesInterval } from '../calculate_timeseries_interval'; import { getTimezone } from '../get_timezone'; +import { LegacyRequest } from '../../types'; + +type Metric = string | { keys: string | string[]; name: string }; export async function getMetrics( - req, - indexPattern, - metricSet = [], - filters = [], + req: LegacyRequest, + indexPattern: string, + metricSet: Metric[] = [], + filters: Array> = [], metricOptions = {}, - numOfBuckets = 0, - groupBy = null + numOfBuckets: number = 0, + groupBy: string | Record | null = null ) { checkParam(indexPattern, 'indexPattern in details/getMetrics'); checkParam(metricSet, 'metricSet in details/getMetrics'); @@ -29,7 +31,7 @@ export async function getMetrics( // TODO: Pass in req parameters as explicit function parameters let min = moment.utc(req.payload.timeRange.min).valueOf(); const max = moment.utc(req.payload.timeRange.max).valueOf(); - const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds'); + const minIntervalSeconds = Number(config.get('monitoring.ui.min_interval_seconds')); const bucketSize = calculateTimeseriesInterval(min, max, minIntervalSeconds); const timezone = await getTimezone(req); @@ -38,11 +40,11 @@ export async function getMetrics( min = max - numOfBuckets * bucketSize * 1000; } - return Bluebird.map(metricSet, (metric) => { + return Bluebird.map(metricSet, (metric: Metric) => { // metric names match the literal metric name, but they can be supplied in groups or individually let metricNames; - if (isPlainObject(metric)) { + if (typeof metric !== 'string') { metricNames = metric.keys; } else { metricNames = [metric]; @@ -57,10 +59,10 @@ export async function getMetrics( }); }); }).then((rows) => { - const data = {}; + const data: Record = {}; metricSet.forEach((key, index) => { // keyName must match the value stored in the html template - const keyName = isPlainObject(key) ? key.name : key; + const keyName = typeof key === 'string' ? key : key.name; data[keyName] = rows[index]; }); diff --git a/x-pack/plugins/monitoring/server/lib/details/get_series.js b/x-pack/plugins/monitoring/server/lib/details/get_series.ts similarity index 74% rename from x-pack/plugins/monitoring/server/lib/details/get_series.js rename to x-pack/plugins/monitoring/server/lib/details/get_series.ts index d06ff950449dc..906c2df29fee0 100644 --- a/x-pack/plugins/monitoring/server/lib/details/get_series.js +++ b/x-pack/plugins/monitoring/server/lib/details/get_series.ts @@ -7,13 +7,36 @@ import { get } from 'lodash'; import moment from 'moment'; +import { ElasticsearchResponse } from '../../../common/types/es'; +import { LegacyRequest, Bucket } from '../../types'; import { checkParam } from '../error_missing_required'; import { metrics } from '../metrics'; -import { createQuery } from '../create_query.js'; +import { createQuery } from '../create_query'; import { formatTimestampToDuration } from '../../../common'; import { NORMALIZED_DERIVATIVE_UNIT, CALCULATE_DURATION_UNTIL } from '../../../common/constants'; import { formatUTCTimestampForTimezone } from '../format_timezone'; +type SeriesBucket = Bucket & { metric_mb_deriv?: { normalized_value: number } }; + +interface Metric { + app: string; + derivative: boolean; + mbField?: string; + aggs: any; + getDateHistogramSubAggs?: Function; + dateHistogramSubAggs?: any; + metricAgg: string; + field: string; + timestampField: string; + calculation: ( + b: SeriesBucket, + key: string, + metric: Metric, + defaultSizeInSeconds: number + ) => number | null; + serialize: () => string; +} + /** * Derivative metrics for the first two agg buckets are unusable. For the first bucket, there * simply is no derivative metric (as calculating a derivative requires two adjacent buckets). For @@ -27,12 +50,12 @@ import { formatUTCTimestampForTimezone } from '../format_timezone'; * @param {int} minInMsSinceEpoch Lower bound of timepicker range, in ms-since-epoch * @param {int} bucketSizeInSeconds Size of a single date_histogram bucket, in seconds */ -function offsetMinForDerivativeMetric(minInMsSinceEpoch, bucketSizeInSeconds) { +function offsetMinForDerivativeMetric(minInMsSinceEpoch: number, bucketSizeInSeconds: number) { return minInMsSinceEpoch - 2 * bucketSizeInSeconds * 1000; } // Use the metric object as the source of truth on where to find the UUID -function getUuid(req, metric) { +function getUuid(req: LegacyRequest, metric: Metric) { if (metric.app === 'kibana') { return req.params.kibanaUuid; } else if (metric.app === 'logstash') { @@ -42,12 +65,11 @@ function getUuid(req, metric) { } } -function defaultCalculation(bucket, key) { - const mbKey = `metric_mb_deriv.normalized_value`; - const legacyValue = get(bucket, key, null); - const mbValue = get(bucket, mbKey, null); +function defaultCalculation(bucket: SeriesBucket, key: string) { + const legacyValue: number = get(bucket, key, null); + const mbValue = bucket.metric_mb_deriv?.normalized_value ?? null; let value; - if (!isNaN(mbValue) && mbValue > 0) { + if (mbValue !== null && !isNaN(mbValue) && mbValue > 0) { value = mbValue; } else { value = legacyValue; @@ -60,7 +82,7 @@ function defaultCalculation(bucket, key) { return value; } -function createMetricAggs(metric) { +function createMetricAggs(metric: Metric) { if (metric.derivative) { const mbDerivative = metric.mbField ? { @@ -90,18 +112,20 @@ function createMetricAggs(metric) { } async function fetchSeries( - req, - indexPattern, - metric, - metricOptions, - groupBy, - min, - max, - bucketSize, - filters + req: LegacyRequest, + indexPattern: string, + metric: Metric, + metricOptions: any, + groupBy: string | Record | null, + min: string | number, + max: string | number, + bucketSize: number, + filters: Array> ) { // if we're using a derivative metric, offset the min (also @see comment on offsetMinForDerivativeMetric function) - const adjustedMin = metric.derivative ? offsetMinForDerivativeMetric(min, bucketSize) : min; + const adjustedMin = metric.derivative + ? offsetMinForDerivativeMetric(Number(min), bucketSize) + : Number(min); let dateHistogramSubAggs = null; if (metric.getDateHistogramSubAggs) { @@ -118,15 +142,15 @@ async function fetchSeries( ...createMetricAggs(metric), }; if (metric.mbField) { - dateHistogramSubAggs.metric_mb = { + Reflect.set(dateHistogramSubAggs, 'metric_mb', { [metric.metricAgg]: { field: metric.mbField, }, - }; + }); } } - let aggs = { + let aggs: any = { check: { date_histogram: { field: metric.timestampField, @@ -154,7 +178,7 @@ async function fetchSeries( body: { query: createQuery({ start: adjustedMin, - end: max, + end: Number(max), metric, clusterUuid: req.params.clusterUuid, // TODO: Pass in the UUID as an explicit function parameter @@ -165,10 +189,6 @@ async function fetchSeries( }, }; - if (metric.debug) { - console.log('metric.debug', JSON.stringify(params)); - } - const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); return await callWithRequest(req, 'search', params); } @@ -180,11 +200,11 @@ async function fetchSeries( * @param {String} min Max timestamp for results to exist within. * @return {Number} Index position to use for the first bucket. {@code buckets.length} if none should be used. */ -function findFirstUsableBucketIndex(buckets, min) { +function findFirstUsableBucketIndex(buckets: SeriesBucket[], min: string | number) { const minInMillis = moment.utc(min).valueOf(); for (let i = 0; i < buckets.length; ++i) { - const bucketTime = get(buckets, [i, 'key']); + const bucketTime = buckets[i].key; const bucketTimeInMillis = moment.utc(bucketTime).valueOf(); // if the bucket start time, without knowing the bucket size, is before the filter time, then it's inherently a partial bucket @@ -208,11 +228,16 @@ function findFirstUsableBucketIndex(buckets, min) { * @param {Number} bucketSizeInMillis Size of a bucket in milliseconds. Set to 0 to allow partial trailing buckets. * @return {Number} Index position to use for the last bucket. {@code -1} if none should be used. */ -function findLastUsableBucketIndex(buckets, max, firstUsableBucketIndex, bucketSizeInMillis = 0) { +function findLastUsableBucketIndex( + buckets: SeriesBucket[], + max: string | number, + firstUsableBucketIndex: number, + bucketSizeInMillis: number = 0 +) { const maxInMillis = moment.utc(max).valueOf(); for (let i = buckets.length - 1; i > firstUsableBucketIndex - 1; --i) { - const bucketTime = get(buckets, [i, 'key']); + const bucketTime = buckets[i].key; const bucketTimeInMillis = moment.utc(bucketTime).valueOf() + bucketSizeInMillis; if (bucketTimeInMillis <= maxInMillis) { @@ -224,41 +249,25 @@ function findLastUsableBucketIndex(buckets, max, firstUsableBucketIndex, bucketS return -1; } -const formatBucketSize = (bucketSizeInSeconds) => { +const formatBucketSize = (bucketSizeInSeconds: number) => { const now = moment(); const timestamp = moment(now).add(bucketSizeInSeconds, 'seconds'); // clone the `now` object return formatTimestampToDuration(timestamp, CALCULATE_DURATION_UNTIL, now); }; -function isObject(value) { - return typeof value === 'object' && !!value && !Array.isArray(value); -} - -function countBuckets(data, count = 0) { - if (data && data.buckets) { - count += data.buckets.length; - for (const bucket of data.buckets) { - for (const key of Object.keys(bucket)) { - if (isObject(bucket[key])) { - count = countBuckets(bucket[key], count); - } - } - } - } else if (data) { - for (const key of Object.keys(data)) { - if (isObject(data[key])) { - count = countBuckets(data[key], count); - } - } - } - return count; -} - -function handleSeries(metric, groupBy, min, max, bucketSizeInSeconds, timezone, response) { +function handleSeries( + metric: Metric, + groupBy: string | Record | null, + min: string | number, + max: string | number, + bucketSizeInSeconds: number, + timezone: string, + response: ElasticsearchResponse +) { const { derivative, calculation: customCalculation } = metric; - function getAggregatedData(buckets) { + function getAggregatedData(buckets: SeriesBucket[]) { const firstUsableBucketIndex = findFirstUsableBucketIndex(buckets, min); const lastUsableBucketIndex = findLastUsableBucketIndex( buckets, @@ -266,20 +275,7 @@ function handleSeries(metric, groupBy, min, max, bucketSizeInSeconds, timezone, firstUsableBucketIndex, bucketSizeInSeconds * 1000 ); - let data = []; - - if (metric.debug) { - console.log( - `metric.debug field=${metric.field} bucketsCreated: ${countBuckets( - get(response, 'aggregations.check') - )}` - ); - console.log(`metric.debug`, { - bucketsLength: buckets.length, - firstUsableBucketIndex, - lastUsableBucketIndex, - }); - } + let data: Array<[string | number, number | null]> = []; if (firstUsableBucketIndex <= lastUsableBucketIndex) { // map buckets to values for charts @@ -306,15 +302,17 @@ function handleSeries(metric, groupBy, min, max, bucketSizeInSeconds, timezone, } if (groupBy) { - return get(response, 'aggregations.groupBy.buckets', []).map((bucket) => { - return { - groupedBy: bucket.key, - ...getAggregatedData(get(bucket, 'check.buckets', [])), - }; - }); + return (response?.aggregations?.groupBy?.buckets ?? []).map( + (bucket: Bucket & { check: { buckets: SeriesBucket[] } }) => { + return { + groupedBy: bucket.key, + ...getAggregatedData(bucket.check.buckets ?? []), + }; + } + ); } - return getAggregatedData(get(response, 'aggregations.check.buckets', [])); + return getAggregatedData(response.aggregations?.check?.buckets ?? []); } /** @@ -329,13 +327,18 @@ function handleSeries(metric, groupBy, min, max, bucketSizeInSeconds, timezone, * @return {Promise} The object response containing the {@code timeRange}, {@code metric}, and {@code data}. */ export async function getSeries( - req, - indexPattern, - metricName, - metricOptions, - filters, - groupBy, - { min, max, bucketSize, timezone } + req: LegacyRequest, + indexPattern: string, + metricName: string, + metricOptions: Record, + filters: Array>, + groupBy: string | Record | null, + { + min, + max, + bucketSize, + timezone, + }: { min: string | number; max: string | number; bucketSize: number; timezone: string } ) { checkParam(indexPattern, 'indexPattern in details/getSeries'); diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts index 482cbd3601993..17dc48d0b237e 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/ccr.ts @@ -50,5 +50,5 @@ export async function checkCcrEnabled(req: LegacyRequest, esIndexPattern: string const mbCcr = response.hits?.hits[0]?._source?.elasticsearch?.cluster?.stats?.stack?.xpack?.ccr; const isEnabled = legacyCcr?.enabled ?? mbCcr?.enabled; const isAvailable = legacyCcr?.available ?? mbCcr?.available; - return isEnabled && isAvailable; + return Boolean(isEnabled && isAvailable); } diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.ts similarity index 78% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.ts index cd3390416ccc3..244f2a14a2ecc 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/convert_metric_names.ts @@ -30,13 +30,13 @@ const CONVERTED_TOKEN = `odh_`; * @param string prefix - This is the aggregation name prefix where the rest of the name will be the type of aggregation * @param object metricObj The metric aggregation itself */ -export function convertMetricNames(prefix, metricObj) { +export function convertMetricNames(prefix: string, metricObj: Record) { return Object.entries(metricObj).reduce((newObj, [key, value]) => { const newValue = cloneDeep(value); if (key.includes('_deriv') && newValue.derivative) { newValue.derivative.buckets_path = `${CONVERTED_TOKEN}${prefix}__${newValue.derivative.buckets_path}`; } - newObj[`${CONVERTED_TOKEN}${prefix}__${key}`] = newValue; + Reflect.set(newObj, `${CONVERTED_TOKEN}${prefix}__${key}`, newValue); return newObj; }, {}); } @@ -50,32 +50,36 @@ export function convertMetricNames(prefix, metricObj) { * * @param object byDateBucketResponse - The response object from the single `date_histogram` bucket */ -export function uncovertMetricNames(byDateBucketResponse) { - const unconverted = {}; + +type MetricNameBucket = { key: string; key_as_string: string; doc_count: number } & Record< + string, + any +>; +export function uncovertMetricNames(byDateBucketResponse: { buckets: MetricNameBucket[] }) { + const unconverted: Record = {}; for (const metricName of LISTING_METRICS_NAMES) { unconverted[metricName] = { buckets: byDateBucketResponse.buckets.map((bucket) => { const { - // eslint-disable-next-line camelcase + // eslint-disable-next-line @typescript-eslint/naming-convention key_as_string, - // eslint-disable-next-line camelcase key, - // eslint-disable-next-line camelcase + // eslint-disable-next-line @typescript-eslint/naming-convention doc_count, ...rest } = bucket; - const metrics = Object.entries(rest).reduce((accum, [key, value]) => { - if (key.startsWith(`${CONVERTED_TOKEN}${metricName}`)) { - const name = key.split('__')[1]; + const metrics = Object.entries(rest).reduce((accum, [k, value]) => { + if (k.startsWith(`${CONVERTED_TOKEN}${metricName}`)) { + const name = k.split('__')[1]; accum[name] = value; } return accum; - }, {}); + }, {} as Record); return { - key_as_string /* eslint-disable-line camelcase */, + key_as_string, key, - doc_count /* eslint-disable-line camelcase */, + doc_count, ...metrics, }; }), diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/index.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/index.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts index 0a9993769a6e5..a43feb8fc84a3 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/get_indices.ts @@ -35,10 +35,11 @@ export function handleResponse( hit.inner_hits?.earliest?.hits?.hits[0]?._source.elasticsearch?.index; const rateOptions = { - hitTimestamp: hit._source.timestamp ?? hit._source['@timestamp'], + hitTimestamp: hit._source.timestamp ?? hit._source['@timestamp'] ?? null, earliestHitTimestamp: hit.inner_hits?.earliest?.hits?.hits[0]?._source.timestamp ?? - hit.inner_hits?.earliest?.hits?.hits[0]?._source['@timestamp'], + hit.inner_hits?.earliest?.hits?.hits[0]?._source['@timestamp'] ?? + null, timeWindowMin: min, timeWindowMax: max, }; diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/index.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/indices/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/indices/index.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/indices/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.test.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.test.js index 1e056c19ea9ee..d249bc82b9387 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.test.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.test.js @@ -6,7 +6,7 @@ */ import { set } from '@elastic/safer-lodash-set'; -import { calculateNodeType } from './calculate_node_type.js'; +import { calculateNodeType } from './calculate_node_type'; const masterNodeId = 'def456'; diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.ts similarity index 69% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.ts index 4b2bcb4cda432..8fc6084b114df 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/calculate_node_type.ts @@ -12,16 +12,22 @@ * - client only node: --node.data=false --node.master=false * https://www.elastic.co/guide/en/elasticsearch/reference/2.x/modules-node.html */ -import { includes, isUndefined } from 'lodash'; +import { isUndefined } from 'lodash'; +import { ElasticsearchLegacySource } from '../../../../common/types/es'; -export function calculateNodeType(node, masterNodeId) { +export type Node = ElasticsearchLegacySource['source_node'] & { + attributes?: Record; + node_ids?: Array; +}; + +export function calculateNodeType(node: Node, masterNodeId?: string | boolean) { const attrs = node.attributes || {}; - function mightBe(attr) { + function mightBe(attr?: string) { return attr === 'true' || isUndefined(attr); } - function isNot(attr) { + function isNot(attr?: string) { return attr === 'false'; } @@ -30,7 +36,7 @@ export function calculateNodeType(node, masterNodeId) { if (uuid !== undefined && uuid === masterNodeId) { return 'master'; } - if (includes(node.node_ids, masterNodeId)) { + if (node.node_ids?.includes(masterNodeId)) { return 'master'; } if (isNot(attrs.data) && isNot(attrs.master)) { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_default_node_from_id.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_default_node_from_id.ts similarity index 76% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_default_node_from_id.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_default_node_from_id.ts index a0d4602340419..047bcf554ddf0 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_default_node_from_id.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_default_node_from_id.ts @@ -10,7 +10,7 @@ * If node information can't be retrieved, we call this function * that provides some usable defaults */ -export function getDefaultNodeFromId(nodeId) { +export function getDefaultNodeFromId(nodeId: string) { return { id: nodeId, name: nodeId, @@ -20,3 +20,7 @@ export function getDefaultNodeFromId(nodeId) { attributes: {}, }; } + +export function isDefaultNode(node: any): node is ReturnType { + return !node.uuid; +} diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts index 79c44286717b4..aed6b40675e45 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_summary.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { get } from 'lodash'; import { i18n } from '@kbn/i18n'; // @ts-ignore import { checkParam } from '../../error_missing_required'; @@ -14,7 +13,7 @@ import { createQuery } from '../../create_query'; // @ts-ignore import { ElasticsearchMetric } from '../../metrics'; // @ts-ignore -import { getDefaultNodeFromId } from './get_default_node_from_id'; +import { getDefaultNodeFromId, isDefaultNode } from './get_default_node_from_id'; // @ts-ignore import { calculateNodeType } from './calculate_node_type'; // @ts-ignore @@ -23,7 +22,6 @@ import { ElasticsearchSource, ElasticsearchResponse, ElasticsearchLegacySource, - ElasticsearchMetricbeatNode, } from '../../../../common/types/es'; import { LegacyRequest } from '../../../types'; @@ -35,9 +33,9 @@ export function handleResponse( return (response: ElasticsearchResponse) => { let nodeSummary = {}; const nodeStatsHits = response.hits?.hits ?? []; - const nodes: Array< - ElasticsearchLegacySource['source_node'] | ElasticsearchMetricbeatNode - > = nodeStatsHits.map((hit) => hit._source.elasticsearch?.node || hit._source.source_node); // using [0] value because query results are sorted desc per timestamp + const nodes: Array = nodeStatsHits.map( + (hit) => hit._source.elasticsearch?.node || hit._source.source_node + ); // using [0] value because query results are sorted desc per timestamp const node = nodes[0] || getDefaultNodeFromId(nodeUuid); const sourceStats = response.hits?.hits[0]?._source.elasticsearch?.node?.stats || @@ -46,7 +44,7 @@ export function handleResponse( clusterState && clusterState.nodes ? clusterState.nodes[nodeUuid] : undefined; const stats = { resolver: nodeUuid, - node_ids: nodes.map((_node) => node.id || node.uuid), + node_ids: nodes.map((_node) => (isDefaultNode(node) ? node.id : node.id || node.uuid)), attributes: node.attributes, transport_address: response.hits?.hits[0]?._source.service?.address || node.transport_address, name: node.name, @@ -54,8 +52,8 @@ export function handleResponse( }; if (clusterNode) { - const _shardStats = get(shardStats, ['nodes', nodeUuid], {}); - const calculatedNodeType = calculateNodeType(stats, get(clusterState, 'master_node')); // set type for labeling / iconography + const _shardStats = shardStats.nodes[nodeUuid] ?? {}; + const calculatedNodeType = calculateNodeType(stats, clusterState?.master_node); // set type for labeling / iconography const { nodeType, nodeTypeLabel, nodeTypeClass } = getNodeTypeClassLabel( node, calculatedNodeType diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.ts similarity index 69% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.ts index fb7429d9d79b6..c0a4f4ff2a48c 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_node_type_class_label.ts @@ -6,6 +6,10 @@ */ import { nodeTypeLabel, nodeTypeClass } from './lookups'; +import { + ElasticsearchLegacySource, + ElasticsearchMetricbeatNode, +} from '../../../../common/types/es'; /* * Note: currently only `node` and `master` are supported due to @@ -13,8 +17,11 @@ import { nodeTypeLabel, nodeTypeClass } from './lookups'; * @param {Object} node - a node object from getNodes / getNodeSummary * @param {Object} type - the node type calculated from `calculateNodeType` */ -export function getNodeTypeClassLabel(node, type) { - const nodeType = node.master ? 'master' : type; +export function getNodeTypeClassLabel( + node: ElasticsearchLegacySource['source_node'] | ElasticsearchMetricbeatNode, + type: keyof typeof nodeTypeLabel +) { + const nodeType = node && 'master' in node ? 'master' : type; const returnObj = { nodeType, nodeTypeLabel: nodeTypeLabel[nodeType], diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_live_nodes.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_live_nodes.ts similarity index 84% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_live_nodes.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_live_nodes.ts index 3ae1d87427d2b..7bcba822845c3 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_live_nodes.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_live_nodes.ts @@ -5,7 +5,9 @@ * 2.0. */ -export async function getLivesNodes(req) { +import { LegacyRequest } from '../../../../types'; + +export async function getLivesNodes(req: LegacyRequest) { const params = { path: '/_nodes', method: 'GET', diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_metric_aggs.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_metric_aggs.ts similarity index 96% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_metric_aggs.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_metric_aggs.ts index c34458c30469d..ea2940ee1589c 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_metric_aggs.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_metric_aggs.ts @@ -18,7 +18,7 @@ import { convertMetricNames } from '../../convert_metric_names'; * @param {Number} bucketSize: Bucket size in seconds for date histogram interval * @return {Object} Aggregation DSL */ -export function getMetricAggs(listingMetrics) { +export function getMetricAggs(listingMetrics: string[]) { let aggItems = {}; listingMetrics.forEach((metricName) => { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.ts similarity index 86% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.ts index 87781417a07e5..03524eebd12e8 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_node_ids.ts @@ -9,8 +9,14 @@ import moment from 'moment'; import { get } from 'lodash'; import { ElasticsearchMetric } from '../../../metrics'; import { createQuery } from '../../../create_query'; +import { LegacyRequest, Bucket } from '../../../../types'; -export async function getNodeIds(req, indexPattern, { clusterUuid }, size) { +export async function getNodeIds( + req: LegacyRequest, + indexPattern: string, + { clusterUuid }: { clusterUuid: string }, + size: number +) { const start = moment.utc(req.payload.timeRange.min).valueOf(); const end = moment.utc(req.payload.timeRange.max).valueOf(); @@ -55,5 +61,7 @@ export async function getNodeIds(req, indexPattern, { clusterUuid }, size) { const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); const response = await callWithRequest(req, 'search', params); - return get(response, 'aggregations.composite_data.buckets', []).map((bucket) => bucket.key); + return get(response, 'aggregations.composite_data.buckets', []).map( + (bucket: Bucket) => bucket.key + ); } diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts index 442a2b1b9b9c9..0b5c0337e6c47 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_nodes.ts @@ -6,18 +6,12 @@ */ import moment from 'moment'; -// @ts-ignore import { checkParam } from '../../../error_missing_required'; -// @ts-ignore import { createQuery } from '../../../create_query'; -// @ts-ignore import { calculateAuto } from '../../../calculate_auto'; -// @ts-ignore import { ElasticsearchMetric } from '../../../metrics'; -// @ts-ignore import { getMetricAggs } from './get_metric_aggs'; import { handleResponse } from './handle_response'; -// @ts-ignore import { LISTING_METRICS_NAMES, LISTING_METRICS_PATHS } from './nodes_listing_metrics'; import { LegacyRequest } from '../../../../types'; import { ElasticsearchModifiedSource } from '../../../../../common/types/es'; @@ -103,7 +97,7 @@ export async function getNodes( min_doc_count: 0, fixed_interval: bucketSize + 's', }, - aggs: getMetricAggs(LISTING_METRICS_NAMES, bucketSize), + aggs: getMetricAggs(LISTING_METRICS_NAMES), }, }, }, diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.ts similarity index 74% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.ts index 485378fd01de0..118140fe3f9cd 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/get_paginated_nodes.ts @@ -5,12 +5,15 @@ * 2.0. */ -import { get, isUndefined } from 'lodash'; +import { isUndefined } from 'lodash'; import { getNodeIds } from './get_node_ids'; +// @ts-ignore import { filter } from '../../../pagination/filter'; import { sortNodes } from './sort_nodes'; +// @ts-ignore import { paginate } from '../../../pagination/paginate'; import { getMetrics } from '../../../details/get_metrics'; +import { LegacyRequest } from '../../../../types'; /** * This function performs an optimization around the node listing tables in the UI. To avoid @@ -28,25 +31,41 @@ import { getMetrics } from '../../../details/get_metrics'; * @param {*} sort - ({ field, direction }) * @param {*} queryText - Text that will be used to filter out pipelines */ + +interface Node { + name: string; + uuid: string; + isOnline: boolean; + shardCount: number; +} + export async function getPaginatedNodes( - req, - esIndexPattern, - { clusterUuid }, - metricSet, - pagination, - sort, - queryText, - { clusterStats, nodesShardCount } + req: LegacyRequest, + esIndexPattern: string, + { clusterUuid }: { clusterUuid: string }, + metricSet: string[], + pagination: { index: number; size: number }, + sort: { field: string; direction: 'asc' | 'desc' }, + queryText: string, + { + clusterStats, + nodesShardCount, + }: { + clusterStats: { + cluster_state: { nodes: Record }; + }; + nodesShardCount: { nodes: Record }; + } ) { const config = req.server.config(); - const size = config.get('monitoring.ui.max_bucket_size'); - const nodes = await getNodeIds(req, esIndexPattern, { clusterUuid }, size); + const size = Number(config.get('monitoring.ui.max_bucket_size')); + const nodes: Node[] = await getNodeIds(req, esIndexPattern, { clusterUuid }, size); // Add `isOnline` and shards from the cluster state and shard stats - const clusterState = get(clusterStats, 'cluster_state', { nodes: {} }); + const clusterState = clusterStats?.cluster_state ?? { nodes: {} }; for (const node of nodes) { - node.isOnline = !isUndefined(get(clusterState, ['nodes', node.uuid])); - node.shardCount = get(nodesShardCount, `nodes[${node.uuid}].shardCount`, 0); + node.isOnline = !isUndefined(clusterState?.nodes[node.uuid]); + node.shardCount = nodesShardCount?.nodes[node.uuid]?.shardCount ?? 0; } // `metricSet` defines a list of metrics that are sortable in the UI @@ -82,7 +101,7 @@ export async function getPaginatedNodes( const metricList = metricSeriesData[metricName]; for (const metricItem of metricList[0]) { - const node = nodes.find((node) => node.uuid === metricItem.groupedBy); + const node = nodes.find((n) => n.uuid === metricItem.groupedBy); if (!node) { continue; } @@ -91,7 +110,7 @@ export async function getPaginatedNodes( if (dataSeries && dataSeries.length) { const lastItem = dataSeries[dataSeries.length - 1]; if (lastItem.length && lastItem.length === 2) { - node[metricName] = lastItem[1]; + Reflect.set(node, metricName, lastItem[1]); } } } diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/handle_response.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/handle_response.ts index 5beabe70f0771..9fc06f1f9654f 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/handle_response.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/handle_response.ts @@ -7,9 +7,7 @@ import { get } from 'lodash'; import { mapNodesInfo } from './map_nodes_info'; -// @ts-ignore import { mapNodesMetrics } from './map_nodes_metrics'; -// @ts-ignore import { uncovertMetricNames } from '../../convert_metric_names'; import { ElasticsearchResponse, ElasticsearchModifiedSource } from '../../../../../common/types/es'; @@ -26,7 +24,7 @@ export function handleResponse( clusterStats: ElasticsearchModifiedSource | undefined, nodesShardCount: { nodes: { [nodeId: string]: { shardCount: number } } } | undefined, pageOfNodes: Array<{ uuid: string }>, - timeOptions = {} + timeOptions: { min?: number; max?: number; bucketSize?: number } = {} ) { if (!get(response, 'hits.hits')) { return []; diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/index.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/index.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.ts index 745556f5d2c88..aaa2092e08c4f 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_info.ts @@ -6,9 +6,7 @@ */ import { isUndefined } from 'lodash'; -// @ts-ignore import { calculateNodeType } from '../calculate_node_type'; -// @ts-ignore import { getNodeTypeClassLabel } from '../get_node_type_class_label'; import { ElasticsearchResponseHit, @@ -31,6 +29,7 @@ export function mapNodesInfo( return nodeHits.reduce((prev, node) => { const sourceNode = node._source.source_node || node._source.elasticsearch?.node; + if (!sourceNode) return prev; const calculatedNodeType = calculateNodeType(sourceNode, clusterState?.master_node); const { nodeType, nodeTypeLabel, nodeTypeClass } = getNodeTypeClassLabel( diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_metrics.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_metrics.ts similarity index 75% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_metrics.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_metrics.ts index bee11e0e10494..3426c7ac42643 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_metrics.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/map_nodes_metrics.ts @@ -8,8 +8,16 @@ import { get, map, min, max, last } from 'lodash'; import { filterPartialBuckets } from '../../../filter_partial_buckets'; import { metrics } from '../../../metrics'; +import { Bucket } from '../../../../types'; -function calcSlope(data) { +type MetricBucket = Bucket & { metric_deriv?: { value: number; normalized_value: number } }; +interface TimeOptions { + min?: number; + max?: number; + bucketSize?: number; +} + +function calcSlope(data: Array<{ x: number; y: number }>) { const length = data.length; const xSum = data.reduce((prev, curr) => prev + curr.x, 0); const ySum = data.reduce((prev, curr) => prev + curr.y, 0); @@ -27,12 +35,15 @@ function calcSlope(data) { return null; // convert possible NaN to `null` for JSON-friendliness } -const mapBuckets = (bucket, metric) => { +const mapBuckets = ( + bucket: MetricBucket, + metric: { derivative: boolean; calculation: (b: Bucket) => number | null } +) => { const x = bucket.key; if (metric.calculation) { return { - x: bucket.key, + x: Number(bucket.key), y: metric.calculation(bucket), }; } @@ -60,12 +71,16 @@ const mapBuckets = (bucket, metric) => { return { x, y: null }; }; -function reduceMetric(metricName, metricBuckets, { min: startTime, max: endTime, bucketSize }) { +function reduceMetric( + metricName: string, + metricBuckets: MetricBucket[], + { min: startTime, max: endTime, bucketSize }: TimeOptions +) { if (startTime === undefined || endTime === undefined || startTime >= endTime) { return null; } - const partialBucketFilter = filterPartialBuckets(startTime, endTime, bucketSize, { + const partialBucketFilter = filterPartialBuckets(startTime, endTime, bucketSize!, { ignoreEarly: true, }); const metric = metrics[metricName]; @@ -85,7 +100,7 @@ function reduceMetric(metricName, metricBuckets, { min: startTime, max: endTime, const minVal = min(map(mappedData, 'y')); const maxVal = max(map(mappedData, 'y')); const lastVal = last(map(mappedData, 'y')); - const slope = calcSlope(mappedData) > 0 ? 1 : -1; // no need for the entire precision, it's just an up/down arrow + const slope = Number(calcSlope(mappedData as Array<{ x: number; y: number }>)) > 0 ? 1 : -1; // no need for the entire precision, it's just an up/down arrow return { metric: metric.serialize(), @@ -93,14 +108,14 @@ function reduceMetric(metricName, metricBuckets, { min: startTime, max: endTime, }; } -function reduceAllMetrics(metricSet, timeOptions) { - const metrics = {}; +function reduceAllMetrics(metricSet: string[], timeOptions: TimeOptions) { + const reducedMetrics: Record = {}; Object.keys(metricSet).forEach((metricName) => { const metricBuckets = get(metricSet, [metricName, 'buckets']); - metrics[metricName] = reduceMetric(metricName, metricBuckets, timeOptions); // append summarized metric data + reducedMetrics[metricName] = reduceMetric(metricName, metricBuckets, timeOptions); // append summarized metric data }); - return metrics; + return reducedMetrics; } /* @@ -112,8 +127,12 @@ function reduceAllMetrics(metricSet, timeOptions) { * @param {Object} timeOptions: min, max, and bucketSize needed for date histogram creation * @return {Object} summarized metric data about each node keyed by nodeId */ -export function mapNodesMetrics(metricsForNodes, nodesInfo, timeOptions) { - const metricRows = {}; +export function mapNodesMetrics( + metricsForNodes: Record, + nodesInfo: Record, + timeOptions: TimeOptions +) { + const metricRows: Record = {}; Object.keys(metricsForNodes).forEach((nodeId) => { if (nodesInfo[nodeId].isOnline) { // only do the work of mapping metrics if the node is online diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/nodes_listing_metrics.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/nodes_listing_metrics.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/nodes_listing_metrics.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/nodes_listing_metrics.ts diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/sort_nodes.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/sort_nodes.ts similarity index 76% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/sort_nodes.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/sort_nodes.ts index 3a1f9e264a2ee..33d29f2a05998 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/sort_nodes.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/get_nodes/sort_nodes.ts @@ -7,7 +7,9 @@ import { orderBy } from 'lodash'; -export function sortNodes(nodes, sort) { +type Node = Record; + +export function sortNodes(nodes: Node[], sort?: { field: string; direction: 'asc' | 'desc' }) { if (!sort || !sort.field) { return nodes; } diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.ts similarity index 88% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.ts index 99ada270ac77e..8f474c0284844 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/index.ts @@ -7,6 +7,6 @@ export { getNodes } from './get_nodes'; export { getNodeSummary } from './get_node_summary'; -export { calculateNodeType } from './calculate_node_type'; +export { calculateNodeType, Node } from './calculate_node_type'; export { getNodeTypeClassLabel } from './get_node_type_class_label'; export { getDefaultNodeFromId } from './get_default_node_from_id'; diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/lookups.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/lookups.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/lookups.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/lookups.ts diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/types.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/types.ts new file mode 100644 index 0000000000000..57c0e643888e8 --- /dev/null +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/nodes/types.ts @@ -0,0 +1,13 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ElasticsearchLegacySource } from '../../../../common/types/es'; + +export type Node = ElasticsearchLegacySource['source_node'] & { + attributes?: Record; + node_ids: Array; +}; diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/calculate_shard_stat_indices_totals.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/calculate_shard_stat_indices_totals.ts similarity index 83% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/shards/calculate_shard_stat_indices_totals.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/shards/calculate_shard_stat_indices_totals.ts index 1b0c4a13cebb7..96e7b5491c4d4 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/calculate_shard_stat_indices_totals.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/calculate_shard_stat_indices_totals.ts @@ -8,7 +8,16 @@ /* * Calculate totals from mapped indices data */ -export function calculateIndicesTotals(indices) { +export function calculateIndicesTotals( + indices: Record< + string, + { + primary: number; + replica: number; + unassigned: { primary: number; replica: number }; + } + > +) { // create datasets for each index const metrics = Object.keys(indices).map((i) => { const index = indices[i]; diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.ts similarity index 87% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.ts index 8bb79c0b0a70c..cf11c939fb230 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_shard_stat_aggs.ts @@ -9,7 +9,14 @@ * @param {Object} config - Kibana config service * @param {Boolean} includeNodes - whether to add the aggs for node shards */ -export function getShardAggs(config, includeNodes, includeIndices) { + +import { LegacyServer } from '../../../types'; + +export function getShardAggs( + config: ReturnType, + includeNodes: boolean, + includeIndices: boolean +) { const maxBucketSize = config.get('monitoring.ui.max_bucket_size'); const aggSize = 10; const indicesAgg = { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_unassigned_shards.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_unassigned_shards.ts similarity index 67% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_unassigned_shards.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_unassigned_shards.ts index 86e747f415058..12735406ff901 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_unassigned_shards.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_unassigned_shards.ts @@ -5,18 +5,18 @@ * 2.0. */ -import { get } from 'lodash'; - // Methods for calculating metrics for // - Number of Primary Shards // - Number of Replica Shards // - Unassigned Primary Shards // - Unassigned Replica Shards -export function getUnassignedShards(indexShardStats) { +export function getUnassignedShards(indexShardStats: { + unassigned: { primary: number; replica: number }; +}) { let unassignedShards = 0; - unassignedShards += get(indexShardStats, 'unassigned.primary'); - unassignedShards += get(indexShardStats, 'unassigned.replica'); + unassignedShards += indexShardStats.unassigned.primary; + unassignedShards += indexShardStats.unassigned.replica; return unassignedShards; } diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/index.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/shards/index.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/shards/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/normalize_shard_objects.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/normalize_shard_objects.ts similarity index 71% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/shards/normalize_shard_objects.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/shards/normalize_shard_objects.ts index c0bb9836238db..511935f615cd8 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/normalize_shard_objects.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/normalize_shard_objects.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { get, partition } from 'lodash'; -import { calculateNodeType } from '../nodes'; +import { partition } from 'lodash'; +import { calculateNodeType, Node } from '../nodes'; /* * Reducer function for a set of nodes to key the array by nodeId, summarize @@ -14,8 +14,28 @@ import { calculateNodeType } from '../nodes'; * @param masterNode = nodeId of master node * @return reducer function for set of nodes */ -export function normalizeNodeShards(masterNode) { - return (nodes, node) => { + +type NodeShard = Node & { + key: string; + node_ids: { buckets: Array<{ key: string }> }; + node_names: { buckets: Array<{ key: string }> }; + index_count: { value: number }; + doc_count: number; +}; + +interface ShardBucket { + key: string; + primary: { + buckets: Array<{ + key: string; + key_as_string: string; + doc_count: number; + }>; + }; +} + +export function normalizeNodeShards(masterNode: string) { + return (nodes: NodeShard[], node: NodeShard) => { if (node.key && node.node_ids) { const nodeIds = node.node_ids.buckets.map((b) => b.key); const _node = { @@ -27,8 +47,8 @@ export function normalizeNodeShards(masterNode) { ...nodes, [node.key]: { shardCount: node.doc_count, - indexCount: get(node, 'index_count.value'), - name: get(node, 'node_names.buckets[0].key'), + indexCount: node.index_count.value, + name: node.node_names.buckets[0].key, node_ids: nodeIds, type: calculateNodeType(_node, masterNode), // put the "star" icon on the node link in the shard allocator }, @@ -38,12 +58,12 @@ export function normalizeNodeShards(masterNode) { }; } -const countShards = (shardBuckets) => { +const countShards = (shardBuckets: ShardBucket[]) => { let primaryShards = 0; let replicaShards = 0; shardBuckets.forEach((shard) => { - const primaryMap = get(shard, 'primary.buckets', []); + const primaryMap = shard.primary.buckets ?? []; const primaryBucket = primaryMap.find((b) => b.key_as_string === 'true'); if (primaryBucket !== undefined) { @@ -62,13 +82,18 @@ const countShards = (shardBuckets) => { }; }; +interface Index { + key: string; + states?: { buckets?: ShardBucket[] }; +} + /* * Reducer function for a set of indices to key the array by index name, and * summarize the shard data. * @return reducer function for set of indices */ -export function normalizeIndexShards(indices, index) { - const stateBuckets = get(index, 'states.buckets', []); +export function normalizeIndexShards(indices: Index[], index: Index) { + const stateBuckets = index.states?.buckets ?? []; const [assignedShardBuckets, unassignedShardBuckets] = partition(stateBuckets, (b) => { return b.key === 'STARTED' || b.key === 'RELOCATING'; }); diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/verify_monitoring_auth.js b/x-pack/plugins/monitoring/server/lib/elasticsearch/verify_monitoring_auth.ts similarity index 93% rename from x-pack/plugins/monitoring/server/lib/elasticsearch/verify_monitoring_auth.js rename to x-pack/plugins/monitoring/server/lib/elasticsearch/verify_monitoring_auth.ts index e4cee4d4455ca..7673f1b7ff052 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/verify_monitoring_auth.js +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/verify_monitoring_auth.ts @@ -8,6 +8,7 @@ import { get } from 'lodash'; import Boom from '@hapi/boom'; import { INDEX_PATTERN } from '../../../common/constants'; +import { LegacyRequest } from '../../types'; /* * Check the currently logged-in user's privileges for "read" privileges on the @@ -16,7 +17,7 @@ import { INDEX_PATTERN } from '../../../common/constants'; * * @param req {Object} the server route handler request object */ -export async function verifyMonitoringAuth(req) { +export async function verifyMonitoringAuth(req: LegacyRequest) { const xpackInfo = get(req.server.plugins.monitoring, 'info'); if (xpackInfo) { @@ -37,7 +38,7 @@ export async function verifyMonitoringAuth(req) { * @param req {Object} the server route handler request object * @return {Promise} That either resolves with no response (void) or an exception. */ -async function verifyHasPrivileges(req) { +async function verifyHasPrivileges(req: LegacyRequest) { const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); let response; diff --git a/x-pack/plugins/monitoring/server/lib/error_missing_required.js b/x-pack/plugins/monitoring/server/lib/error_missing_required.ts similarity index 66% rename from x-pack/plugins/monitoring/server/lib/error_missing_required.js rename to x-pack/plugins/monitoring/server/lib/error_missing_required.ts index b63fecdd56c6d..130e3d8a8e303 100644 --- a/x-pack/plugins/monitoring/server/lib/error_missing_required.js +++ b/x-pack/plugins/monitoring/server/lib/error_missing_required.ts @@ -10,7 +10,7 @@ * @param param - anything * @param context {String} calling context used in the error message */ -export function checkParam(param, context) { +export function checkParam(param: any, context: string) { if (!param) { throw new MissingRequiredError(context); } @@ -21,10 +21,12 @@ export function checkParam(param, context) { * - verification in unit tests * see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error */ -export function MissingRequiredError(param) { - this.name = 'MissingRequiredError'; - this.message = `Missing required parameter or field: ${param}`; - this.stack = new Error().stack; + +export class MissingRequiredError extends Error { + constructor(param: string) { + super(); + this.name = 'MissingRequiredError'; + this.message = `Missing required parameter or field: ${param}`; + this.stack = new Error().stack; + } } -MissingRequiredError.prototype = Object.create(Error.prototype); -MissingRequiredError.prototype.constructor = MissingRequiredError; diff --git a/x-pack/plugins/monitoring/server/lib/filter_partial_buckets.js b/x-pack/plugins/monitoring/server/lib/filter_partial_buckets.ts similarity index 70% rename from x-pack/plugins/monitoring/server/lib/filter_partial_buckets.js rename to x-pack/plugins/monitoring/server/lib/filter_partial_buckets.ts index c39cfc4ea4394..35d079fa323cf 100644 --- a/x-pack/plugins/monitoring/server/lib/filter_partial_buckets.js +++ b/x-pack/plugins/monitoring/server/lib/filter_partial_buckets.ts @@ -7,22 +7,31 @@ import moment from 'moment'; +interface Bucket { + key: string; +} + /* calling .subtract or .add on a moment object mutates the object * so this function shortcuts creating a fresh object */ -function getTime(bucket) { +function getTime(bucket: Bucket) { return moment.utc(bucket.key); } /* find the milliseconds of difference between 2 moment objects */ -function getDelta(t1, t2) { +function getDelta(t1: number, t2: number) { return moment.duration(t1 - t2).asMilliseconds(); } -export function filterPartialBuckets(min, max, bucketSize, options = {}) { - return (bucket) => { +export function filterPartialBuckets( + min: number, + max: number, + bucketSize: number, + options: { ignoreEarly?: boolean } = {} +) { + return (bucket: Bucket) => { const bucketTime = getTime(bucket); // timestamp is too late to be complete - if (getDelta(max, bucketTime.add(bucketSize, 'seconds')) < 0) { + if (getDelta(max, bucketTime.add(bucketSize, 'seconds').valueOf()) < 0) { return false; } @@ -32,7 +41,7 @@ export function filterPartialBuckets(min, max, bucketSize, options = {}) { * ignoreEarly */ if (options.ignoreEarly !== true) { // timestamp is too early to be complete - if (getDelta(bucketTime.subtract(bucketSize, 'seconds'), min) < 0) { + if (getDelta(bucketTime.subtract(bucketSize, 'seconds').valueOf(), min) < 0) { return false; } } diff --git a/x-pack/plugins/monitoring/server/lib/format_timezone.js b/x-pack/plugins/monitoring/server/lib/format_timezone.ts similarity index 82% rename from x-pack/plugins/monitoring/server/lib/format_timezone.js rename to x-pack/plugins/monitoring/server/lib/format_timezone.ts index 72ee3aed4b512..afcc58550905e 100644 --- a/x-pack/plugins/monitoring/server/lib/format_timezone.js +++ b/x-pack/plugins/monitoring/server/lib/format_timezone.ts @@ -16,11 +16,11 @@ import moment from 'moment'; * @param {*} utcTimestamp UTC timestamp * @param {*} timezone The timezone to convert into */ -export const formatUTCTimestampForTimezone = (utcTimestamp, timezone) => { +export const formatUTCTimestampForTimezone = (utcTimestamp: string | number, timezone: string) => { if (timezone === 'Browser') { return utcTimestamp; } const offsetInMinutes = moment.tz(timezone).utcOffset(); - const offsetTimestamp = utcTimestamp + offsetInMinutes * 1 * 60 * 1000; + const offsetTimestamp = Number(utcTimestamp) + offsetInMinutes * 1 * 60 * 1000; return offsetTimestamp; }; diff --git a/x-pack/plugins/monitoring/server/lib/get_timezone.js b/x-pack/plugins/monitoring/server/lib/get_timezone.ts similarity index 76% rename from x-pack/plugins/monitoring/server/lib/get_timezone.js rename to x-pack/plugins/monitoring/server/lib/get_timezone.ts index 76f3dddfa315c..307ec4477bbaf 100644 --- a/x-pack/plugins/monitoring/server/lib/get_timezone.js +++ b/x-pack/plugins/monitoring/server/lib/get_timezone.ts @@ -5,6 +5,8 @@ * 2.0. */ -export async function getTimezone(req) { +import { LegacyRequest } from '../types'; + +export async function getTimezone(req: LegacyRequest) { return await req.getUiSettingsService().get('dateFormat:tz'); } diff --git a/x-pack/plugins/monitoring/server/lib/helpers.js b/x-pack/plugins/monitoring/server/lib/helpers.ts similarity index 79% rename from x-pack/plugins/monitoring/server/lib/helpers.js rename to x-pack/plugins/monitoring/server/lib/helpers.ts index d5ceb2128c282..a904f8cfa497c 100644 --- a/x-pack/plugins/monitoring/server/lib/helpers.js +++ b/x-pack/plugins/monitoring/server/lib/helpers.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { ElasticsearchResponse, ElasticsearchResponseHit } from '../../common/types/es'; + export const response = { hits: { hits: [ @@ -83,20 +85,22 @@ export const response = { }, }; -export const defaultResponseSort = (handleResponse) => { - const responseMulti = { hits: { hits: [] } }; +export const defaultResponseSort = ( + handleResponse: (r: ElasticsearchResponse, n1: number, n2: number) => any +) => { + const responseMulti = { hits: { hits: [] as ElasticsearchResponseHit[] } }; const hit = response.hits.hits[0]; const version = ['6.6.2', '7.0.0-rc1', '6.7.1']; for (let i = 0, l = version.length; i < l; ++i) { // Deep clone the object to preserve the original - const newBeat = JSON.parse(JSON.stringify({ ...hit })); + const newBeat: ElasticsearchResponseHit = JSON.parse(JSON.stringify({ ...hit })); const { beats_stats: beatsStats } = newBeat._source; - beatsStats.timestamp = `2019-01-0${i + 1}T05:00:00.000Z`; - beatsStats.beat.version = version[i]; - beatsStats.beat.uuid = `${i}${beatsStats.beat.uuid}`; + beatsStats!.timestamp = `2019-01-0${i + 1}T05:00:00.000Z`; + beatsStats!.beat!.version = version[i]; + beatsStats!.beat!.uuid = `${i}${beatsStats!.beat!.uuid}`; responseMulti.hits.hits.push(newBeat); } - return { beats: handleResponse(responseMulti, 0, 0), version }; + return { beats: handleResponse(responseMulti as ElasticsearchResponse, 0, 0), version }; }; diff --git a/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts b/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts index 15cc9904dd060..2fa0b02e0fb1a 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts +++ b/x-pack/plugins/monitoring/server/lib/kibana/get_kibana_info.ts @@ -7,7 +7,7 @@ import { merge } from 'lodash'; // @ts-ignore -import { checkParam } from '../error_missing_required'; +import { checkParam, MissingRequiredError } from '../error_missing_required'; // @ts-ignore import { calculateAvailability } from '../calculate_availability'; import { LegacyRequest } from '../../types'; @@ -17,10 +17,13 @@ export function handleResponse(resp: ElasticsearchResponse) { const legacySource = resp.hits?.hits[0]?._source.kibana_stats; const mbSource = resp.hits?.hits[0]?._source.kibana?.stats; const kibana = resp.hits?.hits[0]?._source.kibana?.kibana ?? legacySource?.kibana; + const availabilityTimestamp = + resp.hits?.hits[0]?._source['@timestamp'] ?? legacySource?.timestamp; + if (!availabilityTimestamp) { + throw new MissingRequiredError('timestamp'); + } return merge(kibana, { - availability: calculateAvailability( - resp.hits?.hits[0]?._source['@timestamp'] ?? legacySource?.timestamp - ), + availability: calculateAvailability(availabilityTimestamp), os_memory_free: mbSource?.os?.memory?.free_in_bytes ?? legacySource?.os?.memory?.free_in_bytes, uptime: mbSource?.process?.uptime?.ms ?? legacySource?.process?.uptime_in_millis, }); diff --git a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.js b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts similarity index 86% rename from x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.js rename to x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts index 141596ffd2f6f..4e806c07ee660 100644 --- a/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.js +++ b/x-pack/plugins/monitoring/server/lib/kibana/get_kibanas_for_clusters.ts @@ -6,9 +6,10 @@ */ import Bluebird from 'bluebird'; -import { chain, find, get } from 'lodash'; +import { chain, find } from 'lodash'; +import { LegacyRequest, Cluster, Bucket } from '../../types'; import { checkParam } from '../error_missing_required'; -import { createQuery } from '../create_query.js'; +import { createQuery } from '../create_query'; import { KibanaClusterMetric } from '../metrics'; /* @@ -24,7 +25,11 @@ import { KibanaClusterMetric } from '../metrics'; * - number of instances * - combined health */ -export function getKibanasForClusters(req, kbnIndexPattern, clusters) { +export function getKibanasForClusters( + req: LegacyRequest, + kbnIndexPattern: string, + clusters: Cluster[] +) { checkParam(kbnIndexPattern, 'kbnIndexPattern in kibana/getKibanasForClusters'); const config = req.server.config(); @@ -32,7 +37,7 @@ export function getKibanasForClusters(req, kbnIndexPattern, clusters) { const end = req.payload.timeRange.max; return Bluebird.map(clusters, (cluster) => { - const clusterUuid = get(cluster, 'elasticsearch.cluster.id', cluster.cluster_uuid); + const clusterUuid = cluster.elasticsearch?.cluster?.id ?? cluster.cluster_uuid; const metric = KibanaClusterMetric.getMetricFields(); const params = { index: kbnIndexPattern, @@ -162,9 +167,9 @@ export function getKibanasForClusters(req, kbnIndexPattern, clusters) { const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring'); return callWithRequest(req, 'search', params).then((result) => { - const aggregations = get(result, 'aggregations', {}); - const kibanaUuids = get(aggregations, 'kibana_uuids.buckets', []); - const statusBuckets = get(aggregations, 'status.buckets', []); + const aggregations = result.aggregations ?? {}; + const kibanaUuids = aggregations.kibana_uuids?.buckets ?? []; + const statusBuckets = aggregations.status?.buckets ?? []; // everything is initialized such that it won't impact any rollup let status = null; @@ -185,19 +190,19 @@ export function getKibanasForClusters(req, kbnIndexPattern, clusters) { statusBuckets, (bucket) => bucket.max_timestamp.value === latestTimestamp ); - status = get(latestBucket, 'key'); + status = latestBucket.key; - requestsTotal = get(aggregations, 'requests_total.value'); - connections = get(aggregations, 'concurrent_connections.value'); - responseTime = get(aggregations, 'response_time_max.value'); - memorySize = get(aggregations, 'memory_rss.value'); // resident set size - memoryLimit = get(aggregations, 'memory_heap_size_limit.value'); // max old space + requestsTotal = aggregations.requests_total?.value; + connections = aggregations.concurrent_connections?.value; + responseTime = aggregations.response_time_max?.value; + memorySize = aggregations.memory_rss?.value; + memoryLimit = aggregations.memory_heap_size_limit?.value; } return { clusterUuid, stats: { - uuids: get(aggregations, 'kibana_uuids.buckets', []).map(({ key }) => key), + uuids: kibanaUuids.map(({ key }: Bucket) => key), status, requests_total: requestsTotal, concurrent_connections: connections, diff --git a/x-pack/plugins/monitoring/server/lib/kibana/index.js b/x-pack/plugins/monitoring/server/lib/kibana/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/kibana/index.js rename to x-pack/plugins/monitoring/server/lib/kibana/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/logs/detect_reason.js b/x-pack/plugins/monitoring/server/lib/logs/detect_reason.ts similarity index 75% rename from x-pack/plugins/monitoring/server/lib/logs/detect_reason.js rename to x-pack/plugins/monitoring/server/lib/logs/detect_reason.ts index a739a8d062c3e..216d29d841a86 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/detect_reason.js +++ b/x-pack/plugins/monitoring/server/lib/logs/detect_reason.ts @@ -5,13 +5,21 @@ * 2.0. */ +import { LegacyRequest } from '../../types'; import { createTimeFilter } from '../create_query'; -import { get } from 'lodash'; + +interface Opts { + start: number; + end: number; + clusterUuid?: string; + nodeUuid?: string; + indexUuid?: string; +} async function doesFilebeatIndexExist( - req, - filebeatIndexPattern, - { start, end, clusterUuid, nodeUuid, indexUuid } + req: LegacyRequest, + filebeatIndexPattern: string, + { start, end, clusterUuid, nodeUuid, indexUuid }: Opts ) { const metric = { timestampField: '@timestamp' }; const filter = [createTimeFilter({ start, end, metric })]; @@ -122,18 +130,18 @@ async function doesFilebeatIndexExist( } = await callWithRequest(req, 'msearch', { body }); return { - indexPatternExists: get(indexPatternExistsResponse, 'hits.total.value', 0) > 0, + indexPatternExists: (indexPatternExistsResponse?.hits?.total.value ?? 0) > 0, indexPatternInTimeRangeExists: - get(indexPatternExistsInTimeRangeResponse, 'hits.total.value', 0) > 0, - typeExistsAtAnyTime: get(typeExistsAtAnyTimeResponse, 'hits.total.value', 0) > 0, - typeExists: get(typeExistsResponse, 'hits.total.value', 0) > 0, - usingStructuredLogs: get(usingStructuredLogsResponse, 'hits.total.value', 0) > 0, - clusterExists: clusterUuid ? get(clusterExistsResponse, 'hits.total.value', 0) > 0 : null, - nodeExists: nodeUuid ? get(nodeExistsResponse, 'hits.total.value', 0) > 0 : null, - indexExists: indexUuid ? get(indexExistsResponse, 'hits.total.value', 0) > 0 : null, + (indexPatternExistsInTimeRangeResponse?.hits?.total.value ?? 0) > 0, + typeExistsAtAnyTime: (typeExistsAtAnyTimeResponse?.hits?.total.value ?? 0) > 0, + typeExists: (typeExistsResponse?.hits?.total.value ?? 0) > 0, + usingStructuredLogs: (usingStructuredLogsResponse?.hits?.total.value ?? 0) > 0, + clusterExists: clusterUuid ? (clusterExistsResponse?.hits?.total.value ?? 0) > 0 : null, + nodeExists: nodeUuid ? (nodeExistsResponse?.hits?.total.value ?? 0) > 0 : null, + indexExists: indexUuid ? (indexExistsResponse?.hits?.total.value ?? 0) > 0 : null, }; } -export async function detectReason(req, filebeatIndexPattern, opts) { +export async function detectReason(req: LegacyRequest, filebeatIndexPattern: string, opts: Opts) { return await doesFilebeatIndexExist(req, filebeatIndexPattern, opts); } diff --git a/x-pack/plugins/monitoring/server/lib/logs/detect_reason_from_exception.js b/x-pack/plugins/monitoring/server/lib/logs/detect_reason_from_exception.ts similarity index 86% rename from x-pack/plugins/monitoring/server/lib/logs/detect_reason_from_exception.js rename to x-pack/plugins/monitoring/server/lib/logs/detect_reason_from_exception.ts index bd4776409299e..6d6ebf9b8dad2 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/detect_reason_from_exception.js +++ b/x-pack/plugins/monitoring/server/lib/logs/detect_reason_from_exception.ts @@ -5,7 +5,7 @@ * 2.0. */ -export function detectReasonFromException(exception) { +export function detectReasonFromException(exception: Error & { status: number }) { const reason = { correctIndexName: true }; if (exception) { diff --git a/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts b/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts index bbb48c43033da..2346fdd6f4531 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts +++ b/x-pack/plugins/monitoring/server/lib/logs/get_log_types.ts @@ -5,13 +5,9 @@ * 2.0. */ -// @ts-ignore import { checkParam } from '../error_missing_required'; -// @ts-ignore -import { createTimeFilter } from '../create_query'; -// @ts-ignore +import { createTimeFilter, TimerangeFilter } from '../create_query'; import { detectReason } from './detect_reason'; -// @ts-ignore import { detectReasonFromException } from './detect_reason_from_exception'; import { LegacyRequest } from '../../types'; import { FilebeatResponse } from '../../../common/types/filebeat'; @@ -25,7 +21,7 @@ async function handleResponse( response: FilebeatResponse, req: LegacyRequest, filebeatIndexPattern: string, - opts: { clusterUuid: string; nodeUuid: string; indexUuid: string; start: number; end: number } + opts: { clusterUuid?: string; nodeUuid?: string; indexUuid?: string; start: number; end: number } ) { const result: { enabled: boolean; types: LogType[]; reason?: any } = { enabled: false, @@ -62,12 +58,12 @@ export async function getLogTypes( indexUuid, start, end, - }: { clusterUuid: string; nodeUuid: string; indexUuid: string; start: number; end: number } + }: { clusterUuid?: string; nodeUuid?: string; indexUuid?: string; start: number; end: number } ) { checkParam(filebeatIndexPattern, 'filebeatIndexPattern in logs/getLogTypes'); const metric = { timestampField: '@timestamp' }; - const filter = [ + const filter: Array<{ term: { [x: string]: string } } | TimerangeFilter | null> = [ { term: { 'service.type': 'elasticsearch' } }, createTimeFilter({ start, end, metric }), ]; diff --git a/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts b/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts index 4c21422a5d0cf..5226c04377ffe 100644 --- a/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts +++ b/x-pack/plugins/monitoring/server/lib/logs/get_logs.ts @@ -22,7 +22,7 @@ import { LegacyRequest } from '../../types'; import { FilebeatResponse } from '../../../common/types/filebeat'; interface Log { - timestamp?: string; + timestamp?: string | number; component?: string; node?: string; index?: string; @@ -83,7 +83,7 @@ export async function getLogs( checkParam(filebeatIndexPattern, 'filebeatIndexPattern in logs/getLogs'); const metric = { timestampField: '@timestamp' }; - const filter = [ + const filter: any[] = [ { term: { 'service.type': 'elasticsearch' } }, createTimeFilter({ start, end, metric }), ]; diff --git a/x-pack/plugins/monitoring/server/lib/logs/index.js b/x-pack/plugins/monitoring/server/lib/logs/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/logs/index.js rename to x-pack/plugins/monitoring/server/lib/logs/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.js b/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts similarity index 94% rename from x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.js rename to x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts index 17f76834b333a..c0c29756818ee 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.js +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_logstash_for_clusters.ts @@ -7,14 +7,15 @@ import Bluebird from 'bluebird'; import { get } from 'lodash'; +import { LegacyRequest, Cluster, Bucket } from '../../types'; +import { LOGSTASH } from '../../../common/constants'; import { checkParam } from '../error_missing_required'; -import { createQuery } from '../create_query.js'; +import { createQuery } from '../create_query'; import { LogstashClusterMetric } from '../metrics'; -import { LOGSTASH } from '../../../common/constants'; const { MEMORY, PERSISTED } = LOGSTASH.QUEUE_TYPES; -const getQueueTypes = (queueBuckets) => { +const getQueueTypes = (queueBuckets: Array) => { const memory = queueBuckets.find((bucket) => bucket.key === MEMORY); const persisted = queueBuckets.find((bucket) => bucket.key === PERSISTED); return { @@ -36,7 +37,11 @@ const getQueueTypes = (queueBuckets) => { * - number of instances * - combined health */ -export function getLogstashForClusters(req, lsIndexPattern, clusters) { +export function getLogstashForClusters( + req: LegacyRequest, + lsIndexPattern: string, + clusters: Cluster[] +) { checkParam(lsIndexPattern, 'lsIndexPattern in logstash/getLogstashForClusters'); const start = req.payload.timeRange.min; @@ -226,7 +231,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) { let types = get(aggregations, 'pipelines_nested_mb.queue_types.buckets', []); if (!types || types.length === 0) { - types = get(aggregations, 'pipelines_nested.queue_types.buckets', []); + types = aggregations.pipelines_nested?.queue_types.buckets ?? []; } return { @@ -242,7 +247,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) { get(aggregations, 'pipelines_nested_mb.pipelines.value') || get(aggregations, 'pipelines_nested.pipelines.value', 0), queue_types: getQueueTypes(types), - versions: logstashVersions.map((versionBucket) => versionBucket.key), + versions: logstashVersions.map((versionBucket: Bucket) => versionBucket.key), }, }; }); diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts index d047729a0b3c2..276b8b119bba3 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_node_info.ts @@ -7,7 +7,7 @@ import { merge } from 'lodash'; // @ts-ignore -import { checkParam } from '../error_missing_required'; +import { checkParam, MissingRequiredError } from '../error_missing_required'; // @ts-ignore import { calculateAvailability } from '../calculate_availability'; import { LegacyRequest } from '../../types'; @@ -20,8 +20,12 @@ export function handleResponse(resp: ElasticsearchResponse) { const legacyStats = resp.hits?.hits[0]?._source?.logstash_stats; const mbStats = resp.hits?.hits[0]?._source?.logstash?.node?.stats; const logstash = mbStats?.logstash ?? legacyStats?.logstash; + const availabilityTimestamp = mbStats?.timestamp ?? legacyStats?.timestamp; + if (!availabilityTimestamp) { + throw new MissingRequiredError('timestamp'); + } const info = merge(logstash, { - availability: calculateAvailability(mbStats?.timestamp ?? legacyStats?.timestamp), + availability: calculateAvailability(availabilityTimestamp), events: mbStats?.events ?? legacyStats?.events, reloads: mbStats?.reloads ?? legacyStats?.reloads, queue_type: mbStats?.queue?.type ?? legacyStats?.queue?.type, diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline.ts index b17f7d27c6c9b..d8bfd91a4aec8 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline.ts @@ -132,9 +132,9 @@ export async function getPipeline( // Determine metrics' timeseries interval based on version's timespan const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds'); const timeseriesInterval = calculateTimeseriesInterval( - version.firstSeen, - version.lastSeen, - minIntervalSeconds + Number(version.firstSeen), + Number(version.lastSeen), + Number(minIntervalSeconds) ); const [stateDocument, statsAggregation] = await Promise.all([ diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.js b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.ts similarity index 90% rename from x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.js rename to x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.ts index 2846a968bfed6..1a5595d45ffbb 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.js +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_ids.ts @@ -7,14 +7,15 @@ import moment from 'moment'; import { get } from 'lodash'; +import { LegacyRequest, Bucket } from '../../types'; import { createQuery } from '../create_query'; import { LogstashMetric } from '../metrics'; export async function getLogstashPipelineIds( - req, - logstashIndexPattern, - { clusterUuid, logstashUuid }, - size + req: LegacyRequest, + logstashIndexPattern: string, + { clusterUuid, logstashUuid }: { clusterUuid: string; logstashUuid?: string }, + size: number ) { const start = moment.utc(req.payload.timeRange.min).valueOf(); const end = moment.utc(req.payload.timeRange.max).valueOf(); @@ -100,14 +101,14 @@ export async function getLogstashPipelineIds( if (!buckets || buckets.length === 0) { buckets = get(response, 'aggregations.nest.id.buckets', []); } - return buckets.map((bucket) => { + return buckets.map((bucket: Bucket) => { let nodeBuckets = get(bucket, 'unnest_mb.nodes.buckets', []); if (!nodeBuckets || nodeBuckets.length === 0) { nodeBuckets = get(bucket, 'unnest.nodes.buckets', []); } return { id: bucket.key, - nodeIds: nodeBuckets.map((item) => item.key), + nodeIds: nodeBuckets.map((item: Bucket) => item.key), }; }); } diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.ts b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.ts index 3d657e8344e3c..e41eea0bce64a 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.ts +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_pipeline_vertex.ts @@ -150,9 +150,9 @@ export async function getPipelineVertex( // Determine metrics' timeseries interval based on version's timespan const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds'); const timeseriesInterval = calculateTimeseriesInterval( - version.firstSeen, - version.lastSeen, - minIntervalSeconds + Number(version.firstSeen), + Number(version.lastSeen), + Number(minIntervalSeconds) ); const [stateDocument, statsAggregation] = await Promise.all([ diff --git a/x-pack/plugins/monitoring/server/lib/logstash/index.js b/x-pack/plugins/monitoring/server/lib/logstash/index.ts similarity index 100% rename from x-pack/plugins/monitoring/server/lib/logstash/index.js rename to x-pack/plugins/monitoring/server/lib/logstash/index.ts diff --git a/x-pack/plugins/monitoring/server/lib/metrics/apm/classes.js b/x-pack/plugins/monitoring/server/lib/metrics/apm/classes.ts similarity index 91% rename from x-pack/plugins/monitoring/server/lib/metrics/apm/classes.js rename to x-pack/plugins/monitoring/server/lib/metrics/apm/classes.ts index 638d14594699f..4a97e7823999b 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/apm/classes.js +++ b/x-pack/plugins/monitoring/server/lib/metrics/apm/classes.ts @@ -5,12 +5,16 @@ * 2.0. */ +/* eslint-disable max-classes-per-file */ + +import { i18n } from '@kbn/i18n'; +// @ts-ignore import { ClusterMetric, Metric } from '../classes'; import { SMALL_FLOAT, LARGE_FLOAT } from '../../../../common/formatting'; -import { i18n } from '@kbn/i18n'; import { NORMALIZED_DERIVATIVE_UNIT } from '../../../../common/constants'; export class ApmClusterMetric extends ClusterMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -28,6 +32,7 @@ export class ApmClusterMetric extends ClusterMetric { } export class ApmMetric extends Metric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -44,7 +49,10 @@ export class ApmMetric extends Metric { } } +export type ApmMetricFields = ReturnType; + export class ApmCpuUtilizationMetric extends ApmMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -57,6 +65,7 @@ export class ApmCpuUtilizationMetric extends ApmMetric { /* * Convert a counter of milliseconds of utilization time into a percentage of the bucket size */ + // @ts-ignore this.calculation = ({ metric_deriv: metricDeriv } = {}, _key, _metric, bucketSizeInSeconds) => { if (metricDeriv) { const { value: metricDerivValue } = metricDeriv; @@ -72,6 +81,7 @@ export class ApmCpuUtilizationMetric extends ApmMetric { } export class ApmEventsRateClusterMetric extends ApmClusterMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -83,6 +93,7 @@ export class ApmEventsRateClusterMetric extends ApmClusterMetric { }), }); + // @ts-ignore this.aggs = { beats_uuids: { terms: { @@ -92,6 +103,7 @@ export class ApmEventsRateClusterMetric extends ApmClusterMetric { aggs: { event_rate_per_beat: { max: { + // @ts-ignore field: this.field, }, }, diff --git a/x-pack/plugins/monitoring/server/lib/metrics/beats/classes.js b/x-pack/plugins/monitoring/server/lib/metrics/beats/classes.ts similarity index 91% rename from x-pack/plugins/monitoring/server/lib/metrics/beats/classes.js rename to x-pack/plugins/monitoring/server/lib/metrics/beats/classes.ts index 4af71d2fd4bd7..78e731cee8881 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/beats/classes.js +++ b/x-pack/plugins/monitoring/server/lib/metrics/beats/classes.ts @@ -5,16 +5,20 @@ * 2.0. */ +/* eslint-disable max-classes-per-file */ + +import { i18n } from '@kbn/i18n'; +// @ts-ignore import { ClusterMetric, Metric } from '../classes'; import { SMALL_FLOAT, LARGE_FLOAT, LARGE_BYTES } from '../../../../common/formatting'; import { NORMALIZED_DERIVATIVE_UNIT } from '../../../../common/constants'; -import { i18n } from '@kbn/i18n'; const perSecondUnitLabel = i18n.translate('xpack.monitoring.metrics.beats.perSecondUnitLabel', { defaultMessage: '/s', }); export class BeatsClusterMetric extends ClusterMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -32,6 +36,7 @@ export class BeatsClusterMetric extends ClusterMetric { } export class BeatsEventsRateClusterMetric extends BeatsClusterMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -40,6 +45,7 @@ export class BeatsEventsRateClusterMetric extends BeatsClusterMetric { metricAgg: 'max', units: perSecondUnitLabel, }); + // @ts-ignore this.aggs = { beats_uuids: { @@ -50,6 +56,7 @@ export class BeatsEventsRateClusterMetric extends BeatsClusterMetric { aggs: { event_rate_per_beat: { max: { + // @ts-ignore field: this.field, }, }, @@ -73,6 +80,7 @@ export class BeatsEventsRateClusterMetric extends BeatsClusterMetric { } export class BeatsMetric extends Metric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -89,7 +97,10 @@ export class BeatsMetric extends Metric { } } +export type BeatsMetricFields = ReturnType; + export class BeatsByteRateClusterMetric extends BeatsEventsRateClusterMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -99,6 +110,7 @@ export class BeatsByteRateClusterMetric extends BeatsEventsRateClusterMetric { } export class BeatsEventsRateMetric extends BeatsMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -111,6 +123,7 @@ export class BeatsEventsRateMetric extends BeatsMetric { } export class BeatsByteRateMetric extends BeatsMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -123,6 +136,7 @@ export class BeatsByteRateMetric extends BeatsMetric { } export class BeatsCpuUtilizationMetric extends BeatsMetric { + // @ts-ignore constructor(opts) { super({ ...opts, @@ -135,6 +149,7 @@ export class BeatsCpuUtilizationMetric extends BeatsMetric { /* * Convert a counter of milliseconds of utilization time into a percentage of the bucket size */ + // @ts-ignore this.calculation = ({ metric_deriv: metricDeriv } = {}, _key, _metric, bucketSizeInSeconds) => { if (metricDeriv) { const { value } = metricDeriv; diff --git a/x-pack/plugins/monitoring/server/lib/metrics/index.js b/x-pack/plugins/monitoring/server/lib/metrics/index.ts similarity index 69% rename from x-pack/plugins/monitoring/server/lib/metrics/index.js rename to x-pack/plugins/monitoring/server/lib/metrics/index.ts index c2b24f653bc9d..ba43a8c316d3b 100644 --- a/x-pack/plugins/monitoring/server/lib/metrics/index.js +++ b/x-pack/plugins/monitoring/server/lib/metrics/index.ts @@ -5,9 +5,13 @@ * 2.0. */ +// @ts-ignore export { ElasticsearchMetric } from './elasticsearch/classes'; +// @ts-ignore export { KibanaClusterMetric, KibanaMetric } from './kibana/classes'; -export { ApmMetric, ApmClusterMetric } from './apm/classes'; +export { ApmMetric, ApmClusterMetric, ApmMetricFields } from './apm/classes'; +// @ts-ignore export { LogstashClusterMetric, LogstashMetric } from './logstash/classes'; -export { BeatsClusterMetric, BeatsMetric } from './beats/classes'; +export { BeatsClusterMetric, BeatsMetric, BeatsMetricFields } from './beats/classes'; +// @ts-ignore export { metrics } from './metrics'; diff --git a/x-pack/plugins/monitoring/server/lib/normalize_version_string.js b/x-pack/plugins/monitoring/server/lib/normalize_version_string.ts similarity index 90% rename from x-pack/plugins/monitoring/server/lib/normalize_version_string.js rename to x-pack/plugins/monitoring/server/lib/normalize_version_string.ts index 359db54ae9661..5d49304414846 100644 --- a/x-pack/plugins/monitoring/server/lib/normalize_version_string.js +++ b/x-pack/plugins/monitoring/server/lib/normalize_version_string.ts @@ -6,7 +6,7 @@ */ import { escape } from 'lodash'; -export function normalizeVersionString(string) { +export function normalizeVersionString(string: string) { if (string) { // get just the number.number.number portion (filter out '-snapshot') const matches = string.match(/^\d+\.\d+.\d+/); diff --git a/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.js b/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.ts similarity index 92% rename from x-pack/plugins/monitoring/server/lib/standalone_clusters/index.js rename to x-pack/plugins/monitoring/server/lib/standalone_clusters/index.ts index f15d3819fb03e..edd18710b940b 100644 --- a/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.js +++ b/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.ts @@ -5,6 +5,9 @@ * 2.0. */ +// @ts-ignore export { hasStandaloneClusters } from './has_standalone_clusters'; +// @ts-ignore export { getStandaloneClusterDefinition } from './get_standalone_cluster_definition'; +// @ts-ignore export { standaloneClusterFilter } from './standalone_cluster_query_filter'; diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/alerts/status.ts b/x-pack/plugins/monitoring/server/routes/api/v1/alerts/status.ts index f77630e5d61a5..27b21c342f037 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/alerts/status.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/alerts/status.ts @@ -41,7 +41,6 @@ export function alertStatusRoute(server: any, npRoute: RouteDependencies) { const status = await fetchStatus( rulesClient, - npRoute.licenseService, alertTypeIds, [clusterUuid], filters as CommonAlertFilter[] diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.js b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts similarity index 89% rename from x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.js rename to x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts index e6de6ca984cb1..2629d763d656d 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.js +++ b/x-pack/plugins/monitoring/server/routes/api/v1/cluster/cluster.ts @@ -7,10 +7,12 @@ import { schema } from '@kbn/config-schema'; import { getClustersFromRequest } from '../../../../lib/cluster/get_clusters_from_request'; +// @ts-ignore import { handleError } from '../../../../lib/errors'; import { getIndexPatterns } from '../../../../lib/cluster/get_index_patterns'; +import { LegacyRequest, LegacyServer } from '../../../../types'; -export function clusterRoute(server) { +export function clusterRoute(server: LegacyServer) { /* * Cluster Overview */ @@ -32,11 +34,11 @@ export function clusterRoute(server) { }), }, }, - handler: async (req) => { + handler: async (req: LegacyRequest) => { const config = server.config(); const indexPatterns = getIndexPatterns(server, { - filebeatIndexPattern: config.get('monitoring.ui.logs.index'), + filebeatIndexPattern: config.get('monitoring.ui.logs.index')!, }); const options = { clusterUuid: req.params.clusterUuid, diff --git a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch_settings/check/internal_monitoring.ts b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch_settings/check/internal_monitoring.ts index c2bad7b905c5b..d05d60866d119 100644 --- a/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch_settings/check/internal_monitoring.ts +++ b/x-pack/plugins/monitoring/server/routes/api/v1/elasticsearch_settings/check/internal_monitoring.ts @@ -17,7 +17,7 @@ import { import { prefixIndexPattern } from '../../../../../lib/ccs_utils'; // @ts-ignore import { handleError } from '../../../../../lib/errors'; -import { RouteDependencies } from '../../../../../types'; +import { RouteDependencies, LegacyServer } from '../../../../../types'; const queryBody = { size: 0, @@ -70,10 +70,7 @@ const checkLatestMonitoringIsLegacy = async (context: RequestHandlerContext, ind return counts; }; -export function internalMonitoringCheckRoute( - server: { config: () => unknown }, - npRoute: RouteDependencies -) { +export function internalMonitoringCheckRoute(server: LegacyServer, npRoute: RouteDependencies) { npRoute.router.post( { path: '/api/monitoring/v1/elasticsearch_settings/check/internal_monitoring', diff --git a/x-pack/plugins/monitoring/server/types.ts b/x-pack/plugins/monitoring/server/types.ts index 07e56f0c00232..a057b72d89b29 100644 --- a/x-pack/plugins/monitoring/server/types.ts +++ b/x-pack/plugins/monitoring/server/types.ts @@ -30,6 +30,7 @@ import { LicensingPluginStart } from '../../licensing/server'; import { PluginSetupContract as FeaturesPluginSetupContract } from '../../features/server'; import { EncryptedSavedObjectsPluginSetup } from '../../encrypted_saved_objects/server'; import { CloudSetup } from '../../cloud/server'; +import { ElasticsearchModifiedSource } from '../common/types/es'; export interface MonitoringLicenseService { refresh: () => Promise; @@ -146,3 +147,20 @@ export interface LegacyServer { }; }; } + +export type Cluster = ElasticsearchModifiedSource & { + ml?: { jobs: any }; + logs?: any; + alerts?: any; +}; + +export interface Bucket { + key: string; + uuids: { + buckets: unknown[]; + }; +} + +export interface Aggregation { + buckets: Bucket[]; +} diff --git a/x-pack/plugins/observability/public/components/app/resources/index.test.tsx b/x-pack/plugins/observability/public/components/app/resources/index.test.tsx index 7a1b84c04c035..e5a8bd3d097fc 100644 --- a/x-pack/plugins/observability/public/components/app/resources/index.test.tsx +++ b/x-pack/plugins/observability/public/components/app/resources/index.test.tsx @@ -13,7 +13,8 @@ describe('Resources', () => { it('renders resources with all elements', () => { const { getByText } = render(); expect(getByText('Documentation')).toBeInTheDocument(); - expect(getByText('Discuss forum')).toBeInTheDocument(); - expect(getByText('Observability fundamentals')).toBeInTheDocument(); + expect(getByText('Discuss Forum')).toBeInTheDocument(); + expect(getByText('Quick Start Videos')).toBeInTheDocument(); + expect(getByText('Free Observability Course')).toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/observability/public/components/app/resources/index.tsx b/x-pack/plugins/observability/public/components/app/resources/index.tsx index 1a0c473734993..dfb50c9ad825f 100644 --- a/x-pack/plugins/observability/public/components/app/resources/index.tsx +++ b/x-pack/plugins/observability/public/components/app/resources/index.tsx @@ -20,14 +20,21 @@ const resources = [ { iconType: 'editorComment', label: i18n.translate('xpack.observability.resources.forum', { - defaultMessage: 'Discuss forum', + defaultMessage: 'Discuss Forum', }), href: 'https://ela.st/observability-discuss', }, + { + iconType: 'play', + label: i18n.translate('xpack.observability.resources.quick_start', { + defaultMessage: 'Quick Start Videos', + }), + href: 'https://ela.st/observability-quick-starts', + }, { iconType: 'training', label: i18n.translate('xpack.observability.resources.training', { - defaultMessage: 'Observability fundamentals', + defaultMessage: 'Free Observability Course', }), href: 'https://ela.st/observability-training', }, diff --git a/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx b/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx index bd6844915459c..77c2b5cbca0cf 100644 --- a/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/alerts_table_t_grid.tsx @@ -120,7 +120,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { const leadingControlColumns = [ { id: 'expand', - width: 20, + width: 40, headerCellRender: () => { return ( @@ -149,7 +149,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { }, { id: 'view_in_app', - width: 20, + width: 40, headerCellRender: () => null, rowCellRender: ({ data }: ActionProps) => { const dataFieldEs = data.reduce((acc, d) => ({ ...acc, [d.field]: d.value }), {}); diff --git a/x-pack/plugins/reporting/common/constants.ts b/x-pack/plugins/reporting/common/constants.ts index 16839173708e3..be543b3908b68 100644 --- a/x-pack/plugins/reporting/common/constants.ts +++ b/x-pack/plugins/reporting/common/constants.ts @@ -111,6 +111,11 @@ export enum JOB_STATUSES { export const REPORT_TABLE_ID = 'reportJobListing'; export const REPORT_TABLE_ROW_ID = 'reportJobRow'; +// Job params require a `version` field as of 7.15.0. For older jobs set with +// automation that have no version value in the job params, we assume the +// intended version is 7.14.0 +export const UNVERSIONED_VERSION = '7.14.0'; + // hacky endpoint: download CSV without queueing a report // FIXME: find a way to make these endpoints "generic" instead of hardcoded, as are the queued report export types export const API_GENERATE_IMMEDIATE = `${API_BASE_URL_V1}/generate/immediate/csv_searchsource`; diff --git a/x-pack/plugins/reporting/common/types.ts b/x-pack/plugins/reporting/common/types.ts index dfd4f75508494..f3a0e9192cf7d 100644 --- a/x-pack/plugins/reporting/common/types.ts +++ b/x-pack/plugins/reporting/common/types.ts @@ -97,10 +97,11 @@ export interface ReportDocument extends ReportDocumentHead { } export interface BaseParams { - browserTimezone?: string; // browserTimezone is optional: it is not in old POST URLs that were generated prior to being added to this interface layout?: LayoutParams; objectType: string; title: string; + browserTimezone: string; // to format dates in the user's time zone + version: string; // to handle any state migrations } export type JobId = string; diff --git a/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts b/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts index 9396f23277496..5c618ba8261fa 100644 --- a/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts +++ b/x-pack/plugins/reporting/public/lib/reporting_api_client/reporting_api_client.ts @@ -6,34 +6,45 @@ */ import { i18n } from '@kbn/i18n'; +import moment from 'moment'; import { stringify } from 'query-string'; -import rison from 'rison-node'; -import { HttpSetup } from 'src/core/public'; +import rison, { RisonObject } from 'rison-node'; +import { HttpSetup, IUiSettingsClient } from 'src/core/public'; import { API_BASE_GENERATE, API_BASE_URL, + API_GENERATE_IMMEDIATE, API_LIST_URL, API_MIGRATE_ILM_POLICY_URL, REPORTING_MANAGEMENT_HOME, } from '../../../common/constants'; -import { DownloadReportFn, JobId, ManagementLinkFn, ReportApiJSON } from '../../../common/types'; +import { + BaseParams, + DownloadReportFn, + JobId, + ManagementLinkFn, + ReportApiJSON, +} from '../../../common/types'; import { add } from '../../notifier/job_completion_notifications'; import { Job } from '../job'; +/* + * For convenience, apps do not have to provide the browserTimezone and Kibana version. + * Those fields are added in this client as part of the service. + * TODO: export a type like this to other plugins: https://github.com/elastic/kibana/issues/107085 + */ +type AppParams = Omit; + export interface DiagnoseResponse { help: string[]; success: boolean; logs: string; } -interface JobParams { - [paramName: string]: any; -} - interface IReportingAPI { // Helpers getReportURL(jobId: string): string; - getReportingJobPath(exportType: string, jobParams: JobParams): string; // Return a URL to queue a job, with the job params encoded in the query string of the URL. Used for copying POST URL + getReportingJobPath(exportType: string, jobParams: BaseParams & T): string; // Return a URL to queue a job, with the job params encoded in the query string of the URL. Used for copying POST URL createReportingJob(exportType: string, jobParams: any): Promise; // Sends a request to queue a job, with the job params in the POST body getServerBasePath(): string; // Provides the raw server basePath to allow it to be stripped out from relativeUrls in job params @@ -57,11 +68,11 @@ interface IReportingAPI { } export class ReportingAPIClient implements IReportingAPI { - private http: HttpSetup; - - constructor(http: HttpSetup) { - this.http = http; - } + constructor( + private http: HttpSetup, + private uiSettings: IUiSettingsClient, + private kibanaVersion: string + ) {} public getReportURL(jobId: string) { const apiBaseUrl = this.http.basePath.prepend(API_LIST_URL); @@ -132,13 +143,15 @@ export class ReportingAPIClient implements IReportingAPI { return reports.map((report) => new Job(report)); } - public getReportingJobPath(exportType: string, jobParams: JobParams) { - const params = stringify({ jobParams: rison.encode(jobParams) }); + public getReportingJobPath(exportType: string, jobParams: BaseParams) { + const risonObject: RisonObject = jobParams as Record; + const params = stringify({ jobParams: rison.encode(risonObject) }); return `${this.http.basePath.prepend(API_BASE_GENERATE)}/${exportType}?${params}`; } - public async createReportingJob(exportType: string, jobParams: any) { - const jobParamsRison = rison.encode(jobParams); + public async createReportingJob(exportType: string, jobParams: BaseParams) { + const risonObject: RisonObject = jobParams as Record; + const jobParamsRison = rison.encode(risonObject); const resp: { job: ReportApiJSON } = await this.http.post( `${API_BASE_GENERATE}/${exportType}`, { @@ -154,6 +167,27 @@ export class ReportingAPIClient implements IReportingAPI { return new Job(resp.job); } + public async createImmediateReport(baseParams: BaseParams) { + const { objectType: _objectType, ...params } = baseParams; // objectType is not needed for immediate download api + return this.http.post(`${API_GENERATE_IMMEDIATE}`, { body: JSON.stringify(params) }); + } + + public getDecoratedJobParams(baseParams: T): BaseParams { + // If the TZ is set to the default "Browser", it will not be useful for + // server-side export. We need to derive the timezone and pass it as a param + // to the export API. + const browserTimezone: string = + this.uiSettings.get('dateFormat:tz') === 'Browser' + ? moment.tz.guess() + : this.uiSettings.get('dateFormat:tz'); + + return { + browserTimezone, + version: this.kibanaVersion, + ...baseParams, + }; + } + public getManagementLink: ManagementLinkFn = () => this.http.basePath.prepend(REPORTING_MANAGEMENT_HOME); diff --git a/x-pack/plugins/reporting/public/lib/stream_handler.test.ts b/x-pack/plugins/reporting/public/lib/stream_handler.test.ts index 661370446011f..518c8ef11857a 100644 --- a/x-pack/plugins/reporting/public/lib/stream_handler.test.ts +++ b/x-pack/plugins/reporting/public/lib/stream_handler.test.ts @@ -26,7 +26,8 @@ const mockJobsFound: Job[] = [ { id: 'job-source-mock3', status: 'pending', output: { csv_contains_formulas: false, max_size_reached: false }, payload: { title: 'specimen' } }, ].map((j) => new Job(j as ReportApiJSON)); // prettier-ignore -const jobQueueClientMock = new ReportingAPIClient(coreMock.createSetup().http); +const coreSetup = coreMock.createSetup(); +const jobQueueClientMock = new ReportingAPIClient(coreSetup.http, coreSetup.uiSettings, '7.15.0'); jobQueueClientMock.findForJobIds = async () => mockJobsFound; jobQueueClientMock.getInfo = () => Promise.resolve(({ content: 'this is the completed report data' } as unknown) as Job); diff --git a/x-pack/plugins/reporting/public/management/report_info_button.test.tsx b/x-pack/plugins/reporting/public/management/report_info_button.test.tsx index 147e18410200b..c52027355ac5e 100644 --- a/x-pack/plugins/reporting/public/management/report_info_button.test.tsx +++ b/x-pack/plugins/reporting/public/management/report_info_button.test.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { mountWithIntl } from '@kbn/test/jest'; +import { coreMock } from '../../../../../src/core/public/mocks'; import { Job } from '../lib/job'; import { ReportInfoButton } from './report_info_button'; @@ -14,8 +15,9 @@ jest.mock('../lib/reporting_api_client'); import { ReportingAPIClient } from '../lib/reporting_api_client'; -const httpSetup = {} as any; -const apiClient = new ReportingAPIClient(httpSetup); +const coreSetup = coreMock.createSetup(); +const apiClient = new ReportingAPIClient(coreSetup.http, coreSetup.uiSettings, '7.15.0'); + const job = new Job({ id: 'abc-123', index: '.reporting-2020.04.12', @@ -29,6 +31,7 @@ const job = new Job({ meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, payload: { browserTimezone: 'America/Phoenix', + version: '7.15.0-test', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', diff --git a/x-pack/plugins/reporting/public/management/report_listing.test.tsx b/x-pack/plugins/reporting/public/management/report_listing.test.tsx index 47969edb72fda..dd8b60801066f 100644 --- a/x-pack/plugins/reporting/public/management/report_listing.test.tsx +++ b/x-pack/plugins/reporting/public/management/report_listing.test.tsx @@ -32,15 +32,15 @@ jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => { }); const mockJobs: ReportApiJSON[] = [ - { id: 'k90e51pk1ieucbae0c3t8wo2', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 0, browser_type: 'chromium', created_at: '2020-04-14T21:01:13.064Z', created_by: 'elastic', jobtype: 'printable_pdf', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '1970-01-01T00:00:00.000Z', status: 'pending', timeout: 300000 }, // prettier-ignore - { id: 'k90e51pk1ieucbae0c3t8wo1', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', created_at: '2020-04-14T21:01:13.064Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '2020-04-14T21:06:14.526Z', started_at: '2020-04-14T21:01:14.526Z', status: 'processing', timeout: 300000 }, - { id: 'k90cmthd1gv8cbae0c2le8bo', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T20:19:14.748Z', created_at: '2020-04-14T20:19:02.977Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '2020-04-14T20:24:04.073Z', started_at: '2020-04-14T20:19:04.073Z', status: 'completed', timeout: 300000 }, - { id: 'k906958e1d4wcbae0c9hip1a', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:21:08.223Z', created_at: '2020-04-14T17:20:27.326Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 49468, warnings: [ 'An error occurred when trying to read the page for visualization panel info. You may need to increase \'xpack.reporting.capture.timeouts.waitForElements\'. TimeoutError: waiting for selector "[data-shared-item],[data-shared-items-count]" failed: timeout 30000ms exceeded', ] }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '2020-04-14T17:25:29.444Z', started_at: '2020-04-14T17:20:29.444Z', status: 'completed_with_warnings', timeout: 300000 }, - { id: 'k9067y2a1d4wcbae0cad38n0', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:19:53.244Z', created_at: '2020-04-14T17:19:31.379Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '2020-04-14T17:24:39.883Z', started_at: '2020-04-14T17:19:39.883Z', status: 'completed', timeout: 300000 }, - { id: 'k9067s1m1d4wcbae0cdnvcms', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:19:36.822Z', created_at: '2020-04-14T17:19:23.578Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '2020-04-14T17:24:25.247Z', started_at: '2020-04-14T17:19:25.247Z', status: 'completed', timeout: 300000 }, - { id: 'k9065q3s1d4wcbae0c00fxlh', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:18:03.910Z', created_at: '2020-04-14T17:17:47.752Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '2020-04-14T17:22:50.379Z', started_at: '2020-04-14T17:17:50.379Z', status: 'completed', timeout: 300000 }, - { id: 'k905zdw11d34cbae0c3y6tzh', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:13:03.719Z', created_at: '2020-04-14T17:12:51.985Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad' }, process_expiration: '2020-04-14T17:17:52.431Z', started_at: '2020-04-14T17:12:52.431Z', status: 'completed', timeout: 300000 }, - { id: 'k8t4ylcb07mi9d006214ifyg', index: '.reporting-2020.04.05', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-09T19:10:10.049Z', created_at: '2020-04-09T19:09:52.139Z', created_by: 'elastic', jobtype: 'PNG', kibana_id: 'f2e59b4e-f79b-4a48-8a7d-6d50a3c1d914', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'png', objectType: 'visualization' }, output: { content_type: 'image/png', size: 123456789 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 1575, width: 1423 }, id: 'png' }, objectType: 'visualization', title: 'count' }, process_expiration: '2020-04-09T19:14:54.570Z', started_at: '2020-04-09T19:09:54.570Z', status: 'completed', timeout: 300000 }, + { id: 'k90e51pk1ieucbae0c3t8wo2', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 0, browser_type: 'chromium', created_at: '2020-04-14T21:01:13.064Z', created_by: 'elastic', jobtype: 'printable_pdf', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '1970-01-01T00:00:00.000Z', status: 'pending', timeout: 300000}, // prettier-ignore + { id: 'k90e51pk1ieucbae0c3t8wo1', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', created_at: '2020-04-14T21:01:13.064Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '2020-04-14T21:06:14.526Z', started_at: '2020-04-14T21:01:14.526Z', status: 'processing', timeout: 300000 }, + { id: 'k90cmthd1gv8cbae0c2le8bo', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T20:19:14.748Z', created_at: '2020-04-14T20:19:02.977Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '2020-04-14T20:24:04.073Z', started_at: '2020-04-14T20:19:04.073Z', status: 'completed', timeout: 300000 }, + { id: 'k906958e1d4wcbae0c9hip1a', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:21:08.223Z', created_at: '2020-04-14T17:20:27.326Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 49468, warnings: [ 'An error occurred when trying to read the page for visualization panel info. You may need to increase \'xpack.reporting.capture.timeouts.waitForElements\'. TimeoutError: waiting for selector "[data-shared-item],[data-shared-items-count]" failed: timeout 30000ms exceeded' ] }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '2020-04-14T17:25:29.444Z', started_at: '2020-04-14T17:20:29.444Z', status: 'completed_with_warnings', timeout: 300000 }, + { id: 'k9067y2a1d4wcbae0cad38n0', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:19:53.244Z', created_at: '2020-04-14T17:19:31.379Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '2020-04-14T17:24:39.883Z', started_at: '2020-04-14T17:19:39.883Z', status: 'completed', timeout: 300000 }, + { id: 'k9067s1m1d4wcbae0cdnvcms', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:19:36.822Z', created_at: '2020-04-14T17:19:23.578Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '2020-04-14T17:24:25.247Z', started_at: '2020-04-14T17:19:25.247Z', status: 'completed', timeout: 300000 }, + { id: 'k9065q3s1d4wcbae0c00fxlh', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:18:03.910Z', created_at: '2020-04-14T17:17:47.752Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '2020-04-14T17:22:50.379Z', started_at: '2020-04-14T17:17:50.379Z', status: 'completed', timeout: 300000 }, + { id: 'k905zdw11d34cbae0c3y6tzh', index: '.reporting-2020.04.12', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-14T17:13:03.719Z', created_at: '2020-04-14T17:12:51.985Z', created_by: 'elastic', jobtype: 'printable_pdf', kibana_id: '5b2de169-2785-441b-ae8c-186a1936b17d', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'preserve_layout', objectType: 'canvas workpad' }, output: { content_type: 'application/pdf', size: 80262 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 720, width: 1080 }, id: 'preserve_layout' }, objectType: 'canvas workpad', title: 'My Canvas Workpad', version: '7.14.0' }, process_expiration: '2020-04-14T17:17:52.431Z', started_at: '2020-04-14T17:12:52.431Z', status: 'completed', timeout: 300000 }, + { id: 'k8t4ylcb07mi9d006214ifyg', index: '.reporting-2020.04.05', migration_version: '7.15.0', attempts: 1, browser_type: 'chromium', completed_at: '2020-04-09T19:10:10.049Z', created_at: '2020-04-09T19:09:52.139Z', created_by: 'elastic', jobtype: 'PNG', kibana_id: 'f2e59b4e-f79b-4a48-8a7d-6d50a3c1d914', kibana_name: 'spicy.local', max_attempts: 1, meta: { layout: 'png', objectType: 'visualization' }, output: { content_type: 'image/png', size: 123456789 }, payload: { browserTimezone: 'America/Phoenix', layout: { dimensions: { height: 1575, width: 1423 }, id: 'png' }, objectType: 'visualization', title: 'count', version: '7.14.0' }, process_expiration: '2020-04-09T19:14:54.570Z', started_at: '2020-04-09T19:09:54.570Z', status: 'completed', timeout: 300000 }, ]; // prettier-ignore const reportingAPIClient = { diff --git a/x-pack/plugins/reporting/public/mocks.ts b/x-pack/plugins/reporting/public/mocks.ts index a6b6d835499c6..41b4d26dc5a59 100644 --- a/x-pack/plugins/reporting/public/mocks.ts +++ b/x-pack/plugins/reporting/public/mocks.ts @@ -6,6 +6,7 @@ */ import { coreMock } from 'src/core/public/mocks'; +import { ReportingAPIClient } from './lib/reporting_api_client'; import { ReportingSetup } from '.'; import { getDefaultLayoutSelectors } from '../common'; import { getSharedComponents } from './shared'; @@ -14,10 +15,11 @@ type Setup = jest.Mocked; const createSetupContract = (): Setup => { const coreSetup = coreMock.createSetup(); + const apiClient = new ReportingAPIClient(coreSetup.http, coreSetup.uiSettings, '7.15.0'); return { getDefaultLayoutSelectors: jest.fn().mockImplementation(getDefaultLayoutSelectors), usesUiCapabilities: jest.fn().mockImplementation(() => true), - components: getSharedComponents(coreSetup), + components: getSharedComponents(coreSetup, apiClient), }; }; diff --git a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts index dbd0421fdf9b0..45bd20df85660 100644 --- a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts +++ b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.test.ts @@ -8,13 +8,17 @@ import * as Rx from 'rxjs'; import { first } from 'rxjs/operators'; import { CoreStart } from 'src/core/public'; +import { coreMock } from '../../../../../src/core/public/mocks'; import { LicensingPluginSetup } from '../../../licensing/public'; +import { ReportingAPIClient } from '../lib/reporting_api_client'; import { ReportingCsvPanelAction } from './get_csv_panel_action'; type LicenseResults = 'valid' | 'invalid' | 'unavailable' | 'expired'; +const core = coreMock.createSetup(); +let apiClient: ReportingAPIClient; + describe('GetCsvReportPanelAction', () => { - let core: any; let context: any; let mockLicense$: any; let mockSearchSource: any; @@ -32,6 +36,9 @@ describe('GetCsvReportPanelAction', () => { }); beforeEach(() => { + apiClient = new ReportingAPIClient(core.http, core.uiSettings, '7.15.0'); + jest.spyOn(apiClient, 'createImmediateReport'); + mockLicense$ = (state: LicenseResults = 'valid') => { return (Rx.of({ check: jest.fn().mockImplementation(() => ({ state })), @@ -47,21 +54,6 @@ describe('GetCsvReportPanelAction', () => { null, ]; - core = { - http: { - post: jest.fn().mockImplementation(() => Promise.resolve(true)), - }, - notifications: { - toasts: { - addSuccess: jest.fn(), - addDanger: jest.fn(), - }, - }, - uiSettings: { - get: () => 'Browser', - }, - } as any; - mockSearchSource = { createCopy: () => mockSearchSource, removeField: jest.fn(), @@ -92,6 +84,7 @@ describe('GetCsvReportPanelAction', () => { it('translates empty embeddable context into job params', async () => { const panel = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -101,12 +94,14 @@ describe('GetCsvReportPanelAction', () => { await panel.execute(context); - expect(core.http.post).toHaveBeenCalledWith( - '/api/reporting/v1/generate/immediate/csv_searchsource', - { - body: '{"searchSource":{},"columns":[],"browserTimezone":"America/New_York"}', - } - ); + expect(apiClient.createImmediateReport).toHaveBeenCalledWith({ + browserTimezone: undefined, + columns: [], + objectType: 'downloadCsv', + searchSource: {}, + title: undefined, + version: '7.15.0', + }); }); it('translates embeddable context into job params', async () => { @@ -126,6 +121,7 @@ describe('GetCsvReportPanelAction', () => { const panel = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -135,18 +131,20 @@ describe('GetCsvReportPanelAction', () => { await panel.execute(context); - expect(core.http.post).toHaveBeenCalledWith( - '/api/reporting/v1/generate/immediate/csv_searchsource', - { - body: - '{"searchSource":{"testData":"testDataValue"},"columns":["column_a","column_b"],"browserTimezone":"America/New_York"}', - } - ); + expect(apiClient.createImmediateReport).toHaveBeenCalledWith({ + browserTimezone: undefined, + columns: ['column_a', 'column_b'], + objectType: 'downloadCsv', + searchSource: { testData: 'testDataValue' }, + title: undefined, + version: '7.15.0', + }); }); it('allows downloading for valid licenses', async () => { const panel = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -162,6 +160,7 @@ describe('GetCsvReportPanelAction', () => { it('shows a good old toastie when it successfully starts', async () => { const panel = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -176,14 +175,10 @@ describe('GetCsvReportPanelAction', () => { }); it('shows a bad old toastie when it successfully fails', async () => { - const coreFails = { - ...core, - http: { - post: jest.fn().mockImplementation(() => Promise.reject('No more ram!')), - }, - }; + apiClient.createImmediateReport = jest.fn().mockRejectedValue('No more ram!'); const panel = new ReportingCsvPanelAction({ - core: coreFails, + core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -200,6 +195,7 @@ describe('GetCsvReportPanelAction', () => { const licenseMock$ = mockLicense$('invalid'); const plugin = new ReportingCsvPanelAction({ core, + apiClient, license$: licenseMock$, startServices$: mockStartServices$, usesUiCapabilities: true, @@ -215,6 +211,7 @@ describe('GetCsvReportPanelAction', () => { it('sets a display and icon type', () => { const panel = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -230,6 +227,7 @@ describe('GetCsvReportPanelAction', () => { it(`doesn't allow downloads when UI capability is not enabled`, async () => { const plugin = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -248,6 +246,7 @@ describe('GetCsvReportPanelAction', () => { mockStartServices$ = new Rx.Subject(); const plugin = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: true, @@ -261,6 +260,7 @@ describe('GetCsvReportPanelAction', () => { it(`allows download when license is valid and deprecated roles config is enabled`, async () => { const plugin = new ReportingCsvPanelAction({ core, + apiClient, license$: mockLicense$(), startServices$: mockStartServices$, usesUiCapabilities: false, diff --git a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx index 8a863e1ceaa65..8b6e258c06535 100644 --- a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx +++ b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx @@ -6,9 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import moment from 'moment-timezone'; import * as Rx from 'rxjs'; -import type { CoreSetup } from 'src/core/public'; +import type { CoreSetup, IUiSettingsClient, NotificationsSetup } from 'src/core/public'; import { CoreStart } from 'src/core/public'; import type { ISearchEmbeddable, SavedSearch } from '../../../../../src/plugins/discover/public'; import { @@ -20,9 +19,9 @@ import { ViewMode } from '../../../../../src/plugins/embeddable/public'; import type { UiActionsActionDefinition as ActionDefinition } from '../../../../../src/plugins/ui_actions/public'; import { IncompatibleActionError } from '../../../../../src/plugins/ui_actions/public'; import type { LicensingPluginSetup } from '../../../licensing/public'; -import { API_GENERATE_IMMEDIATE, CSV_REPORTING_ACTION } from '../../common/constants'; -import type { JobParamsDownloadCSV } from '../../server/export_types/csv_searchsource_immediate/types'; +import { CSV_REPORTING_ACTION } from '../../common/constants'; import { checkLicense } from '../lib/license_check'; +import { ReportingAPIClient } from '../lib/reporting_api_client'; function isSavedSearchEmbeddable( embeddable: IEmbeddable | ISearchEmbeddable @@ -35,6 +34,7 @@ interface ActionContext { } interface Params { + apiClient: ReportingAPIClient; core: CoreSetup; startServices$: Rx.Observable<[CoreStart, object, unknown]>; license$: LicensingPluginSetup['license$']; @@ -47,11 +47,16 @@ export class ReportingCsvPanelAction implements ActionDefinition public readonly id = CSV_REPORTING_ACTION; private licenseHasDownloadCsv: boolean = false; private capabilityHasDownloadCsv: boolean = false; - private core: CoreSetup; + private uiSettings: IUiSettingsClient; + private notifications: NotificationsSetup; + private apiClient: ReportingAPIClient; - constructor({ core, startServices$, license$, usesUiCapabilities }: Params) { + constructor({ core, startServices$, license$, usesUiCapabilities, apiClient }: Params) { this.isDownloading = false; - this.core = core; + + this.uiSettings = core.uiSettings; + this.notifications = core.notifications; + this.apiClient = apiClient; license$.subscribe((license) => { const results = license.check('reporting', 'basic'); @@ -83,7 +88,7 @@ export class ReportingCsvPanelAction implements ActionDefinition return await getSharingData( savedSearch.searchSource, savedSearch, // TODO: get unsaved state (using embeddale.searchScope): https://github.com/elastic/kibana/issues/43977 - this.core.uiSettings + this.uiSettings ); } @@ -111,24 +116,16 @@ export class ReportingCsvPanelAction implements ActionDefinition const savedSearch = embeddable.getSavedSearch(); const { columns, searchSource } = await this.getSearchSource(savedSearch, embeddable); - // If the TZ is set to the default "Browser", it will not be useful for - // server-side export. We need to derive the timezone and pass it as a param - // to the export API. - // TODO: create a helper utility in Reporting. This is repeated in a few places. - const kibanaTimezone = this.core.uiSettings.get('dateFormat:tz'); - const browserTimezone = kibanaTimezone === 'Browser' ? moment.tz.guess() : kibanaTimezone; - const immediateJobParams: JobParamsDownloadCSV = { + const immediateJobParams = this.apiClient.getDecoratedJobParams({ searchSource, columns, - browserTimezone, title: savedSearch.title, - }; - - const body = JSON.stringify(immediateJobParams); + objectType: 'downloadCsv', // FIXME: added for typescript, but immediate download job does not need objectType + }); this.isDownloading = true; - this.core.notifications.toasts.addSuccess({ + this.notifications.toasts.addSuccess({ title: i18n.translate('xpack.reporting.dashboard.csvDownloadStartedTitle', { defaultMessage: `CSV Download Started`, }), @@ -138,9 +135,9 @@ export class ReportingCsvPanelAction implements ActionDefinition 'data-test-subj': 'csvDownloadStarted', }); - await this.core.http - .post(`${API_GENERATE_IMMEDIATE}`, { body }) - .then((rawResponse: string) => { + await this.apiClient + .createImmediateReport(immediateJobParams) + .then((rawResponse) => { this.isDownloading = false; const download = `${savedSearch.title}.csv`; @@ -166,7 +163,7 @@ export class ReportingCsvPanelAction implements ActionDefinition private onGenerationFail(error: Error) { this.isDownloading = false; - this.core.notifications.toasts.addDanger({ + this.notifications.toasts.addDanger({ title: i18n.translate('xpack.reporting.dashboard.failedCsvDownloadTitle', { defaultMessage: `CSV download failed`, }), diff --git a/x-pack/plugins/reporting/public/plugin.ts b/x-pack/plugins/reporting/public/plugin.ts index 44ecc01bd1eb3..757f226532d95 100644 --- a/x-pack/plugins/reporting/public/plugin.ts +++ b/x-pack/plugins/reporting/public/plugin.ts @@ -11,6 +11,8 @@ import { catchError, filter, map, mergeMap, takeUntil } from 'rxjs/operators'; import { CoreSetup, CoreStart, + HttpSetup, + IUiSettingsClient, NotificationsSetup, Plugin, PluginInitializerContext, @@ -32,15 +34,14 @@ import { ReportingNotifierStreamHandler as StreamHandler } from './lib/stream_ha import { getGeneralErrorToast } from './notifier'; import { ReportingCsvPanelAction } from './panel_actions/get_csv_panel_action'; import { getSharedComponents } from './shared'; -import { ReportingCsvShareProvider } from './share_context_menu/register_csv_reporting'; -import { reportingScreenshotShareProvider } from './share_context_menu/register_pdf_png_reporting'; - import type { SharePluginSetup, SharePluginStart, UiActionsSetup, UiActionsStart, } from './shared_imports'; +import { ReportingCsvShareProvider } from './share_context_menu/register_csv_reporting'; +import { reportingScreenshotShareProvider } from './share_context_menu/register_pdf_png_reporting'; export interface ClientConfigType { poll: { jobsRefresh: { interval: number; intervalErrorMultiplier: number } }; @@ -89,6 +90,8 @@ export class ReportingPublicPlugin ReportingPublicPluginSetupDendencies, ReportingPublicPluginStartDendencies > { + private kibanaVersion: string; + private apiClient?: ReportingAPIClient; private readonly stop$ = new Rx.ReplaySubject(1); private readonly title = i18n.translate('xpack.reporting.management.reportingTitle', { defaultMessage: 'Reporting', @@ -101,6 +104,17 @@ export class ReportingPublicPlugin constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); + this.kibanaVersion = initializerContext.env.packageInfo.version; + } + + /* + * Use a single instance of ReportingAPIClient for all the reporting code + */ + private getApiClient(http: HttpSetup, uiSettings: IUiSettingsClient) { + if (!this.apiClient) { + this.apiClient = new ReportingAPIClient(http, uiSettings, this.kibanaVersion); + } + return this.apiClient; } private getContract(core?: CoreSetup) { @@ -108,7 +122,7 @@ export class ReportingPublicPlugin this.contract = { getDefaultLayoutSelectors, usesUiCapabilities: () => this.config.roles?.enabled === false, - components: getSharedComponents(core), + components: getSharedComponents(core, this.getApiClient(core.http, core.uiSettings)), }; } @@ -120,11 +134,11 @@ export class ReportingPublicPlugin } public setup(core: CoreSetup, setupDeps: ReportingPublicPluginSetupDendencies) { - const { http, getStartServices, uiSettings } = core; + const { getStartServices, uiSettings } = core; const { home, management, - licensing: { license$ }, + licensing: { license$ }, // FIXME: 'license$' is deprecated share, uiActions, } = setupDeps; @@ -132,7 +146,7 @@ export class ReportingPublicPlugin const startServices$ = Rx.from(getStartServices()); const usesUiCapabilities = !this.config.roles.enabled; - const apiClient = new ReportingAPIClient(http); + const apiClient = this.getApiClient(core.http, core.uiSettings); home.featureCatalogue.register({ id: 'reporting', @@ -181,7 +195,7 @@ export class ReportingPublicPlugin uiActions.addTriggerAction( CONTEXT_MENU_TRIGGER, - new ReportingCsvPanelAction({ core, startServices$, license$, usesUiCapabilities }) + new ReportingCsvPanelAction({ core, apiClient, startServices$, license$, usesUiCapabilities }) ); const reportingStart = this.getContract(core); @@ -213,8 +227,8 @@ export class ReportingPublicPlugin } public start(core: CoreStart) { - const { http, notifications } = core; - const apiClient = new ReportingAPIClient(http); + const { notifications } = core; + const apiClient = this.getApiClient(core.http, core.uiSettings); const streamHandler = new StreamHandler(notifications, apiClient); const interval = durationToNumber(this.config.poll.jobsRefresh.interval); Rx.timer(0, interval) diff --git a/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap b/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap index 83dc0c9e215b0..6f0fc18e90adc 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap +++ b/x-pack/plugins/reporting/public/share_context_menu/__snapshots__/screen_capture_panel_content.test.tsx.snap @@ -349,7 +349,7 @@ exports[`ScreenCapturePanelContent properly renders a view with "canvas" layout ; + usesUiCapabilities: boolean; +} + +export interface ReportingSharingData { + title: string; + layout: LayoutParams; +} + +export interface JobParamsProviderOptions { + sharingData: ReportingSharingData; + shareableUrl: string; + objectType: string; +} diff --git a/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx b/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx index 7165fcf6f8681..040a1646ec1ba 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/register_csv_reporting.tsx @@ -6,35 +6,22 @@ */ import { i18n } from '@kbn/i18n'; -import moment from 'moment-timezone'; import React from 'react'; -import * as Rx from 'rxjs'; -import type { IUiSettingsClient, ToastsSetup } from 'src/core/public'; -import { CoreStart } from 'src/core/public'; import type { SearchSourceFields } from 'src/plugins/data/common'; +import { ExportPanelShareOpts } from '.'; import type { ShareContext } from '../../../../../src/plugins/share/public'; -import type { LicensingPluginSetup } from '../../../licensing/public'; import { CSV_JOB_TYPE } from '../../common/constants'; -import type { JobParamsCSV } from '../../server/export_types/csv_searchsource/types'; import { checkLicense } from '../lib/license_check'; -import type { ReportingAPIClient } from '../lib/reporting_api_client'; import { ReportingPanelContent } from './reporting_panel_content_lazy'; export const ReportingCsvShareProvider = ({ apiClient, toasts, + uiSettings, license$, startServices$, - uiSettings, usesUiCapabilities, -}: { - apiClient: ReportingAPIClient; - toasts: ToastsSetup; - license$: LicensingPluginSetup['license$']; - startServices$: Rx.Observable<[CoreStart, object, unknown]>; - uiSettings: IUiSettingsClient; - usesUiCapabilities: boolean; -}) => { +}: ExportPanelShareOpts) => { let licenseToolTipContent = ''; let licenseHasCsvReporting = false; let licenseDisabled = true; @@ -56,22 +43,12 @@ export const ReportingCsvShareProvider = ({ capabilityHasCsvReporting = true; // deprecated } - // If the TZ is set to the default "Browser", it will not be useful for - // server-side export. We need to derive the timezone and pass it as a param - // to the export API. - // TODO: create a helper utility in Reporting. This is repeated in a few places. - const browserTimezone = - uiSettings.get('dateFormat:tz') === 'Browser' - ? moment.tz.guess() - : uiSettings.get('dateFormat:tz'); - const getShareMenuItems = ({ objectType, objectId, sharingData, onClose }: ShareContext) => { if ('search' !== objectType) { return []; } - const jobParams: JobParamsCSV = { - browserTimezone, + const jobParams = { title: sharingData.title as string, objectType, searchSource: sharingData.searchSource as SearchSourceFields, @@ -104,6 +81,7 @@ export const ReportingCsvShareProvider = ({ requiresSavedState={false} apiClient={apiClient} toasts={toasts} + uiSettings={uiSettings} reportType={CSV_JOB_TYPE} layoutId={undefined} objectId={objectId} diff --git a/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx b/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx index eb80f64be55e1..b37e31578be6d 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/register_pdf_png_reporting.tsx @@ -6,83 +6,53 @@ */ import { i18n } from '@kbn/i18n'; -import moment from 'moment-timezone'; import React from 'react'; -import * as Rx from 'rxjs'; -import type { IUiSettingsClient, ToastsSetup } from 'src/core/public'; -import { CoreStart } from 'src/core/public'; import { ShareContext } from 'src/plugins/share/public'; -import type { LicensingPluginSetup } from '../../../licensing/public'; -import type { LayoutParams } from '../../common/types'; -import type { JobParamsPNG } from '../../server/export_types/png/types'; -import type { JobParamsPDF } from '../../server/export_types/printable_pdf/types'; +import { ExportPanelShareOpts, JobParamsProviderOptions, ReportingSharingData } from '.'; import { checkLicense } from '../lib/license_check'; -import type { ReportingAPIClient } from '../lib/reporting_api_client'; +import { ReportingAPIClient } from '../lib/reporting_api_client'; import { ScreenCapturePanelContent } from './screen_capture_panel_content_lazy'; -interface JobParamsProviderOptions { - shareableUrl: string; - apiClient: ReportingAPIClient; - objectType: string; - browserTimezone: string; - sharingData: Record; -} - -const jobParamsProvider = ({ - objectType, - browserTimezone, - sharingData, -}: JobParamsProviderOptions) => { - return { +const getJobParams = ( + apiClient: ReportingAPIClient, + opts: JobParamsProviderOptions, + type: 'pdf' | 'png' +) => () => { + const { objectType, - browserTimezone, - layout: sharingData.layout as LayoutParams, - title: sharingData.title as string, + sharingData: { title, layout }, + } = opts; + + const baseParams = { + objectType, + layout, + title, }; -}; -const getPdfJobParams = (opts: JobParamsProviderOptions) => (): JobParamsPDF => { // Relative URL must have URL prefix (Spaces ID prefix), but not server basePath // Replace hashes with original RISON values. const relativeUrl = opts.shareableUrl.replace( - window.location.origin + opts.apiClient.getServerBasePath(), + window.location.origin + apiClient.getServerBasePath(), '' ); - return { - ...jobParamsProvider(opts), - relativeUrls: [relativeUrl], // multi URL for PDF - }; -}; - -const getPngJobParams = (opts: JobParamsProviderOptions) => (): JobParamsPNG => { - // Replace hashes with original RISON values. - const relativeUrl = opts.shareableUrl.replace( - window.location.origin + opts.apiClient.getServerBasePath(), - '' - ); + if (type === 'pdf') { + // multi URL for PDF + return { ...baseParams, relativeUrls: [relativeUrl] }; + } - return { - ...jobParamsProvider(opts), - relativeUrl, // single URL for PNG - }; + // single URL for PNG + return { ...baseParams, relativeUrl }; }; export const reportingScreenshotShareProvider = ({ apiClient, toasts, + uiSettings, license$, startServices$, - uiSettings, usesUiCapabilities, -}: { - apiClient: ReportingAPIClient; - toasts: ToastsSetup; - license$: LicensingPluginSetup['license$']; - startServices$: Rx.Observable<[CoreStart, object, unknown]>; - uiSettings: IUiSettingsClient; - usesUiCapabilities: boolean; -}) => { +}: ExportPanelShareOpts) => { let licenseToolTipContent = ''; let licenseDisabled = true; let licenseHasScreenshotReporting = false; @@ -110,22 +80,13 @@ export const reportingScreenshotShareProvider = ({ capabilityHasVisualizeScreenshotReporting = true; } - // If the TZ is set to the default "Browser", it will not be useful for - // server-side export. We need to derive the timezone and pass it as a param - // to the export API. - // TODO: create a helper utility in Reporting. This is repeated in a few places. - const browserTimezone = - uiSettings.get('dateFormat:tz') === 'Browser' - ? moment.tz.guess() - : uiSettings.get('dateFormat:tz'); - const getShareMenuItems = ({ objectType, objectId, - sharingData, isDirty, onClose, shareableUrl, + ...shareOpts }: ShareContext) => { if (!licenseHasScreenshotReporting) { return []; @@ -143,6 +104,7 @@ export const reportingScreenshotShareProvider = ({ return []; } + const { sharingData } = (shareOpts as unknown) as { sharingData: ReportingSharingData }; const shareActions = []; const pngPanelTitle = i18n.translate('xpack.reporting.shareContextMenu.pngReportsButtonLabel', { @@ -165,16 +127,11 @@ export const reportingScreenshotShareProvider = ({ @@ -202,17 +159,12 @@ export const reportingScreenshotShareProvider = ({ diff --git a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.test.tsx b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.test.tsx index 6c5b8df104ecd..6ad894bf3ac2f 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.test.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.test.tsx @@ -7,26 +7,56 @@ import React from 'react'; import { mountWithIntl } from '@kbn/test/jest'; -import { notificationServiceMock } from 'src/core/public/mocks'; - -import { ReportingPanelContent, Props } from './reporting_panel_content'; +import { + httpServiceMock, + notificationServiceMock, + uiSettingsServiceMock, +} from 'src/core/public/mocks'; +import { ReportingAPIClient } from '../lib/reporting_api_client'; +import { ReportingPanelContent, ReportingPanelProps as Props } from './reporting_panel_content'; describe('ReportingPanelContent', () => { - const mountComponent = (props: Partial) => + const props: Partial = { + layoutId: 'super_cool_layout_id_X', + }; + const jobParams = { + appState: 'very_cool_app_state_X', + objectType: 'noice_object', + title: 'ultimate_title', + }; + const toasts = notificationServiceMock.createSetupContract().toasts; + const http = httpServiceMock.createSetupContract(); + const uiSettings = uiSettingsServiceMock.createSetupContract(); + let apiClient: ReportingAPIClient; + + beforeEach(() => { + props.layoutId = 'super_cool_layout_id_X'; + uiSettings.get.mockImplementation((key: string) => { + switch (key) { + case 'dateFormat:tz': + return 'Mars'; + } + }); + apiClient = new ReportingAPIClient(http, uiSettings, '7.15.0-test'); + }); + + const mountComponent = (newProps: Partial) => mountWithIntl( 'test' } as any} - toasts={notificationServiceMock.createSetupContract().toasts} + objectId="my-object-id" + layoutId={props.layoutId} + getJobParams={() => jobParams} + apiClient={apiClient} + toasts={toasts} + uiSettings={uiSettings} {...props} + {...newProps} /> ); + describe('saved state', () => { it('prevents generating reports when saving is required and we have unsaved changes', () => { const wrapper = mountComponent({ @@ -51,5 +81,20 @@ describe('ReportingPanelContent', () => { false ); }); + + it('changing the layout triggers refreshing the state with the latest job params', () => { + const wrapper = mountComponent({ requiresSavedState: false }); + wrapper.update(); + expect(wrapper.find('EuiCopy').prop('textToCopy')).toMatchInlineSnapshot( + `"http://localhost/api/reporting/generate/test?jobParams=%28appState%3Avery_cool_app_state_X%2CbrowserTimezone%3AMars%2CobjectType%3Anoice_object%2Ctitle%3Aultimate_title%2Cversion%3A%277.15.0-test%27%29"` + ); + + jobParams.appState = 'very_NOT_cool_app_state_Y'; + wrapper.setProps({ layoutId: 'super_cool_layout_id_Y' }); // update the component internal state + wrapper.update(); + expect(wrapper.find('EuiCopy').prop('textToCopy')).toMatchInlineSnapshot( + `"http://localhost/api/reporting/generate/test?jobParams=%28appState%3Avery_NOT_cool_app_state_Y%2CbrowserTimezone%3AMars%2CobjectType%3Anoice_object%2Ctitle%3Aultimate_title%2Cversion%3A%277.15.0-test%27%29"` + ); + }); }); }); diff --git a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.tsx b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.tsx index 4d7828b789407..af6cd0010de09 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/reporting_panel_content.tsx @@ -18,29 +18,30 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; import React, { Component, ReactElement } from 'react'; -import { ToastsSetup } from 'src/core/public'; +import { ToastsSetup, IUiSettingsClient } from 'src/core/public'; import url from 'url'; import { toMountPoint } from '../../../../../src/plugins/kibana_react/public'; import { CSV_REPORT_TYPE, PDF_REPORT_TYPE, PNG_REPORT_TYPE } from '../../common/constants'; import { BaseParams } from '../../common/types'; import { ReportingAPIClient } from '../lib/reporting_api_client'; -export interface Props { +export interface ReportingPanelProps { apiClient: ReportingAPIClient; toasts: ToastsSetup; + uiSettings: IUiSettingsClient; reportType: string; - /** Whether the report to be generated requires saved state that is not captured in the URL submitted to the report generator. **/ - requiresSavedState: boolean; - layoutId: string | undefined; + requiresSavedState: boolean; // Whether the report to be generated requires saved state that is not captured in the URL submitted to the report generator. + layoutId?: string; objectId?: string; - getJobParams: () => BaseParams; + getJobParams: () => Omit; options?: ReactElement | null; isDirty?: boolean; onClose?: () => void; - intl: InjectedIntl; } +export type Props = ReportingPanelProps & { intl: InjectedIntl }; + interface State { isStale: boolean; absoluteUrl: string; @@ -68,12 +69,12 @@ class ReportingPanelContentUi extends Component { private getAbsoluteReportGenerationUrl = (props: Props) => { const relativePath = this.props.apiClient.getReportingJobPath( props.reportType, - props.getJobParams() + this.props.apiClient.getDecoratedJobParams(this.props.getJobParams()) ); - return url.resolve(window.location.href, relativePath); + return url.resolve(window.location.href, relativePath); // FIXME: '(from: string, to: string): string' is deprecated }; - public componentDidUpdate(prevProps: Props, prevState: State) { + public componentDidUpdate(_prevProps: Props, prevState: State) { if (this.props.layoutId && this.props.layoutId !== prevState.layoutId) { this.setState({ ...prevState, @@ -231,9 +232,12 @@ class ReportingPanelContentUi extends Component { private createReportingJob = () => { const { intl } = this.props; + const decoratedJobParams = this.props.apiClient.getDecoratedJobParams( + this.props.getJobParams() + ); return this.props.apiClient - .createReportingJob(this.props.reportType, this.props.getJobParams()) + .createReportingJob(this.props.reportType, decoratedJobParams) .then(() => { this.props.toasts.addSuccess({ title: intl.formatMessage( diff --git a/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx b/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx index a023eae512d54..3fdb2c7e98f82 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.test.tsx @@ -8,25 +8,33 @@ import { mount } from 'enzyme'; import React from 'react'; import { __IntlProvider as IntlProvider } from '@kbn/i18n/react'; -import { coreMock } from '../../../../../src/core/public/mocks'; -import { BaseParams } from '../../common/types'; +import { coreMock } from 'src/core/public/mocks'; import { ReportingAPIClient } from '../lib/reporting_api_client'; import { ScreenCapturePanelContent } from './screen_capture_panel_content'; -const getJobParamsDefault: () => BaseParams = () => ({ +const { http, uiSettings, ...coreSetup } = coreMock.createSetup(); +uiSettings.get.mockImplementation((key: string) => { + switch (key) { + case 'dateFormat:tz': + return 'Mars'; + } +}); +const apiClient = new ReportingAPIClient(http, uiSettings, '7.15.0'); + +const getJobParamsDefault = () => ({ objectType: 'test-object-type', title: 'Test Report Title', browserTimezone: 'America/New_York', }); test('ScreenCapturePanelContent renders the default view properly', () => { - const coreSetup = coreMock.createSetup(); const component = mount( @@ -38,14 +46,14 @@ test('ScreenCapturePanelContent renders the default view properly', () => { }); test('ScreenCapturePanelContent properly renders a view with "canvas" layout option', () => { - const coreSetup = coreMock.createSetup(); const component = mount( @@ -56,14 +64,14 @@ test('ScreenCapturePanelContent properly renders a view with "canvas" layout opt }); test('ScreenCapturePanelContent properly renders a view with "print" layout option', () => { - const coreSetup = coreMock.createSetup(); const component = mount( @@ -72,3 +80,22 @@ test('ScreenCapturePanelContent properly renders a view with "print" layout opti expect(component.find('EuiForm')).toMatchSnapshot(); expect(component.text()).toMatch('Optimize for printing'); }); + +test('ScreenCapturePanelContent decorated job params are visible in the POST URL', () => { + const component = mount( + + + + ); + + expect(component.find('EuiCopy').prop('textToCopy')).toMatchInlineSnapshot( + `"http://localhost/api/reporting/generate/Analytical%20App?jobParams=%28browserTimezone%3AAmerica%2FNew_York%2Clayout%3A%28dimensions%3A%28height%3A768%2Cwidth%3A1024%29%2Cid%3Apreserve_layout%2Cselectors%3A%28itemsCountAttribute%3Adata-shared-items-count%2CrenderComplete%3A%5Bdata-shared-item%5D%2Cscreenshot%3A%5Bdata-shared-items-container%5D%2CtimefilterDurationAttribute%3Adata-shared-timefilter-duration%29%29%2CobjectType%3Atest-object-type%2Ctitle%3A%27Test%20Report%20Title%27%2Cversion%3A%277.15.0%27%29"` + ); +}); diff --git a/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.tsx b/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.tsx index fd6003f8656e8..73c4d10856a53 100644 --- a/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.tsx +++ b/x-pack/plugins/reporting/public/share_context_menu/screen_capture_panel_content.tsx @@ -7,24 +7,13 @@ import { EuiFormRow, EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import moment from 'moment'; import React, { Component } from 'react'; -import { ToastsSetup } from 'src/core/public'; import { getDefaultLayoutSelectors } from '../../common'; -import { BaseParams, LayoutParams } from '../../common/types'; -import { ReportingAPIClient } from '../lib/reporting_api_client'; -import { ReportingPanelContent } from './reporting_panel_content'; - -export interface Props { - apiClient: ReportingAPIClient; - toasts: ToastsSetup; - reportType: string; +import { LayoutParams } from '../../common/types'; +import { ReportingPanelContent, ReportingPanelProps } from './reporting_panel_content'; + +export interface Props extends ReportingPanelProps { layoutOption?: 'canvas' | 'print'; - objectId?: string; - getJobParams: () => BaseParams; - requiresSavedState: boolean; - isDirty?: boolean; - onClose?: () => void; } interface State { @@ -45,16 +34,10 @@ export class ScreenCapturePanelContent extends Component { public render() { return ( ); } @@ -147,17 +130,10 @@ export class ScreenCapturePanelContent extends Component { return { id: 'preserve_layout', dimensions, selectors }; }; - private getJobParams = (): Required => { - const outerParams = this.props.getJobParams(); - let browserTimezone = outerParams.browserTimezone; - if (!browserTimezone) { - browserTimezone = moment.tz.guess(); - } - + private getJobParams = () => { return { ...this.props.getJobParams(), layout: this.getLayout(), - browserTimezone, }; }; } diff --git a/x-pack/plugins/reporting/public/shared/get_shared_components.tsx b/x-pack/plugins/reporting/public/shared/get_shared_components.tsx index 87ddf0cfdb389..659eaf2678164 100644 --- a/x-pack/plugins/reporting/public/shared/get_shared_components.tsx +++ b/x-pack/plugins/reporting/public/shared/get_shared_components.tsx @@ -23,7 +23,7 @@ type PropsPDF = Pick & * This is not planned to expand, as work is to be done on moving the export-type implementations out of Reporting * Related Discuss issue: https://github.com/elastic/kibana/issues/101422 */ -export function getSharedComponents(core: CoreSetup) { +export function getSharedComponents(core: CoreSetup, apiClient: ReportingAPIClient) { return { ReportingPanelPDF(props: PropsPDF) { return ( @@ -31,8 +31,9 @@ export function getSharedComponents(core: CoreSetup) { layoutOption={props.layoutOption} requiresSavedState={false} reportType={PDF_REPORT_TYPE} - apiClient={new ReportingAPIClient(core.http)} + apiClient={apiClient} toasts={core.notifications.toasts} + uiSettings={core.uiSettings} {...props} /> ); diff --git a/x-pack/plugins/reporting/server/core.ts b/x-pack/plugins/reporting/server/core.ts index b7f3ebe9dcfa8..708b9b1bdbea5 100644 --- a/x-pack/plugins/reporting/server/core.ts +++ b/x-pack/plugins/reporting/server/core.ts @@ -58,6 +58,7 @@ export interface ReportingInternalStart { } export class ReportingCore { + private kibanaVersion: string; private pluginSetupDeps?: ReportingInternalSetup; private pluginStartDeps?: ReportingInternalStart; private readonly pluginSetup$ = new Rx.ReplaySubject(); // observe async background setupDeps and config each are done @@ -72,6 +73,7 @@ export class ReportingCore { public getContract: () => ReportingSetup; constructor(private logger: LevelLogger, context: PluginInitializerContext) { + this.kibanaVersion = context.env.packageInfo.version; const syncConfig = context.config.get(); this.deprecatedAllowedRoles = syncConfig.roles.enabled ? syncConfig.roles.allow : false; this.executeTask = new ExecuteReportTask(this, syncConfig, this.logger); @@ -84,6 +86,10 @@ export class ReportingCore { this.executing = new Set(); } + public getKibanaVersion() { + return this.kibanaVersion; + } + /* * Register setupDeps */ diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts index c9d57370ab766..b96828bb06334 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource/execute_job.test.ts @@ -59,6 +59,7 @@ test('gets the csv content from job parameters', async () => { searchSource: {}, objectType: 'search', title: 'Test Search', + version: '7.13.0', }, new CancellationToken() ); diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts index a38e0d58abf89..7eaf1ef95c149 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource/generate_csv/generate_csv.ts @@ -12,6 +12,7 @@ import { IScopedSearchClient } from 'src/plugins/data/server'; import { Datatable } from 'src/plugins/expressions/server'; import { ReportingConfig } from '../../..'; import { + cellHasFormulas, ES_SEARCH_STRATEGY, FieldFormat, FieldFormatConfig, @@ -22,7 +23,6 @@ import { SearchFieldValue, SearchSourceFields, tabifyDocs, - cellHasFormulas, } from '../../../../../../../src/plugins/data/common'; import { KbnServerError } from '../../../../../../../src/plugins/kibana_utils/server'; import { CancellationToken } from '../../../../common'; @@ -68,7 +68,7 @@ export class CsvGenerator { private csvRowCount = 0; constructor( - private job: JobParamsCSV, + private job: Omit, private config: ReportingConfig, private clients: Clients, private dependencies: Dependencies, @@ -219,7 +219,6 @@ export class CsvGenerator { */ private generateHeader( columns: string[], - table: Datatable, builder: MaxSizeStringBuilder, settings: CsvExportSettings ) { @@ -357,7 +356,7 @@ export class CsvGenerator { if (first) { first = false; - this.generateHeader(columns, table, builder, settings); + this.generateHeader(columns, builder, settings); } if (table.rows.length < 1) { diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.d.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.d.ts index d2a9e2b5bf783..170b03c2dfbff 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.d.ts +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource/types.d.ts @@ -11,7 +11,6 @@ import type { BaseParams, BasePayload } from '../../types'; export type RawValue = string | object | null | undefined; interface BaseParamsCSV { - browserTimezone: string; searchSource: SearchSourceFields; columns?: string[]; } diff --git a/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/execute_job.ts b/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/execute_job.ts index c8475e85bd847..e59c38e16ab47 100644 --- a/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/execute_job.ts +++ b/x-pack/plugins/reporting/server/export_types/csv_searchsource_immediate/execute_job.ts @@ -32,7 +32,7 @@ export const runTaskFnFactory: RunTaskFnFactory = function e const config = reporting.getConfig(); const logger = parentLogger.clone([CSV_SEARCHSOURCE_IMMEDIATE_TYPE, 'execute-job']); - return async function runTask(jobId, immediateJobParams, context, req) { + return async function runTask(_jobId, immediateJobParams, context, req) { const job = { objectType: 'immediate-search', ...immediateJobParams, diff --git a/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts b/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts index 488a339e3ef4b..cbfbc4a4d34b2 100644 --- a/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/png/create_job/index.ts @@ -16,24 +16,16 @@ export const createJobFnFactory: CreateJobFnFactory< const config = reporting.getConfig(); const crypto = cryptoFactory(config.get('encryptionKey')); - return async function createJob( - { objectType, title, relativeUrl, browserTimezone, layout }, - context, - req - ) { + return async function createJob(jobParams, _context, req) { const serializedEncryptedHeaders = await crypto.encrypt(req.headers); - validateUrls([relativeUrl]); + validateUrls([jobParams.relativeUrl]); return { headers: serializedEncryptedHeaders, spaceId: reporting.getSpaceId(req, logger), - objectType, - title, - relativeUrl, - browserTimezone, - layout, forceNow: new Date().toISOString(), + ...jobParams, }; }; }; diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts index c0f30f96415f4..9dac1560ddbdc 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/create_job/index.ts @@ -16,24 +16,16 @@ export const createJobFnFactory: CreateJobFnFactory< const config = reporting.getConfig(); const crypto = cryptoFactory(config.get('encryptionKey')); - return async function createJob( - { title, relativeUrls, browserTimezone, layout, objectType }, - context, - req - ) { + return async function createJob(jobParams, _context, req) { const serializedEncryptedHeaders = await crypto.encrypt(req.headers); - validateUrls(relativeUrls); + validateUrls(jobParams.relativeUrls); return { headers: serializedEncryptedHeaders, spaceId: reporting.getSpaceId(req, logger), - browserTimezone, forceNow: new Date().toISOString(), - layout, - relativeUrls, - title, - objectType, + ...jobParams, }; }; }; diff --git a/x-pack/plugins/reporting/server/lib/check_params_version.ts b/x-pack/plugins/reporting/server/lib/check_params_version.ts new file mode 100644 index 0000000000000..7298384b87571 --- /dev/null +++ b/x-pack/plugins/reporting/server/lib/check_params_version.ts @@ -0,0 +1,20 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { UNVERSIONED_VERSION } from '../../common/constants'; +import type { BaseParams } from '../../common/types'; +import type { LevelLogger } from './'; + +export function checkParamsVersion(jobParams: BaseParams, logger: LevelLogger) { + if (jobParams.version) { + logger.debug(`Using reporting job params v${jobParams.version}`); + return jobParams.version; + } + + logger.warning(`No version provided in report job params. Assuming ${UNVERSIONED_VERSION}`); + return UNVERSIONED_VERSION; +} diff --git a/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts b/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts index d9d1815835baa..abfa2b88258fc 100644 --- a/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts +++ b/x-pack/plugins/reporting/server/lib/enqueue_job.test.ts @@ -14,17 +14,28 @@ import { createMockLevelLogger, createMockReportingCore, } from '../test_helpers'; -import { BasePayload, ReportingRequestHandlerContext } from '../types'; +import { ReportingRequestHandlerContext } from '../types'; import { ExportTypesRegistry, ReportingStore } from './'; import { enqueueJobFactory } from './enqueue_job'; import { Report } from './store'; -import { TaskRunResult } from './tasks'; describe('Enqueue Job', () => { const logger = createMockLevelLogger(); let mockReporting: ReportingCore; let mockExportTypesRegistry: ExportTypesRegistry; + const mockBaseParams = { + browserTimezone: 'UTC', + headers: 'cool_encrypted_headers', + objectType: 'cool_object_type', + title: 'cool_title', + version: 'unknown' as any, + }; + + beforeEach(() => { + mockBaseParams.version = '7.15.0-test'; + }); + beforeAll(async () => { mockExportTypesRegistry = new ExportTypesRegistry(); mockExportTypesRegistry.register({ @@ -34,10 +45,8 @@ describe('Enqueue Job', () => { jobContentEncoding: 'base64', jobContentExtension: 'pdf', validLicenses: ['turquoise'], - createJobFnFactory: () => async () => - (({ createJobTest: { test1: 'yes' } } as unknown) as BasePayload), - runTaskFnFactory: () => async () => - (({ runParamsTest: { test2: 'yes' } } as unknown) as TaskRunResult), + createJobFnFactory: () => async () => mockBaseParams, + runTaskFnFactory: jest.fn(), }); mockReporting = await createMockReportingCore(createMockConfigSchema()); mockReporting.getExportTypesRegistry = () => mockExportTypesRegistry; @@ -66,26 +75,59 @@ describe('Enqueue Job', () => { const enqueueJob = enqueueJobFactory(mockReporting, logger); const report = await enqueueJob( 'printablePdf', - { - objectType: 'visualization', - title: 'cool-viz', - }, + mockBaseParams, false, ({} as unknown) as ReportingRequestHandlerContext, ({} as unknown) as KibanaRequest ); - expect(report).toMatchObject({ - _id: expect.any(String), - _index: '.reporting-foo-index-234', - attempts: 0, - created_by: false, - created_at: expect.any(String), - jobtype: 'printable_pdf', - meta: { objectType: 'visualization' }, - output: null, - payload: { createJobTest: { test1: 'yes' } }, - status: 'pending', - }); + const { _id, created_at: _created_at, ...snapObj } = report; + expect(snapObj).toMatchInlineSnapshot(` + Object { + "_index": ".reporting-foo-index-234", + "_primary_term": undefined, + "_seq_no": undefined, + "attempts": 0, + "browser_type": undefined, + "completed_at": undefined, + "created_by": false, + "jobtype": "printable_pdf", + "kibana_id": undefined, + "kibana_name": undefined, + "max_attempts": undefined, + "meta": Object { + "layout": undefined, + "objectType": "cool_object_type", + }, + "migration_version": "7.14.0", + "output": null, + "payload": Object { + "browserTimezone": "UTC", + "headers": "cool_encrypted_headers", + "objectType": "cool_object_type", + "title": "cool_title", + "version": "7.15.0-test", + }, + "process_expiration": undefined, + "started_at": undefined, + "status": "pending", + "timeout": undefined, + } + `); + }); + + it('provides a default kibana version field for older POST URLs', async () => { + const enqueueJob = enqueueJobFactory(mockReporting, logger); + mockBaseParams.version = undefined; + const report = await enqueueJob( + 'printablePdf', + mockBaseParams, + false, + ({} as unknown) as ReportingRequestHandlerContext, + ({} as unknown) as KibanaRequest + ); + + const { _id, created_at: _created_at, ...snapObj } = report; + expect(snapObj.payload.version).toBe('7.14.0'); }); }); diff --git a/x-pack/plugins/reporting/server/lib/enqueue_job.ts b/x-pack/plugins/reporting/server/lib/enqueue_job.ts index ec2e443d86c80..1c73b0d925ad0 100644 --- a/x-pack/plugins/reporting/server/lib/enqueue_job.ts +++ b/x-pack/plugins/reporting/server/lib/enqueue_job.ts @@ -7,10 +7,10 @@ import { KibanaRequest } from 'src/core/server'; import { ReportingCore } from '../'; +import type { ReportingRequestHandlerContext } from '../types'; import { BaseParams, ReportingUser } from '../types'; -import { LevelLogger } from './'; +import { checkParamsVersion, LevelLogger } from './'; import { Report } from './store'; -import type { ReportingRequestHandlerContext } from '../types'; export type EnqueueJobFn = ( exportTypeId: string, @@ -47,6 +47,7 @@ export function enqueueJobFactory( reporting.getStore(), ]); + jobParams.version = checkParamsVersion(jobParams, logger); const job = await createJob!(jobParams, context, request); // 1. Add the report to ReportingStore to show as pending diff --git a/x-pack/plugins/reporting/server/lib/index.ts b/x-pack/plugins/reporting/server/lib/index.ts index b2a2a1edcd6a5..37f57d97d3d4c 100644 --- a/x-pack/plugins/reporting/server/lib/index.ts +++ b/x-pack/plugins/reporting/server/lib/index.ts @@ -6,6 +6,7 @@ */ export { checkLicense } from './check_license'; +export { checkParamsVersion } from './check_params_version'; export { cryptoFactory } from './crypto'; export { ExportTypesRegistry, getExportTypesRegistry } from './export_types_registry'; export { LevelLogger } from './level_logger'; diff --git a/x-pack/plugins/reporting/server/lib/store/report.test.ts b/x-pack/plugins/reporting/server/lib/store/report.test.ts index 4bc45fd745a56..f9cd413b3e5a7 100644 --- a/x-pack/plugins/reporting/server/lib/store/report.test.ts +++ b/x-pack/plugins/reporting/server/lib/store/report.test.ts @@ -15,7 +15,13 @@ describe('Class Report', () => { created_by: 'created_by_test_string', browser_type: 'browser_type_test_string', max_attempts: 50, - payload: { headers: 'payload_test_field', objectType: 'testOt', title: 'cool report' }, + payload: { + headers: 'payload_test_field', + objectType: 'testOt', + title: 'cool report', + version: '7.14.0', + browserTimezone: 'UTC', + }, meta: { objectType: 'test' }, timeout: 30000, }); @@ -64,7 +70,13 @@ describe('Class Report', () => { created_by: 'created_by_test_string', browser_type: 'browser_type_test_string', max_attempts: 50, - payload: { headers: 'payload_test_field', objectType: 'testOt', title: 'hot report' }, + payload: { + headers: 'payload_test_field', + objectType: 'testOt', + title: 'hot report', + version: '7.14.0', + browserTimezone: 'UTC', + }, meta: { objectType: 'stange' }, timeout: 30000, }); diff --git a/x-pack/plugins/reporting/server/lib/store/store.test.ts b/x-pack/plugins/reporting/server/lib/store/store.test.ts index f46e55c9cc41b..9bb9c8a113d3e 100644 --- a/x-pack/plugins/reporting/server/lib/store/store.test.ts +++ b/x-pack/plugins/reporting/server/lib/store/store.test.ts @@ -255,6 +255,7 @@ describe('ReportingStore', () => { headers: 'rp_test_headers', objectType: 'testOt', browserTimezone: 'ABC', + version: '7.14.0', }, timeout: 30000, }); @@ -285,6 +286,7 @@ describe('ReportingStore', () => { headers: 'rp_test_headers', objectType: 'testOt', browserTimezone: 'BCD', + version: '7.14.0', }, timeout: 30000, }); @@ -315,6 +317,7 @@ describe('ReportingStore', () => { headers: 'rp_test_headers', objectType: 'testOt', browserTimezone: 'CDE', + version: '7.14.0', }, timeout: 30000, }); @@ -345,6 +348,7 @@ describe('ReportingStore', () => { headers: 'rp_test_headers', objectType: 'testOt', browserTimezone: 'utc', + version: '7.14.0', }, timeout: 30000, }); @@ -390,6 +394,7 @@ describe('ReportingStore', () => { headers: 'rp_test_headers', objectType: 'testOt', browserTimezone: 'utc', + version: '7.14.0', }, timeout: 30000, }); diff --git a/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts b/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts index 2da509f024c25..8d31c03c618c9 100644 --- a/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts +++ b/x-pack/plugins/reporting/server/routes/csv_searchsource_immediate.ts @@ -55,13 +55,14 @@ export function registerGenerateCsvFromSavedObjectImmediate( searchSource: schema.object({}, { unknowns: 'allow' }), browserTimezone: schema.string({ defaultValue: 'UTC' }), title: schema.string(), + version: schema.maybe(schema.string()), }), }, options: { tags: kibanaAccessControlTags, }, }, - userHandler(async (user, context, req: CsvFromSavedObjectRequest, res) => { + userHandler(async (_user, context, req: CsvFromSavedObjectRequest, res) => { const logger = parentLogger.clone(['csv_searchsource_immediate']); const runTaskFn = runTaskFnFactory(reporting, logger); diff --git a/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts b/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts index 55d12e5c6d442..69b3f216886e6 100644 --- a/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts +++ b/x-pack/plugins/reporting/server/routes/generate_from_jobparams.ts @@ -95,7 +95,7 @@ export function registerGenerateFromJobParams( path: `${BASE_GENERATE}/{p*}`, validate: false, }, - (context, req, res) => { + (_context, _req, res) => { return res.customError({ statusCode: 405, body: 'GET is not allowed' }); } ); diff --git a/x-pack/plugins/reporting/server/routes/generation.test.ts b/x-pack/plugins/reporting/server/routes/generation.test.ts index c6889f3612b59..df5a85d71f49f 100644 --- a/x-pack/plugins/reporting/server/routes/generation.test.ts +++ b/x-pack/plugins/reporting/server/routes/generation.test.ts @@ -5,6 +5,7 @@ * 2.0. */ +import rison from 'rison-node'; import { UnwrapPromise } from '@kbn/utility-types'; import type { DeeplyMockedKeys } from '@kbn/utility-types/jest'; import { of } from 'rxjs'; @@ -129,7 +130,7 @@ describe('POST /api/reporting/generate', () => { await supertest(httpSetup.server.listener) .post('/api/reporting/generate/TonyHawksProSkater2') - .send({ jobParams: `abc` }) + .send({ jobParams: rison.encode({ title: `abc` }) }) .expect(400) .then(({ body }) => expect(body.message).toMatchInlineSnapshot('"Invalid export-type of TonyHawksProSkater2"') @@ -145,7 +146,7 @@ describe('POST /api/reporting/generate', () => { await supertest(httpSetup.server.listener) .post('/api/reporting/generate/printablePdf') - .send({ jobParams: `abc` }) + .send({ jobParams: rison.encode({ title: `abc` }) }) .expect(500); }); @@ -157,7 +158,7 @@ describe('POST /api/reporting/generate', () => { await supertest(httpSetup.server.listener) .post('/api/reporting/generate/printablePdf') - .send({ jobParams: `abc` }) + .send({ jobParams: rison.encode({ title: `abc` }) }) .expect(200) .then(({ body }) => { expect(body).toMatchObject({ diff --git a/x-pack/plugins/rollup/server/rollup_data_enricher.ts b/x-pack/plugins/rollup/server/rollup_data_enricher.ts index 8f115687d5433..2c334780720fa 100644 --- a/x-pack/plugins/rollup/server/rollup_data_enricher.ts +++ b/x-pack/plugins/rollup/server/rollup_data_enricher.ts @@ -5,20 +5,19 @@ * 2.0. */ +import { IScopedClusterClient } from 'kibana/server'; import { Index } from '../../../plugins/index_management/server'; -export const rollupDataEnricher = async (indicesList: Index[], callWithRequest: any) => { +export const rollupDataEnricher = async (indicesList: Index[], client: IScopedClusterClient) => { if (!indicesList || !indicesList.length) { return Promise.resolve(indicesList); } - const params = { - path: '/_all/_rollup/data', - method: 'GET', - }; - try { - const rollupJobData = await callWithRequest('transport.request', params); + const { body: rollupJobData } = await client.asCurrentUser.rollup.getRollupIndexCaps({ + index: '_all', + }); + return indicesList.map((index) => { const isRollupIndex = !!rollupJobData[index.name]; return { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/header_actions.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/header_actions.tsx index fb48319057788..de190c7df5e3f 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/header_actions.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/header_actions.tsx @@ -51,6 +51,24 @@ const SortingColumnsContainer = styled.div` } `; +const FieldBrowserContainer = styled.div` + .euiToolTipAnchor { + .euiButtonContent { + padding: ${({ theme }) => `0 ${theme.eui.paddingSizes.xs}`}; + } + button { + color: ${({ theme }) => theme.eui.euiColorPrimary}; + } + .euiButtonContent__icon { + width: 16px; + height: 16px; + } + .euiButtonEmpty__text { + display: none; + } + } +`; + const ActionsContainer = styled.div` align-items: center; display: flex; @@ -160,11 +178,13 @@ const HeaderActionsComponent: React.FC = ({ )} - {timelinesUi.getFieldBrowser({ - browserFields, - columnHeaders, - timelineId, - })} + + {timelinesUi.getFieldBrowser({ + browserFields, + columnHeaders, + timelineId, + })} + diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx index c5d39dd80c7ca..66deeddaf03f2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx @@ -93,4 +93,36 @@ describe('Actions', () => { expect(wrapper.find('[data-test-subj="select-event"]').exists()).toBe(false); }); + + test('it does NOT render a checkbox for selecting the event when `tGridEnabled` is `true`', () => { + useIsExperimentalFeatureEnabledMock.mockReturnValue(true); + + const wrapper = mount( + + + + ); + + expect(wrapper.find('[data-test-subj="select-event"]').exists()).toBe(false); + }); }); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx index 93039e6fd44e5..ab34ea37efeac 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.tsx @@ -11,6 +11,7 @@ import { EuiButtonIcon, EuiCheckbox, EuiLoadingSpinner, EuiToolTip } from '@elas import { noop } from 'lodash/fp'; import styled from 'styled-components'; +import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features'; import { eventHasNotes, getEventType, @@ -52,13 +53,14 @@ const ActionsComponent: React.FC = ({ onEventDetailsPanelOpened, onRowSelected, refetch, - onRuleChange, showCheckboxes, + onRuleChange, showNotes, timelineId, toggleShowNotes, }) => { const dispatch = useDispatch(); + const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled'); const emptyNotes: string[] = []; const getTimeline = useMemo(() => timelineSelectors.getTimelineByIdSelector(), []); const { timelines: timelinesUi } = useKibana().services; @@ -81,6 +83,7 @@ const ActionsComponent: React.FC = ({ }), [eventId, onRowSelected] ); + const handlePinClicked = useCallback( () => getPinOnClick({ @@ -113,7 +116,7 @@ const ActionsComponent: React.FC = ({ }, [ariaRowindex, ecsData, casePermissions, insertTimelineHook, columnValues]); return ( - {showCheckboxes && ( + {showCheckboxes && !tGridEnabled && (
{loadingEventIds.includes(eventId) ? ( diff --git a/x-pack/plugins/timelines/public/components/fields_browser/index.tsx b/x-pack/plugins/timelines/public/components/fields_browser/index.tsx index ac121f9afdd58..3b67d530bc63f 100644 --- a/x-pack/plugins/timelines/public/components/fields_browser/index.tsx +++ b/x-pack/plugins/timelines/public/components/fields_browser/index.tsx @@ -11,25 +11,17 @@ import { Provider } from 'react-redux'; import { I18nProvider } from '@kbn/i18n/react'; import type { FieldBrowserProps } from '../t_grid/toolbar/fields_browser/types'; import { StatefulFieldsBrowser } from '../t_grid/toolbar/fields_browser'; -import { - FIELD_BROWSER_WIDTH, - FIELD_BROWSER_HEIGHT, -} from '../t_grid/toolbar/fields_browser/helpers'; +export type { FieldBrowserProps } from '../t_grid/toolbar/fields_browser/types'; const EMPTY_BROWSER_FIELDS = {}; -export type FieldBrowserWrappedProps = Omit & { - width?: FieldBrowserProps['width']; - height?: FieldBrowserProps['height']; -}; -export type FieldBrowserWrappedComponentProps = FieldBrowserWrappedProps & { + +export type FieldBrowserWrappedComponentProps = FieldBrowserProps & { store: Store; }; export const FieldBrowserWrappedComponent = (props: FieldBrowserWrappedComponentProps) => { const { store, ...restProps } = props; const fieldsBrowseProps = { - width: FIELD_BROWSER_WIDTH, - height: FIELD_BROWSER_HEIGHT, ...restProps, browserFields: restProps.browserFields ?? EMPTY_BROWSER_FIELDS, }; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx new file mode 100644 index 0000000000000..e263be11c0dcc --- /dev/null +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx @@ -0,0 +1,76 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { render, fireEvent } from '@testing-library/react'; +import { ActionProps, HeaderActionProps, TimelineTabs } from '../../../../../common'; +import { HeaderCheckBox, RowCheckBox } from './checkbox'; +import React from 'react'; + +describe('checkbox control column', () => { + describe('RowCheckBox', () => { + const defaultProps: ActionProps = { + ariaRowindex: 1, + columnId: 'test-columnId', + columnValues: 'test-columnValues', + checked: false, + onRowSelected: jest.fn(), + eventId: 'test-event-id', + loadingEventIds: [], + onEventDetailsPanelOpened: jest.fn(), + showCheckboxes: true, + data: [], + ecsData: { + _id: 'test-ecsData-id', + }, + index: 1, + rowIndex: 1, + showNotes: true, + timelineId: 'test-timelineId', + }; + test('displays loader when id is included on loadingEventIds', () => { + const { getByTestId } = render( + + ); + expect(getByTestId('event-loader')).not.toBeNull(); + }); + + test('calls onRowSelected when checked', () => { + const onRowSelected = jest.fn(); + const { getByTestId } = render( + + ); + + fireEvent.click(getByTestId('select-event')); + + expect(onRowSelected).toHaveBeenCalled(); + }); + }); + describe('HeaderCheckBox', () => { + const defaultProps: HeaderActionProps = { + width: 99999, + browserFields: {}, + columnHeaders: [], + isSelectAllChecked: true, + onSelectAll: jest.fn(), + showEventsSelect: true, + showSelectAllCheckbox: true, + sort: [], + tabType: TimelineTabs.query, + timelineId: 'test-timelineId', + }; + + test('calls onSelectAll when checked', () => { + const onSelectAll = jest.fn(); + const { getByTestId } = render( + + ); + fireEvent.click(getByTestId('select-all-events')); + + expect(onSelectAll).toHaveBeenCalled(); + }); + }); +}); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx new file mode 100644 index 0000000000000..cc8ec06d18dbd --- /dev/null +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx @@ -0,0 +1,59 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiCheckbox, EuiLoadingSpinner } from '@elastic/eui'; +import React, { useCallback } from 'react'; +import { ActionProps, HeaderActionProps } from '../../../../../common'; +import * as i18n from './translations'; + +export const RowCheckBox = ({ + eventId, + onRowSelected, + checked, + ariaRowindex, + columnValues, + loadingEventIds, +}: ActionProps) => { + const handleSelectEvent = useCallback( + (event: React.ChangeEvent) => + onRowSelected({ + eventIds: [eventId], + isSelected: event.currentTarget.checked, + }), + [eventId, onRowSelected] + ); + + return loadingEventIds.includes(eventId) ? ( + + ) : ( + + ); +}; + +export const HeaderCheckBox = ({ onSelectAll, isSelectAllChecked }: HeaderActionProps) => { + const handleSelectPageChange = useCallback( + (event: React.ChangeEvent) => { + onSelectAll({ isSelected: event.currentTarget.checked }); + }, + [onSelectAll] + ); + + return ( + + ); +}; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/index.tsx new file mode 100644 index 0000000000000..dbf7fc9b99cff --- /dev/null +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/index.tsx @@ -0,0 +1,16 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { ControlColumnProps } from '../../../../../common'; +import { HeaderCheckBox, RowCheckBox } from './checkbox'; + +export const checkBoxControlColumn: ControlColumnProps = { + id: 'checkbox-control-column', + width: 32, + headerCellRender: HeaderCheckBox, + rowCellRender: RowCheckBox, +}; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/translations.ts b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/translations.ts new file mode 100644 index 0000000000000..9cc4bfd58357c --- /dev/null +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/translations.ts @@ -0,0 +1,22 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { i18n } from '@kbn/i18n'; + +export const CHECKBOX_FOR_ROW = ({ + ariaRowindex, + columnValues, + checked, +}: { + ariaRowindex: number; + columnValues: string; + checked: boolean; +}) => + i18n.translate('xpack.timelines.timeline.body.actions.checkboxForRowAriaLabel', { + values: { ariaRowindex, checked, columnValues }, + defaultMessage: + '{checked, select, false {unchecked} true {checked}} checkbox for the alert or event in row {ariaRowindex}, with columns {columnValues}', + }); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx index 6be6db292fc96..1efee943c6456 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx @@ -17,7 +17,8 @@ import memoizeOne from 'memoize-one'; import React, { ComponentType, useCallback, useEffect, useMemo, useState } from 'react'; import { connect, ConnectedProps } from 'react-redux'; -import { TimelineId, TimelineTabs } from '../../../../common/types/timeline'; +import { SortColumnTimeline, TimelineId, TimelineTabs } from '../../../../common/types/timeline'; + import type { CellValueElementProps, ColumnHeaderOptions, @@ -37,8 +38,8 @@ import { StatefulFieldsBrowser, tGridActions } from '../../../'; import { TGridModel, tGridSelectors, TimelineState } from '../../../store/t_grid'; import { useDeepEqualSelector } from '../../../hooks/use_selector'; import { RowAction } from './row_action'; -import { FIELD_BROWSER_HEIGHT, FIELD_BROWSER_WIDTH } from '../toolbar/fields_browser/helpers'; import * as i18n from './translations'; +import { checkBoxControlColumn } from './control_columns'; interface OwnProps { activePage: number; @@ -87,6 +88,10 @@ const transformControlColumns = ({ showCheckboxes, tabType, timelineId, + isSelectAllChecked, + onSelectPage, + browserFields, + sort, }: { actionColumnsWidth: number; columnHeaders: ColumnHeaderOptions[]; @@ -100,11 +105,38 @@ const transformControlColumns = ({ showCheckboxes: boolean; tabType: TimelineTabs; timelineId: string; + isSelectAllChecked: boolean; + browserFields: BrowserFields; + onSelectPage: OnSelectAll; + sort: SortColumnTimeline[]; }): EuiDataGridControlColumn[] => controlColumns.map( ({ id: columnId, headerCellRender = EmptyHeaderCellRender, rowCellRender, width }, i) => ({ id: `${columnId}`, - headerCellRender: headerCellRender as ComponentType, + // eslint-disable-next-line react/display-name + headerCellRender: () => { + const HeaderActions = headerCellRender; + return ( + <> + {HeaderActions && ( + + )} + + ); + }, + // eslint-disable-next-line react/display-name rowCellRender: ({ isDetails, @@ -135,7 +167,7 @@ const transformControlColumns = ({ width={width ?? MIN_ACTION_COLUMN_WIDTH} /> ), - width: actionColumnsWidth, + width: width ?? actionColumnsWidth, }) ); @@ -189,7 +221,7 @@ export const BodyComponent = React.memo( [setSelected, id, data, selectedEventIds, queryFields] ); - const onSelectAll: OnSelectAll = useCallback( + const onSelectPage: OnSelectAll = useCallback( ({ isSelected }: { isSelected: boolean }) => isSelected ? setSelected!({ @@ -209,9 +241,9 @@ export const BodyComponent = React.memo( // Sync to selectAll so parent components can select all events useEffect(() => { if (selectAll && !isSelectAllChecked) { - onSelectAll({ isSelected: true }); + onSelectPage({ isSelected: true }); } - }, [isSelectAllChecked, onSelectAll, selectAll]); + }, [isSelectAllChecked, onSelectPage, selectAll]); const toolbarVisibility: EuiDataGridToolBarVisibilityOptions = useMemo( () => ({ @@ -221,8 +253,6 @@ export const BodyComponent = React.memo( { ( setVisibleColumns(columnHeaders.map(({ id: cid }) => cid)); }, [columnHeaders]); - const [leadingTGridControlColumns, trailingTGridControlColumns] = useMemo( - () => - [leadingControlColumns, trailingControlColumns].map((controlColumns) => - transformControlColumns({ - columnHeaders, - controlColumns, - data, - isEventViewer, - actionColumnsWidth: hasAdditionalActions(id as TimelineId) - ? getActionsColumnWidth( - isEventViewer, - showCheckboxes, - DEFAULT_ICON_BUTTON_WIDTH * NUM_OF_ICON_IN_TIMELINE_ROW + EXTRA_WIDTH - ) - : controlColumns.reduce((acc, c) => acc + (c.width ?? MIN_ACTION_COLUMN_WIDTH), 0), - loadingEventIds, - onRowSelected, - onRuleChange, - selectedEventIds, - showCheckboxes, - tabType, - timelineId: id, - }) - ), - [ - columnHeaders, - data, - id, - isEventViewer, - leadingControlColumns, - loadingEventIds, - onRowSelected, - onRuleChange, - selectedEventIds, - showCheckboxes, - tabType, + const [leadingTGridControlColumns, trailingTGridControlColumns] = useMemo(() => { + return [ + showCheckboxes ? [checkBoxControlColumn, ...leadingControlColumns] : leadingControlColumns, trailingControlColumns, - ] - ); + ].map((controlColumns) => + transformControlColumns({ + columnHeaders, + controlColumns, + data, + isEventViewer, + actionColumnsWidth: hasAdditionalActions(id as TimelineId) + ? getActionsColumnWidth( + isEventViewer, + showCheckboxes, + DEFAULT_ICON_BUTTON_WIDTH * NUM_OF_ICON_IN_TIMELINE_ROW + EXTRA_WIDTH + ) + : controlColumns.reduce((acc, c) => acc + (c.width ?? MIN_ACTION_COLUMN_WIDTH), 0), + loadingEventIds, + onRowSelected, + onRuleChange, + selectedEventIds, + showCheckboxes, + tabType, + timelineId: id, + isSelectAllChecked, + sort, + browserFields, + onSelectPage, + }) + ); + }, [ + columnHeaders, + data, + id, + isEventViewer, + leadingControlColumns, + loadingEventIds, + onRowSelected, + onRuleChange, + selectedEventIds, + showCheckboxes, + tabType, + trailingControlColumns, + isSelectAllChecked, + browserFields, + onSelectPage, + sort, + ]); const renderTGridCellValue: (x: EuiDataGridCellValueElementProps) => React.ReactNode = ({ columnId, diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts b/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts index c45a00a0516f4..e2d13fe49f2b6 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/body/translations.ts @@ -120,21 +120,6 @@ export const ACTION_INVESTIGATE_IN_RESOLVER = i18n.translate( } ); -export const CHECKBOX_FOR_ROW = ({ - ariaRowindex, - columnValues, - checked, -}: { - ariaRowindex: number; - columnValues: string; - checked: boolean; -}) => - i18n.translate('xpack.timelines.timeline.body.actions.checkboxForRowAriaLabel', { - values: { ariaRowindex, checked, columnValues }, - defaultMessage: - '{checked, select, false {unchecked} true {checked}} checkbox for the alert or event in row {ariaRowindex}, with columns {columnValues}', - }); - export const ACTION_INVESTIGATE_IN_RESOLVER_FOR_ROW = ({ ariaRowindex, columnValues, diff --git a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx index cabedd84d270d..94ae06dc9a558 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/standalone/index.tsx @@ -279,7 +279,7 @@ const TGridStandaloneComponent: React.FC = ({ sort, itemsPerPage, itemsPerPageOptions, - showCheckboxes: false, + showCheckboxes: true, }) ); dispatch( diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx index e308996d0d45b..bac0a2eceda0c 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx @@ -21,10 +21,10 @@ import { CATEGORIES_PANE_CLASS_NAME, TABLE_HEIGHT } from './helpers'; import * as i18n from './translations'; const CategoryNames = styled.div<{ height: number; width: number }>` + ${({ width }) => `width: ${width}px`}; ${({ height }) => `height: ${height}px`}; - overflow: auto; + overflow-y: hidden; padding: 5px; - ${({ width }) => `width: ${width}px`}; thead { display: none; } @@ -88,12 +88,13 @@ export const CategoriesPane = React.memo( ` ${({ height }) => `height: ${height}px`}; - overflow-x: hidden; - overflow-y: auto; ${({ width }) => `width: ${width}px`}; + overflow: hidden; `; TableContainer.displayName = 'TableContainer'; @@ -97,7 +96,7 @@ export const Category = React.memo( width={width} > { + const original = jest.requireActual('react-redux'); + return { + ...original, + useDispatch: () => mockDispatch, + }; +}); describe('FieldsBrowser', () => { const timelineId = 'test'; - // `enzyme` doesn't mount the components into the global jsdom `document` - // but that's where the click detector listener is, so for testing, we - // pass the top-level mounted component's click event on to document - const triggerDocumentMouseDown = () => { - const event = new Event('mousedown'); - document.dispatchEvent(event); - }; + test('it renders the Close button', () => { + const wrapper = mount( + + ()} + selectedCategoryId={''} + timelineId={timelineId} + /> + + ); - const triggerDocumentMouseUp = () => { - const event = new Event('mouseup'); - document.dispatchEvent(event); - }; + expect(wrapper.find('[data-test-subj="close"]').first().text()).toEqual('Close'); + }); - test('it invokes onOutsideClick when onFieldSelected is undefined, and the user clicks outside the fields browser', () => { - const onOutsideClick = jest.fn(); + test('it invokes the Close button', () => { + const onHide = jest.fn(); + const wrapper = mount( + + ()} + selectedCategoryId={''} + timelineId={timelineId} + /> + + ); + + wrapper.find('[data-test-subj="close"]').first().simulate('click'); + expect(onHide).toBeCalled(); + }); + test('it renders the Reset Fields button', () => { const wrapper = mount( -
- ()} - selectedCategoryId={''} - timelineId={timelineId} - width={FIELD_BROWSER_WIDTH} - /> -
+ ()} + selectedCategoryId={''} + timelineId={timelineId} + />
); - wrapper.find('[data-test-subj="outside"]').simulate('mousedown'); - wrapper.find('[data-test-subj="outside"]').simulate('mouseup'); + expect(wrapper.find('[data-test-subj="reset-fields"]').first().text()).toEqual('Reset Fields'); + }); - expect(onOutsideClick).toHaveBeenCalled(); + test('it invokes updateColumns action when the user clicks the Reset Fields button', () => { + const wrapper = mount( + + ()} + selectedCategoryId={''} + timelineId={timelineId} + /> + + ); + + wrapper.find('[data-test-subj="reset-fields"]').first().simulate('click'); + + expect(mockDispatch).toBeCalledWith( + tGridActions.updateColumns({ + id: timelineId, + columns: defaultHeaders, + }) + ); }); - test('it does NOT invoke onOutsideClick when onFieldSelected is defined, and the user clicks outside the fields browser', () => { - const onOutsideClick = jest.fn(); + test('it invokes onHide when the user clicks the Reset Fields button', () => { + const onHide = jest.fn(); const wrapper = mount( -
- ()} - selectedCategoryId={''} - timelineId={timelineId} - width={FIELD_BROWSER_WIDTH} - /> -
+ ()} + selectedCategoryId={''} + timelineId={timelineId} + />
); - wrapper.find('[data-test-subj="outside"]').simulate('mousedown'); - wrapper.find('[data-test-subj="outside"]').simulate('mouseup'); + wrapper.find('[data-test-subj="reset-fields"]').first().simulate('click'); - expect(onOutsideClick).not.toHaveBeenCalled(); + expect(onHide).toBeCalled(); }); - test('it renders the header', () => { + test('it renders the search', () => { const wrapper = mount( { browserFields={mockBrowserFields} filteredBrowserFields={mockBrowserFields} searchInput={''} - height={FIELD_BROWSER_HEIGHT} isSearching={false} onCategorySelected={jest.fn()} - onHideFieldBrowser={jest.fn()} - onOutsideClick={jest.fn()} + onHide={jest.fn()} onSearchInputChange={jest.fn()} restoreFocusTo={React.createRef()} selectedCategoryId={''} timelineId={timelineId} - width={FIELD_BROWSER_WIDTH} /> ); - expect(wrapper.find('[data-test-subj="header"]').exists()).toBe(true); + expect(wrapper.find('[data-test-subj="field-search"]').exists()).toBe(true); }); test('it renders the categories pane', () => { @@ -135,16 +178,13 @@ describe('FieldsBrowser', () => { browserFields={mockBrowserFields} filteredBrowserFields={mockBrowserFields} searchInput={''} - height={FIELD_BROWSER_HEIGHT} isSearching={false} onCategorySelected={jest.fn()} - onHideFieldBrowser={jest.fn()} - onOutsideClick={jest.fn()} + onHide={jest.fn()} onSearchInputChange={jest.fn()} restoreFocusTo={React.createRef()} selectedCategoryId={''} timelineId={timelineId} - width={FIELD_BROWSER_WIDTH} /> ); @@ -160,16 +200,13 @@ describe('FieldsBrowser', () => { browserFields={mockBrowserFields} filteredBrowserFields={mockBrowserFields} searchInput={''} - height={FIELD_BROWSER_HEIGHT} isSearching={false} onCategorySelected={jest.fn()} - onHideFieldBrowser={jest.fn()} - onOutsideClick={jest.fn()} + onHide={jest.fn()} onSearchInputChange={jest.fn()} restoreFocusTo={React.createRef()} selectedCategoryId={''} timelineId={timelineId} - width={FIELD_BROWSER_WIDTH} /> ); @@ -185,16 +222,13 @@ describe('FieldsBrowser', () => { browserFields={mockBrowserFields} filteredBrowserFields={mockBrowserFields} searchInput={''} - height={FIELD_BROWSER_HEIGHT} isSearching={false} onCategorySelected={jest.fn()} - onHideFieldBrowser={jest.fn()} - onOutsideClick={jest.fn()} + onHide={jest.fn()} onSearchInputChange={jest.fn()} restoreFocusTo={React.createRef()} selectedCategoryId={''} timelineId={timelineId} - width={FIELD_BROWSER_WIDTH} /> ); @@ -216,16 +250,13 @@ describe('FieldsBrowser', () => { browserFields={mockBrowserFields} filteredBrowserFields={mockBrowserFields} searchInput={''} - height={FIELD_BROWSER_HEIGHT} isSearching={false} onCategorySelected={jest.fn()} - onHideFieldBrowser={jest.fn()} - onOutsideClick={jest.fn()} + onHide={jest.fn()} onSearchInputChange={onSearchInputChange} restoreFocusTo={React.createRef()} selectedCategoryId={''} timelineId={timelineId} - width={FIELD_BROWSER_WIDTH} /> ); diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx index 8a89271797e95..a645235b620d8 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx @@ -6,16 +6,18 @@ */ import { - EuiButtonIcon, EuiFlexGroup, - EuiFocusTrap, EuiFlexItem, - EuiOutsideClickDetector, - EuiScreenReaderOnly, - EuiToolTip, + EuiModal, + EuiModalBody, + EuiModalHeader, + EuiModalHeaderTitle, + EuiModalFooter, + EuiButton, + EuiButtonEmpty, + EuiSpacer, } from '@elastic/eui'; -import React, { useEffect, useCallback, useRef } from 'react'; -import { noop } from 'lodash/fp'; +import React, { useEffect, useCallback, useRef, useMemo } from 'react'; import styled from 'styled-components'; import { useDispatch } from 'react-redux'; @@ -23,46 +25,30 @@ import type { BrowserFields, ColumnHeaderOptions } from '../../../../../common'; import { isEscape, isTab, stopPropagationAndPreventDefault } from '../../../../../common'; import { CategoriesPane } from './categories_pane'; import { FieldsPane } from './fields_pane'; -import { Header } from './header'; +import { Search } from './search'; import { CATEGORY_PANE_WIDTH, CLOSE_BUTTON_CLASS_NAME, FIELDS_PANE_WIDTH, + FIELD_BROWSER_WIDTH, focusSearchInput, onFieldsBrowserTabPressed, PANES_FLEX_GROUP_WIDTH, + RESET_FIELDS_CLASS_NAME, scrollCategoriesPane, } from './helpers'; -import type { FieldBrowserProps, OnHideFieldBrowser } from './types'; -import { tGridActions } from '../../../../store/t_grid'; +import type { FieldBrowserProps } from './types'; +import { tGridActions, tGridSelectors } from '../../../../store/t_grid'; import * as i18n from './translations'; - -const FieldsBrowserContainer = styled.div<{ width: number }>` - background-color: ${({ theme }) => theme.eui.euiColorLightestShade}; - border: ${({ theme }) => theme.eui.euiBorderWidthThin} solid - ${({ theme }) => theme.eui.euiColorMediumShade}; - border-radius: ${({ theme }) => theme.eui.euiBorderRadius}; - left: 12px; - padding: ${({ theme }) => theme.eui.paddingSizes.s} ${({ theme }) => theme.eui.paddingSizes.s} - ${({ theme }) => theme.eui.paddingSizes.s}; - position: fixed; - top: 50%; - transform: translateY(-50%); - width: ${({ width }) => width}px; - z-index: 9990; -`; -FieldsBrowserContainer.displayName = 'FieldsBrowserContainer'; +import { useDeepEqualSelector } from '../../../../hooks/use_selector'; const PanesFlexGroup = styled(EuiFlexGroup)` width: ${PANES_FLEX_GROUP_WIDTH}px; `; PanesFlexGroup.displayName = 'PanesFlexGroup'; -type Props = Pick< - FieldBrowserProps, - 'browserFields' | 'height' | 'onFieldSelected' | 'timelineId' | 'width' -> & { +type Props = Pick & { /** * The current timeline column headers */ @@ -92,11 +78,7 @@ type Props = Pick< /** * Hides the field browser when invoked */ - onHideFieldBrowser: OnHideFieldBrowser; - /** - * Invoked when the user clicks outside of the field browser - */ - onOutsideClick: () => void; + onHide: () => void; /** * Invoked when the user types in the search input */ @@ -119,15 +101,13 @@ const FieldsBrowserComponent: React.FC = ({ filteredBrowserFields, isSearching, onCategorySelected, - onFieldSelected, - onHideFieldBrowser, onSearchInputChange, - onOutsideClick, + onHide, restoreFocusTo, searchInput, selectedCategoryId, timelineId, - width, + width = FIELD_BROWSER_WIDTH, }) => { const dispatch = useDispatch(); const containerElement = useRef(null); @@ -137,6 +117,22 @@ const FieldsBrowserComponent: React.FC = ({ [dispatch, timelineId] ); + const closeAndRestoreFocus = useCallback(() => { + onHide(); + setTimeout(() => { + // restore focus on the next tick after we have escaped the EuiFocusTrap + restoreFocusTo.current?.focus(); + }, 0); + }, [onHide, restoreFocusTo]); + + const getManageTimeline = useMemo(() => tGridSelectors.getManageTimelineById(), []); + const { defaultColumns } = useDeepEqualSelector((state) => getManageTimeline(state, timelineId)); + + const onResetColumns = useCallback(() => { + onUpdateColumns(defaultColumns); + closeAndRestoreFocus(); + }, [onUpdateColumns, closeAndRestoreFocus, defaultColumns]); + /** Invoked when the user types in the input to filter the field browser */ const onInputChange = useCallback( (event: React.ChangeEvent) => { @@ -145,17 +141,6 @@ const FieldsBrowserComponent: React.FC = ({ [onSearchInputChange] ); - const selectFieldAndHide = useCallback( - (fieldId: string) => { - if (onFieldSelected != null) { - onFieldSelected(fieldId); - } - - onHideFieldBrowser(); - }, - [onFieldSelected, onHideFieldBrowser] - ); - const scrollViewsAndFocusInput = useCallback(() => { scrollCategoriesPane({ containerElement: containerElement.current, @@ -175,14 +160,6 @@ const FieldsBrowserComponent: React.FC = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedCategoryId, timelineId]); - const closeAndRestoreFocus = useCallback(() => { - onOutsideClick(); - setTimeout(() => { - // restore focus on the next tick after we have escaped the EuiFocusTrap - restoreFocusTo.current?.focus(); - }, 0); - }, [onOutsideClick, restoreFocusTo]); - const onKeyDown = useCallback( (keyboardEvent: React.KeyboardEvent) => { if (isEscape(keyboardEvent)) { @@ -201,47 +178,24 @@ const FieldsBrowserComponent: React.FC = ({ ); return ( - - - - -

{i18n.YOU_ARE_IN_A_POPOVER}

-
- - - - - - - - - -
+
+ + +

{i18n.FIELDS_BROWSER}

+
+
+ + + - + = ({ data-test-subj="fields-pane" filteredBrowserFields={filteredBrowserFields} onCategorySelected={onCategorySelected} - onFieldSelected={selectFieldAndHide} onUpdateColumns={onUpdateColumns} searchInput={searchInput} selectedCategoryId={selectedCategoryId} @@ -269,9 +222,32 @@ const FieldsBrowserComponent: React.FC = ({ /> - - - + + + + + + {i18n.RESET_FIELDS} + + + + + + {i18n.CLOSE} + + + +
+ ); }; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.test.tsx index 275ce4907435f..aec21b4847136 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.test.tsx @@ -27,7 +27,6 @@ describe('FieldsPane', () => { columnHeaders={[]} filteredBrowserFields={mockBrowserFields} onCategorySelected={jest.fn()} - onFieldSelected={jest.fn()} onUpdateColumns={jest.fn()} searchInput="" selectedCategoryId={selectedCategory} @@ -51,7 +50,6 @@ describe('FieldsPane', () => { columnHeaders={[]} filteredBrowserFields={mockBrowserFields} onCategorySelected={jest.fn()} - onFieldSelected={jest.fn()} onUpdateColumns={jest.fn()} searchInput="" selectedCategoryId={selectedCategory} @@ -75,7 +73,6 @@ describe('FieldsPane', () => { columnHeaders={[]} filteredBrowserFields={{}} onCategorySelected={jest.fn()} - onFieldSelected={jest.fn()} onUpdateColumns={jest.fn()} searchInput={searchInput} selectedCategoryId="" @@ -99,7 +96,6 @@ describe('FieldsPane', () => { columnHeaders={[]} filteredBrowserFields={{}} onCategorySelected={jest.fn()} - onFieldSelected={jest.fn()} onUpdateColumns={jest.fn()} searchInput={searchInput} selectedCategoryId="" diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx index 633d1c536035a..11ad3b881b637 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx @@ -11,7 +11,6 @@ import styled from 'styled-components'; import { useDispatch } from 'react-redux'; import { Category } from './category'; -import type { FieldBrowserProps } from './types'; import { getFieldItems } from './field_items'; import { FIELDS_PANE_WIDTH, TABLE_HEIGHT } from './helpers'; @@ -33,7 +32,8 @@ const NoFieldsFlexGroup = styled(EuiFlexGroup)` NoFieldsFlexGroup.displayName = 'NoFieldsFlexGroup'; -type Props = Pick & { +interface Props { + timelineId: string; columnHeaders: ColumnHeaderOptions[]; /** * A map of categoryId -> metadata about the fields in that category, @@ -56,7 +56,7 @@ type Props = Pick & { selectedCategoryId: string; /** The width field browser */ width: number; -}; +} export const FieldsPane = React.memo( ({ columnHeaders, diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/header.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/header.tsx deleted file mode 100644 index 42ea20f1dfab8..0000000000000 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/header.tsx +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { - EuiButtonEmpty, - EuiFieldSearch, - EuiFlexGroup, - EuiFlexItem, - EuiText, - EuiTitle, -} from '@elastic/eui'; -import React, { useCallback, useMemo } from 'react'; -import styled from 'styled-components'; -import type { BrowserFields, OnUpdateColumns } from '../../../../../common'; -import { useDeepEqualSelector } from '../../../../hooks/use_selector'; -import { tGridSelectors } from '../../../../store/t_grid'; - -import { - getFieldBrowserSearchInputClassName, - getFieldCount, - RESET_FIELDS_CLASS_NAME, - SEARCH_INPUT_WIDTH, -} from './helpers'; - -import * as i18n from './translations'; - -const CountsFlexGroup = styled(EuiFlexGroup)` - margin-top: 5px; -`; - -CountsFlexGroup.displayName = 'CountsFlexGroup'; - -const CountFlexItem = styled(EuiFlexItem)` - margin-right: 5px; -`; - -CountFlexItem.displayName = 'CountFlexItem'; - -// background-color: ${props => props.theme.eui.euiColorLightestShade}; -const HeaderContainer = styled.div` - padding: 0 16px 16px 16px; - margin-bottom: 8px; -`; - -HeaderContainer.displayName = 'HeaderContainer'; - -const SearchContainer = styled.div` - input { - max-width: ${SEARCH_INPUT_WIDTH}px; - width: ${SEARCH_INPUT_WIDTH}px; - } -`; - -SearchContainer.displayName = 'SearchContainer'; - -interface Props { - filteredBrowserFields: BrowserFields; - isSearching: boolean; - onOutsideClick: () => void; - onSearchInputChange: (event: React.ChangeEvent) => void; - onUpdateColumns: OnUpdateColumns; - searchInput: string; - timelineId: string; -} - -const CountRow = React.memo>(({ filteredBrowserFields }) => ( - - - - {i18n.CATEGORIES_COUNT(Object.keys(filteredBrowserFields).length)} - - - - - - {i18n.FIELDS_COUNT( - Object.keys(filteredBrowserFields).reduce( - (fieldsCount, category) => getFieldCount(filteredBrowserFields[category]) + fieldsCount, - 0 - ) - )} - - - -)); - -CountRow.displayName = 'CountRow'; - -const TitleRow = React.memo<{ - id: string; - onOutsideClick: () => void; - onUpdateColumns: OnUpdateColumns; -}>(({ id, onOutsideClick, onUpdateColumns }) => { - const getManageTimeline = useMemo(() => tGridSelectors.getManageTimelineById(), []); - const { defaultColumns } = useDeepEqualSelector((state) => getManageTimeline(state, id)); - - const handleResetColumns = useCallback(() => { - onUpdateColumns(defaultColumns); - onOutsideClick(); - }, [onUpdateColumns, onOutsideClick, defaultColumns]); - - return ( - - - -

{i18n.FIELDS_BROWSER}

-
-
- - - - {i18n.RESET_FIELDS} - - -
- ); -}); - -TitleRow.displayName = 'TitleRow'; - -export const Header = React.memo( - ({ - isSearching, - filteredBrowserFields, - onOutsideClick, - onSearchInputChange, - onUpdateColumns, - searchInput, - timelineId, - }) => ( - - - - - - - - ) -); - -Header.displayName = 'Header'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx index 9a3559c51ef87..46aa5a00e0c3a 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx @@ -30,12 +30,11 @@ LoadingSpinner.displayName = 'LoadingSpinner'; export const CATEGORY_PANE_WIDTH = 200; export const DESCRIPTION_COLUMN_WIDTH = 300; export const FIELD_COLUMN_WIDTH = 200; -export const FIELD_BROWSER_WIDTH = 900; -export const FIELD_BROWSER_HEIGHT = 300; +export const FIELD_BROWSER_WIDTH = 925; export const FIELDS_PANE_WIDTH = 670; export const HEADER_HEIGHT = 40; export const PANES_FLEX_GROUP_WIDTH = CATEGORY_PANE_WIDTH + FIELDS_PANE_WIDTH + 10; -export const SEARCH_INPUT_WIDTH = 850; +export const PANES_FLEX_GROUP_HEIGHT = 260; export const TABLE_HEIGHT = 260; export const TYPE_COLUMN_WIDTH = 50; @@ -199,6 +198,11 @@ export const viewAllHasFocus = (containerElement: HTMLElement | null): boolean = containerElement?.querySelector(`.${VIEW_ALL_BUTTON_CLASS_NAME}`) ); +export const resetButtonHasFocus = (containerElement: HTMLElement | null): boolean => + elementOrChildrenHasFocus( + containerElement?.querySelector(`.${RESET_FIELDS_CLASS_NAME}`) + ); + export const scrollCategoriesPane = ({ containerElement, selectedCategoryId, @@ -308,15 +312,20 @@ export const onCategoryTableFocusChanging = ({ }: { containerElement: HTMLElement | null; shiftKey: boolean; -}) => (shiftKey ? focusViewAllButton(containerElement) : focusCloseButton(containerElement)); +}) => (shiftKey ? focusViewAllButton(containerElement) : focusResetFieldsButton(containerElement)); export const onCloseButtonFocusChanging = ({ containerElement, shiftKey, + timelineId, }: { containerElement: HTMLElement | null; shiftKey: boolean; -}) => (shiftKey ? focusCategoryTable(containerElement) : focusResetFieldsButton(containerElement)); + timelineId: string; +}) => + shiftKey + ? focusResetFieldsButton(containerElement) + : focusSearchInput({ containerElement, timelineId }); export const onSearchInputFocusChanging = ({ containerElement, @@ -330,7 +339,7 @@ export const onSearchInputFocusChanging = ({ timelineId: string; }) => shiftKey - ? focusResetFieldsButton(containerElement) + ? focusCloseButton(containerElement) : focusCategoriesPane({ containerElement, selectedCategoryId, timelineId }); export const onViewAllFocusChanging = ({ @@ -348,6 +357,14 @@ export const onViewAllFocusChanging = ({ ? focusCategoriesPane({ containerElement, selectedCategoryId, timelineId }) : focusCategoryTable(containerElement); +export const onResetButtonFocusChanging = ({ + containerElement, + shiftKey, +}: { + containerElement: HTMLElement | null; + shiftKey: boolean; +}) => (shiftKey ? focusCategoryTable(containerElement) : focusCloseButton(containerElement)); + export const onFieldsBrowserTabPressed = ({ containerElement, keyboardEvent, @@ -390,11 +407,18 @@ export const onFieldsBrowserTabPressed = ({ containerElement, shiftKey, }); + } else if (resetButtonHasFocus(containerElement)) { + stopPropagationAndPreventDefault(keyboardEvent); + onResetButtonFocusChanging({ + containerElement, + shiftKey, + }); } else if (closeButtonHasFocus(containerElement)) { stopPropagationAndPreventDefault(keyboardEvent); onCloseButtonFocusChanging({ containerElement, shiftKey, + timelineId, }); } }; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/index.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/index.test.tsx index 60c1e8da08b78..b8bc2a12ffd6e 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/index.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/index.test.tsx @@ -11,7 +11,7 @@ import { waitFor } from '@testing-library/react'; import { mockBrowserFields, TestProviders } from '../../../../mock'; -import { FIELD_BROWSER_HEIGHT, FIELD_BROWSER_WIDTH } from './helpers'; +import { FIELD_BROWSER_WIDTH } from './helpers'; import { StatefulFieldsBrowserComponent } from '.'; @@ -28,9 +28,7 @@ describe('StatefulFieldsBrowser', () => { ); @@ -45,9 +43,7 @@ describe('StatefulFieldsBrowser', () => { ); @@ -61,9 +57,7 @@ describe('StatefulFieldsBrowser', () => { ); @@ -84,9 +78,7 @@ describe('StatefulFieldsBrowser', () => { ); @@ -111,9 +103,7 @@ describe('StatefulFieldsBrowser', () => { ); @@ -157,10 +147,8 @@ describe('StatefulFieldsBrowser', () => { ); @@ -176,7 +164,6 @@ describe('StatefulFieldsBrowser', () => { = ({ + timelineId, columnHeaders, browserFields, - height, - onFieldSelected, - timelineId, width, }) => { const customizeColumnsButtonRef = useRef(null); @@ -65,9 +61,18 @@ export const StatefulFieldsBrowserComponent: React.FC = ({ }, []); /** Shows / hides the field browser */ - const toggleShow = useCallback(() => { - setShow(!show); - }, [show]); + const onShow = useCallback(() => { + setShow(true); + }, []); + + /** Invoked when the field browser should be hidden */ + const onHide = useCallback(() => { + setFilterInput(''); + setFilteredBrowserFields(null); + setIsSearching(false); + setSelectedCategoryId(DEFAULT_CATEGORY_NAME); + setShow(false); + }, []); /** Invoked when the user types in the filter input */ const updateFilter = useCallback( @@ -108,16 +113,6 @@ export const StatefulFieldsBrowserComponent: React.FC = ({ [browserFields, filterInput, inputTimeoutId.current] ); - /** Invoked when the field browser should be hidden */ - const hideFieldBrowser = useCallback(() => { - setFilterInput(''); - setFilterInput(''); - setFilteredBrowserFields(null); - setIsSearching(false); - setSelectedCategoryId(DEFAULT_CATEGORY_NAME); - setShow(false); - }, []); - // only merge in the default category if the field browser is visible const browserFieldsWithDefaultCategory = useMemo(() => { return show ? mergeBrowserFieldsWithDefaultCategory(browserFields) : {}; @@ -129,11 +124,11 @@ export const StatefulFieldsBrowserComponent: React.FC = ({ {i18n.FIELDS} @@ -141,29 +136,22 @@ export const StatefulFieldsBrowserComponent: React.FC = ({ {show && ( - - - + )} ); diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/header.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.test.tsx similarity index 58% rename from x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/header.test.tsx rename to x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.test.tsx index 0270540fc491d..8d2c3d4714541 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/header.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.test.tsx @@ -8,100 +8,18 @@ import { mount } from 'enzyme'; import React from 'react'; import { mockBrowserFields, TestProviders } from '../../../../mock'; -import { Header } from './header'; +import { Search } from './search'; const timelineId = 'test'; -describe('Header', () => { - test('it renders the field browser title', () => { - const wrapper = mount( - -
- - ); - - expect(wrapper.find('[data-test-subj="field-browser-title"]').first().text()).toEqual('Fields'); - }); - - test('it renders the Reset Fields button', () => { - const wrapper = mount( - -
- - ); - - expect(wrapper.find('[data-test-subj="reset-fields"]').first().text()).toEqual('Reset Fields'); - }); - - test('it invokes onUpdateColumns when the user clicks the Reset Fields button', () => { - const onUpdateColumns = jest.fn(); - - const wrapper = mount( - -
- - ); - - wrapper.find('[data-test-subj="reset-fields"]').first().simulate('click'); - - expect(onUpdateColumns).toBeCalled(); - }); - - test('it invokes onOutsideClick when the user clicks the Reset Fields button', () => { - const onOutsideClick = jest.fn(); - - const wrapper = mount( - -
- - ); - - wrapper.find('[data-test-subj="reset-fields"]').first().simulate('click'); - - expect(onOutsideClick).toBeCalled(); - }); - +describe('Search', () => { test('it renders the field search input with the expected placeholder text when the searchInput prop is empty', () => { const wrapper = mount( -
@@ -118,12 +36,10 @@ describe('Header', () => { const wrapper = mount( -
@@ -136,12 +52,10 @@ describe('Header', () => { test('it renders the field search input with a spinner when isSearching is true', () => { const wrapper = mount( -
@@ -156,12 +70,10 @@ describe('Header', () => { const wrapper = mount( -
@@ -180,12 +92,10 @@ describe('Header', () => { test('it returns the expected categories count when filteredBrowserFields is empty', () => { const wrapper = mount( -
@@ -200,12 +110,10 @@ describe('Header', () => { test('it returns the expected categories count when filteredBrowserFields is NOT empty', () => { const wrapper = mount( -
@@ -220,12 +128,10 @@ describe('Header', () => { test('it returns the expected fields count when filteredBrowserFields is empty', () => { const wrapper = mount( -
@@ -238,12 +144,10 @@ describe('Header', () => { test('it returns the expected fields count when filteredBrowserFields is NOT empty', () => { const wrapper = mount( -
diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.tsx new file mode 100644 index 0000000000000..4ff41bc7e4339 --- /dev/null +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.tsx @@ -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 + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiFieldSearch, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; +import styled from 'styled-components'; +import type { BrowserFields } from '../../../../../common'; + +import { getFieldBrowserSearchInputClassName, getFieldCount } from './helpers'; + +import * as i18n from './translations'; + +const CountsFlexGroup = styled(EuiFlexGroup)` + margin-top: ${({ theme }) => theme.eui.euiSizeXS}; + margin-left: ${({ theme }) => theme.eui.euiSizeXS}; +`; + +CountsFlexGroup.displayName = 'CountsFlexGroup'; + +interface Props { + filteredBrowserFields: BrowserFields; + isSearching: boolean; + onSearchInputChange: (event: React.ChangeEvent) => void; + searchInput: string; + timelineId: string; +} + +const CountRow = React.memo>(({ filteredBrowserFields }) => ( + + + + {i18n.CATEGORIES_COUNT(Object.keys(filteredBrowserFields).length)} + + + + + + {i18n.FIELDS_COUNT( + Object.keys(filteredBrowserFields).reduce( + (fieldsCount, category) => getFieldCount(filteredBrowserFields[category]) + fieldsCount, + 0 + ) + )} + + + +)); + +CountRow.displayName = 'CountRow'; + +export const Search = React.memo( + ({ isSearching, filteredBrowserFields, onSearchInputChange, searchInput, timelineId }) => ( + <> + + + + ) +); + +Search.displayName = 'Search'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/translations.ts b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/translations.ts index 11fcd18a00894..ac0160fad6cde 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/translations.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/translations.ts @@ -36,10 +36,6 @@ export const CATEGORY_FIELDS_TABLE_CAPTION = (categoryId: string) => }, }); -export const COPY_TO_CLIPBOARD = i18n.translate('xpack.timelines.fieldBrowser.copyToClipboard', { - defaultMessage: 'Copy to Clipboard', -}); - export const CLOSE = i18n.translate('xpack.timelines.fieldBrowser.closeButton', { defaultMessage: 'Close', }); @@ -102,13 +98,6 @@ export const VIEW_ALL_CATEGORY_FIELDS = (categoryId: string) => }, }); -export const YOU_ARE_IN_A_POPOVER = i18n.translate( - 'xpack.timelines.fieldBrowser.youAreInAPopoverScreenReaderOnly', - { - defaultMessage: 'You are in the Customize Columns popup. To exit this popup, press Escape.', - } -); - export const VIEW_COLUMN = (field: string) => i18n.translate('xpack.timelines.fieldBrowser.viewColumnCheckboxAriaLabel', { values: { field }, diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts index ebd72083a2bfe..2932f30cafca7 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts @@ -9,25 +9,16 @@ import type { BrowserFields } from '../../../../../common/search_strategy/index_ import type { ColumnHeaderOptions } from '../../../../../common/types/timeline/columns'; export type OnFieldSelected = (fieldId: string) => void; -export type OnHideFieldBrowser = () => void; export interface FieldBrowserProps { + /** The timeline associated with this field browser */ + timelineId: string; /** The timeline's current column headers */ columnHeaders: ColumnHeaderOptions[]; /** A map of categoryId -> metadata about the fields in that category */ browserFields: BrowserFields; - /** The height of the field browser */ - height: number; /** When true, this Fields Browser is being used as an "events viewer" */ isEventViewer?: boolean; - /** - * Overrides the default behavior of the `FieldBrowser` to enable - * "selection" mode, where a field is selected by clicking a button - * instead of dragging it to the timeline - */ - onFieldSelected?: OnFieldSelected; - /** The timeline associated with this field browser */ - timelineId: string; /** The width of the field browser */ - width: number; + width?: number; } diff --git a/x-pack/plugins/timelines/public/methods/index.tsx b/x-pack/plugins/timelines/public/methods/index.tsx index f99594195842b..fa0ad55d065a3 100644 --- a/x-pack/plugins/timelines/public/methods/index.tsx +++ b/x-pack/plugins/timelines/public/methods/index.tsx @@ -11,11 +11,7 @@ import type { Store } from 'redux'; import type { Storage } from '../../../../../src/plugins/kibana_utils/public'; import type { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; import type { TGridProps } from '../types'; -import type { - LastUpdatedAtProps, - LoadingPanelProps, - FieldBrowserWrappedProps, -} from '../components'; +import type { LastUpdatedAtProps, LoadingPanelProps, FieldBrowserProps } from '../components'; import type { AddToCaseActionProps } from '../components/actions/timeline/cases/add_to_case_action'; const TimelineLazy = lazy(() => import('../components')); @@ -59,10 +55,7 @@ export const getLoadingPanelLazy = (props: LoadingPanelProps) => { }; const FieldsBrowserLazy = lazy(() => import('../components/fields_browser')); -export const getFieldsBrowserLazy = ( - props: FieldBrowserWrappedProps, - { store }: { store: Store } -) => { +export const getFieldsBrowserLazy = (props: FieldBrowserProps, { store }: { store: Store }) => { return ( }> diff --git a/x-pack/plugins/timelines/public/plugin.ts b/x-pack/plugins/timelines/public/plugin.ts index cb931ff53d445..24bc99e59aaf0 100644 --- a/x-pack/plugins/timelines/public/plugin.ts +++ b/x-pack/plugins/timelines/public/plugin.ts @@ -14,7 +14,7 @@ import type { PluginInitializerContext, CoreStart, } from '../../../../src/core/public'; -import type { LastUpdatedAtProps, LoadingPanelProps, FieldBrowserWrappedProps } from './components'; +import type { LastUpdatedAtProps, LoadingPanelProps, FieldBrowserProps } from './components'; import { getLastUpdatedLazy, getLoadingPanelLazy, @@ -60,7 +60,7 @@ export class TimelinesPlugin implements Plugin { getLastUpdated: (props: LastUpdatedAtProps) => { return getLastUpdatedLazy(props); }, - getFieldBrowser: (props: FieldBrowserWrappedProps) => { + getFieldBrowser: (props: FieldBrowserProps) => { return getFieldsBrowserLazy(props, { store: this._store!, }); diff --git a/x-pack/plugins/timelines/public/types.ts b/x-pack/plugins/timelines/public/types.ts index 13e5a52776f8d..782481d79e0c4 100644 --- a/x-pack/plugins/timelines/public/types.ts +++ b/x-pack/plugins/timelines/public/types.ts @@ -14,7 +14,7 @@ import { CasesUiStart } from '../../cases/public'; import type { LastUpdatedAtProps, LoadingPanelProps, - FieldBrowserWrappedProps, + FieldBrowserProps, UseDraggableKeyboardWrapper, UseDraggableKeyboardWrapperProps, } from './components'; @@ -33,7 +33,7 @@ export interface TimelinesUIStart { getTGridReducer: () => any; getLoadingPanel: (props: LoadingPanelProps) => ReactElement; getLastUpdated: (props: LastUpdatedAtProps) => ReactElement; - getFieldBrowser: (props: FieldBrowserWrappedProps) => ReactElement; + getFieldBrowser: (props: FieldBrowserProps) => ReactElement; getUseAddToTimeline: () => (props: UseAddToTimelineProps) => UseAddToTimeline; getUseAddToTimelineSensor: () => (api: SensorAPI) => void; getUseDraggableKeyboardWrapper: () => ( diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 6c33c5f8e3ba6..7cfd0f52bfa64 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -5198,11 +5198,11 @@ "visTypeXy.function.valueAxis.axisParams.help": "値軸パラメーター", "visTypeXy.function.valueaxis.help": "値軸オブジェクトを生成します", "visTypeXy.function.valueAxis.name.help": "値軸の名前", - "visTypeXy.function.xyDimension.aggType.help": "集約タイプ", - "visTypeXy.function.xydimension.help": "XYディメンションオブジェクトを生成します", - "visTypeXy.function.xyDimension.label.help": "ラベル", - "visTypeXy.function.xyDimension.params.help": "パラメーター", - "visTypeXy.function.xyDimension.visDimension.help": "ディメンションオブジェクト構成", + "visualizations.function.xyDimension.aggType.help": "集約タイプ", + "visualizations.function.xydimension.help": "XYディメンションオブジェクトを生成します", + "visualizations.function.xyDimension.label.help": "ラベル", + "visualizations.function.xyDimension.params.help": "パラメーター", + "visualizations.function.xyDimension.visDimension.help": "ディメンションオブジェクト構成", "visTypeXy.functions.help": "XYビジュアライゼーション", "visTypeXy.histogram.groupTitle": "系列を分割", "visTypeXy.histogram.histogramDescription": "軸の縦棒にデータを表示します。", @@ -22527,7 +22527,6 @@ "xpack.securitySolution.timeline.autosave.warning.title": "更新されるまで自動保存は無効です", "xpack.securitySolution.timeline.body.actions.addNotesForRowAriaLabel": "行 {ariaRowindex}、列 {columnValues} のイベントのメモをタイムラインに追加", "xpack.securitySolution.timeline.body.actions.attachAlertToCaseForRowAriaLabel": "行 {ariaRowindex}、列 {columnValues} のアラートまたはイベントをケースに追加", - "xpack.securitySolution.timeline.body.actions.checkboxForRowAriaLabel": "行 {ariaRowindex}、列 {columnValues} のアラートまたはイベントのチェックボックスを{checked, select, false {オフ} true {オン}}", "xpack.securitySolution.timeline.body.actions.collapseAriaLabel": "縮小", "xpack.securitySolution.timeline.body.actions.expandEventTooltip": "詳細を表示", "xpack.securitySolution.timeline.body.actions.investigateInResolverDisabledTooltip": "このイベントを分析できません。フィールドマッピングの互換性がありません", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index af269112574f9..e232814d18836 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -5225,11 +5225,11 @@ "visTypeXy.function.valueAxis.axisParams.help": "值轴参数", "visTypeXy.function.valueaxis.help": "生成值轴对象", "visTypeXy.function.valueAxis.name.help": "值轴的名称", - "visTypeXy.function.xyDimension.aggType.help": "聚合类型", - "visTypeXy.function.xydimension.help": "生成 xy 维度对象", - "visTypeXy.function.xyDimension.label.help": "标签", - "visTypeXy.function.xyDimension.params.help": "参数", - "visTypeXy.function.xyDimension.visDimension.help": "维度对象配置", + "visualizations.function.xyDimension.aggType.help": "聚合类型", + "visualizations.function.xydimension.help": "生成 xy 维度对象", + "visualizations.function.xyDimension.label.help": "标签", + "visualizations.function.xyDimension.params.help": "参数", + "visualizations.function.xyDimension.visDimension.help": "维度对象配置", "visTypeXy.functions.help": "XY 可视化", "visTypeXy.histogram.groupTitle": "拆分序列", "visTypeXy.histogram.histogramDescription": "在轴上以垂直条形图的形式呈现数据。", @@ -23051,7 +23051,6 @@ "xpack.securitySolution.timeline.autosave.warning.title": "刷新后才会启用自动保存", "xpack.securitySolution.timeline.body.actions.addNotesForRowAriaLabel": "将事件第 {ariaRowindex} 行的备注添加到时间线,其中列为 {columnValues}", "xpack.securitySolution.timeline.body.actions.attachAlertToCaseForRowAriaLabel": "将第 {ariaRowindex} 行的告警或事件附加到案例,其中列为 {columnValues}", - "xpack.securitySolution.timeline.body.actions.checkboxForRowAriaLabel": "告警或事件第 {ariaRowindex} 行的{checked, select, false {已取消选中} true {已选中}}复选框,其中列为 {columnValues}", "xpack.securitySolution.timeline.body.actions.collapseAriaLabel": "折叠", "xpack.securitySolution.timeline.body.actions.expandEventTooltip": "查看详情", "xpack.securitySolution.timeline.body.actions.investigateInResolverDisabledTooltip": "无法分析此事件,因为其包含不兼容的字段映射", diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx index 762526dfd7fa7..f990e12ed76e5 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/health_check.tsx @@ -153,7 +153,7 @@ const TlsError = ({ docLinks, className }: PromptErrorProps) => (

} diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts index 507ec7a420bfb..99801cf838836 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts @@ -24,7 +24,7 @@ import { DEFAULT_MAX_EPHEMERAL_ACTIONS_PER_ALERT } from '../../../../../plugins/ export default function createNotifyWhenTests({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const retry = getService('retry'); - const es = getService('legacyEs'); + const es = getService('es'); const esTestIndexTool = new ESTestIndexTool(es, retry); @@ -117,7 +117,7 @@ export default function createNotifyWhenTests({ getService }: FtrProviderContext ); const searchResult = await esTestIndexTool.search('action:test.index-record'); - expect(searchResult.hits.total.value).equal( + expect(searchResult.body.hits.total.value).equal( nonEphemeralTasks + DEFAULT_MAX_EPHEMERAL_ACTIONS_PER_ALERT ); }); diff --git a/x-pack/test/api_integration/apis/management/index_management/component_templates.ts b/x-pack/test/api_integration/apis/management/index_management/component_templates.ts index b631869145e1e..c6a3b77edd1c0 100644 --- a/x-pack/test/api_integration/apis/management/index_management/component_templates.ts +++ b/x-pack/test/api_integration/apis/management/index_management/component_templates.ts @@ -281,8 +281,19 @@ export default function ({ getService }: FtrProviderContext) { expect(body).to.eql({ statusCode: 404, error: 'Not Found', - message: - '[resource_not_found_exception] component template matching [component_does_not_exist] not found', + message: 'component template matching [component_does_not_exist] not found', + attributes: { + error: { + reason: 'component template matching [component_does_not_exist] not found', + root_cause: [ + { + reason: 'component template matching [component_does_not_exist] not found', + type: 'resource_not_found_exception', + }, + ], + type: 'resource_not_found_exception', + }, + }, }); }); }); @@ -356,10 +367,19 @@ export default function ({ getService }: FtrProviderContext) { const uri = `${API_BASE_PATH}/component_templates/${componentTemplateName},${COMPONENT_DOES_NOT_EXIST}`; const { body } = await supertest.delete(uri).set('kbn-xsrf', 'xxx').expect(200); - expect(body.itemsDeleted).to.eql([componentTemplateName]); expect(body.errors[0].name).to.eql(COMPONENT_DOES_NOT_EXIST); - expect(body.errors[0].error.msg).to.contain('resource_not_found_exception'); + + expect(body.errors[0].error.payload.attributes.error).to.eql({ + root_cause: [ + { + type: 'resource_not_found_exception', + reason: 'component_does_not_exist', + }, + ], + type: 'resource_not_found_exception', + reason: 'component_does_not_exist', + }); }); }); diff --git a/x-pack/test/api_integration/apis/management/index_management/data_streams.ts b/x-pack/test/api_integration/apis/management/index_management/data_streams.ts index 74498eb8c91b9..8970e8cd642fd 100644 --- a/x-pack/test/api_integration/apis/management/index_management/data_streams.ts +++ b/x-pack/test/api_integration/apis/management/index_management/data_streams.ts @@ -14,11 +14,11 @@ import { DataStream } from '../../../../../plugins/index_management/common'; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - const es = getService('legacyEs'); + const es = getService('es'); const createDataStream = async (name: string) => { // A data stream requires an index template before it can be created. - await es.dataManagement.saveComposableIndexTemplate({ + await es.indices.putIndexTemplate({ name, body: { // We need to match the names of backing indices with this template. @@ -36,15 +36,15 @@ export default function ({ getService }: FtrProviderContext) { }, }); - await es.dataManagement.createDataStream({ name }); + await es.indices.createDataStream({ name }); }; const deleteComposableIndexTemplate = async (name: string) => { - await es.dataManagement.deleteComposableIndexTemplate({ name }); + await es.indices.deleteIndexTemplate({ name }); }; const deleteDataStream = async (name: string) => { - await es.dataManagement.deleteDataStream({ name }); + await es.indices.deleteDataStream({ name }); await deleteComposableIndexTemplate(name); }; diff --git a/x-pack/test/api_integration/apis/management/index_management/indices.js b/x-pack/test/api_integration/apis/management/index_management/indices.js index 25b1ef97d3087..589887329fcd1 100644 --- a/x-pack/test/api_integration/apis/management/index_management/indices.js +++ b/x-pack/test/api_integration/apis/management/index_management/indices.js @@ -56,13 +56,17 @@ export default function ({ getService }) { const index = await createIndex(); // Make sure the index is open - const [cat1] = await catIndex(index); + const { + body: [cat1], + } = await catIndex(index); expect(cat1.status).to.be('open'); await closeIndex(index).expect(200); // Make sure the index has been closed - const [cat2] = await catIndex(index); + const { + body: [cat2], + } = await catIndex(index); expect(cat2.status).to.be('close'); }); }); @@ -78,13 +82,17 @@ export default function ({ getService }) { await closeIndex(index); // Make sure the index is closed - const [cat1] = await catIndex(index); + const { + body: [cat1], + } = await catIndex(index); expect(cat1.status).to.be('close'); await openIndex(index).expect(200); // Make sure the index is opened - const [cat2] = await catIndex(index); + const { + body: [cat2], + } = await catIndex(index); expect(cat2.status).to.be('open'); }); }); @@ -93,12 +101,12 @@ export default function ({ getService }) { it('should delete an index', async () => { const index = await createIndex(); - const indices1 = await catIndex(undefined, 'i'); + const { body: indices1 } = await catIndex(undefined, 'i'); expect(indices1.map((index) => index.i)).to.contain(index); await deleteIndex([index]).expect(200); - const indices2 = await catIndex(undefined, 'i'); + const { body: indices2 } = await catIndex(undefined, 'i'); expect(indices2.map((index) => index.i)).not.to.contain(index); }); @@ -112,12 +120,16 @@ export default function ({ getService }) { it('should flush an index', async () => { const index = await createIndex(); - const { indices: indices1 } = await indexStats(index, 'flush'); + const { + body: { indices: indices1 }, + } = await indexStats(index, 'flush'); expect(indices1[index].total.flush.total).to.be(0); await flushIndex(index).expect(200); - const { indices: indices2 } = await indexStats(index, 'flush'); + const { + body: { indices: indices2 }, + } = await indexStats(index, 'flush'); expect(indices2[index].total.flush.total).to.be(1); }); }); @@ -126,12 +138,16 @@ export default function ({ getService }) { it('should refresh an index', async () => { const index = await createIndex(); - const { indices: indices1 } = await indexStats(index, 'refresh'); + const { + body: { indices: indices1 }, + } = await indexStats(index, 'refresh'); const previousRefreshes = indices1[index].total.refresh.total; await refreshIndex(index).expect(200); - const { indices: indices2 } = await indexStats(index, 'refresh'); + const { + body: { indices: indices2 }, + } = await indexStats(index, 'refresh'); expect(indices2[index].total.refresh.total).to.be(previousRefreshes + 1); }); }); @@ -153,12 +169,16 @@ export default function ({ getService }) { const index = await createIndex(); // "sth" correspond to search throttling. Frozen indices are normal indices // with search throttling turned on. - const [cat1] = await catIndex(index, 'sth'); + const { + body: [cat1], + } = await catIndex(index, 'sth'); expect(cat1.sth).to.be('false'); await freeze(index).expect(200); - const [cat2] = await catIndex(index, 'sth'); + const { + body: [cat2], + } = await catIndex(index, 'sth'); expect(cat2.sth).to.be('true'); }); }); @@ -168,11 +188,15 @@ export default function ({ getService }) { const index = await createIndex(); await freeze(index).expect(200); - const [cat1] = await catIndex(index, 'sth'); + const { + body: [cat1], + } = await catIndex(index, 'sth'); expect(cat1.sth).to.be('true'); await unfreeze(index).expect(200); - const [cat2] = await catIndex(index, 'sth'); + const { + body: [cat2], + } = await catIndex(index, 'sth'); expect(cat2.sth).to.be('false'); }); }); diff --git a/x-pack/test/api_integration/apis/management/index_management/lib/elasticsearch.js b/x-pack/test/api_integration/apis/management/index_management/lib/elasticsearch.js index 5a26356328f1f..22824227f1275 100644 --- a/x-pack/test/api_integration/apis/management/index_management/lib/elasticsearch.js +++ b/x-pack/test/api_integration/apis/management/index_management/lib/elasticsearch.js @@ -13,7 +13,7 @@ import { getRandomString } from './random'; * @param {ElasticsearchClient} es The Elasticsearch client instance */ export const initElasticsearchHelpers = (getService) => { - const es = getService('legacyEs'); + const es = getService('es'); const esDeleteAllIndices = getService('esDeleteAllIndices'); let indicesCreated = []; @@ -42,11 +42,11 @@ export const initElasticsearchHelpers = (getService) => { componentTemplatesCreated.push(componentTemplate.name); } - return es.dataManagement.saveComponentTemplate(componentTemplate); + return es.cluster.putComponentTemplate(componentTemplate); }; const deleteComponentTemplate = (componentTemplateName) => { - return es.dataManagement.deleteComponentTemplate({ name: componentTemplateName }); + return es.cluster.deleteComponentTemplate({ name: componentTemplateName }); }; const cleanUpComponentTemplates = () => diff --git a/x-pack/test/api_integration/apis/management/index_management/templates.js b/x-pack/test/api_integration/apis/management/index_management/templates.js index fd21427343577..1cb58c0957e17 100644 --- a/x-pack/test/api_integration/apis/management/index_management/templates.js +++ b/x-pack/test/api_integration/apis/management/index_management/templates.js @@ -193,8 +193,8 @@ export default function ({ getService }) { }); it('should parse the ES error and return the cause', async () => { - const templateName = `template-${getRandomString()}`; - const payload = getTemplatePayload(templateName, [getRandomString()]); + const templateName = `template-create-parse-es-error}`; + const payload = getTemplatePayload(templateName, ['create-parse-es-error']); const runtime = { myRuntimeField: { type: 'boolean', @@ -207,9 +207,9 @@ export default function ({ getService }) { const { body } = await createTemplate(payload).expect(400); expect(body.attributes).an('object'); - expect(body.attributes.message).contain('template after composition is invalid'); + expect(body.attributes.error.reason).contain('template after composition is invalid'); // one of the item of the cause array should point to our script - expect(body.attributes.cause.join(',')).contain('"hello with error'); + expect(body.attributes.causes.join(',')).contain('"hello with error'); }); }); @@ -220,7 +220,7 @@ export default function ({ getService }) { await createTemplate(indexTemplate).expect(200); - let catTemplateResponse = await catTemplate(templateName); + let { body: catTemplateResponse } = await catTemplate(templateName); const { name, version } = indexTemplate; @@ -234,7 +234,7 @@ export default function ({ getService }) { 200 ); - catTemplateResponse = await catTemplate(templateName); + ({ body: catTemplateResponse } = await catTemplate(templateName)); expect( catTemplateResponse.find(({ name: templateName }) => templateName === name).version @@ -247,7 +247,7 @@ export default function ({ getService }) { await createTemplate(legacyIndexTemplate).expect(200); - let catTemplateResponse = await catTemplate(templateName); + let { body: catTemplateResponse } = await catTemplate(templateName); const { name, version } = legacyIndexTemplate; @@ -262,7 +262,7 @@ export default function ({ getService }) { templateName ).expect(200); - catTemplateResponse = await catTemplate(templateName); + ({ body: catTemplateResponse } = await catTemplate(templateName)); expect( catTemplateResponse.find(({ name: templateName }) => templateName === name).version @@ -270,8 +270,8 @@ export default function ({ getService }) { }); it('should parse the ES error and return the cause', async () => { - const templateName = `template-${getRandomString()}`; - const payload = getTemplatePayload(templateName, [getRandomString()]); + const templateName = `template-update-parse-es-error}`; + const payload = getTemplatePayload(templateName, ['update-parse-es-error']); const runtime = { myRuntimeField: { type: 'keyword', @@ -292,7 +292,7 @@ export default function ({ getService }) { expect(body.attributes).an('object'); // one of the item of the cause array should point to our script - expect(body.attributes.cause.join(',')).contain('"hello with error'); + expect(body.attributes.causes.join(',')).contain('"hello with error'); }); }); @@ -306,7 +306,7 @@ export default function ({ getService }) { throw new Error(`Error creating template: ${createStatus} ${createBody.message}`); } - let catTemplateResponse = await catTemplate(templateName); + let { body: catTemplateResponse } = await catTemplate(templateName); expect( catTemplateResponse.find((template) => template.name === payload.name).name @@ -322,7 +322,7 @@ export default function ({ getService }) { expect(deleteBody.errors).to.be.empty; expect(deleteBody.templatesDeleted[0]).to.equal(templateName); - catTemplateResponse = await catTemplate(templateName); + ({ body: catTemplateResponse } = await catTemplate(templateName)); expect(catTemplateResponse.find((template) => template.name === payload.name)).to.equal( undefined @@ -335,7 +335,7 @@ export default function ({ getService }) { await createTemplate(payload).expect(200); - let catTemplateResponse = await catTemplate(templateName); + let { body: catTemplateResponse } = await catTemplate(templateName); expect( catTemplateResponse.find((template) => template.name === payload.name).name @@ -348,7 +348,7 @@ export default function ({ getService }) { expect(body.errors).to.be.empty; expect(body.templatesDeleted[0]).to.equal(templateName); - catTemplateResponse = await catTemplate(templateName); + ({ body: catTemplateResponse } = await catTemplate(templateName)); expect(catTemplateResponse.find((template) => template.name === payload.name)).to.equal( undefined diff --git a/x-pack/test/api_integration/apis/monitoring/standalone_cluster/fixtures/cluster.json b/x-pack/test/api_integration/apis/monitoring/standalone_cluster/fixtures/cluster.json index 13535347f437c..313481998d6c8 100644 --- a/x-pack/test/api_integration/apis/monitoring/standalone_cluster/fixtures/cluster.json +++ b/x-pack/test/api_integration/apis/monitoring/standalone_cluster/fixtures/cluster.json @@ -1,61 +1,66 @@ -[{ - "cluster_uuid": "__standalone_cluster__", - "license": {}, - "elasticsearch": { - "cluster_stats": { - "indices": { - "docs": {}, - "shards": {}, - "store": {} - }, - "nodes": { - "count": { - "total": {} +[ + { + "cluster_uuid": "__standalone_cluster__", + "license": {}, + "elasticsearch": { + "cluster_stats": { + "indices": { + "docs": {}, + "shards": {}, + "store": {} }, - "fs": {}, - "jvm": { - "mem": {} + "nodes": { + "count": { + "total": {} + }, + "fs": {}, + "jvm": { + "mem": {} + } } + }, + "logs": { + "enabled": false, + "reason": { + "clusterExists": false, + "indexPatternExists": false, + "indexPatternInTimeRangeExists": false, + "typeExistsAtAnyTime": false, + "usingStructuredLogs": false, + "nodeExists": null, + "indexExists": null, + "typeExists": false + }, + "types": [] } }, - "logs": { - "enabled": false, - "reason": { - "clusterExists": false, - "indexPatternExists": false, - "indexPatternInTimeRangeExists": false, - "typeExistsAtAnyTime": false, - "usingStructuredLogs": false, - "nodeExists": null, - "indexExists": null, - "typeExists": false - }, - "types": [] - } - }, - "logstash": {}, - "kibana": {}, - "beats": { - "totalEvents": 348, - "bytesSent": 319913, + "logstash": {}, + "kibana": {}, "beats": { - "total": 1, - "types": [{ - "type": "Packetbeat", - "count": 1 - }] - } - }, - "apm": { - "totalEvents": 0, - "memRss": 0, - "apms": { - "total": 0 + "totalEvents": 348, + "bytesSent": 319913, + "beats": { + "total": 1, + "types": [ + { + "type": "Packetbeat", + "count": 1 + } + ] + } }, - "config": { - "container": false + "apm": { + "totalEvents": 0, + "memRss": 0, + "apms": { + "total": 0 + }, + "config": { + "container": false + }, + "versions": [] }, - "versions": [] - }, - "isPrimary": false -}] + "isPrimary": false, + "isCcrEnabled": false + } +] diff --git a/x-pack/test/api_integration/services/legacy_es.js b/x-pack/test/api_integration/services/legacy_es.js index 0b02d394b107f..bc0f9946243c8 100644 --- a/x-pack/test/api_integration/services/legacy_es.js +++ b/x-pack/test/api_integration/services/legacy_es.js @@ -9,7 +9,6 @@ import { format as formatUrl } from 'url'; import * as legacyElasticsearch from 'elasticsearch'; -import { elasticsearchJsPlugin as indexManagementEsClientPlugin } from '../../../plugins/index_management/server/client/elasticsearch'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { DEFAULT_API_VERSION } from '../../../../src/core/server/elasticsearch/elasticsearch_config'; @@ -20,6 +19,5 @@ export function LegacyEsProvider({ getService }) { apiVersion: DEFAULT_API_VERSION, host: formatUrl(config.get('servers.elasticsearch')), requestTimeout: config.get('timeouts.esRequestTimeout'), - plugins: [indexManagementEsClientPlugin], }); } diff --git a/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/data.json.gz b/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/data.json.gz index f237a83a76a3f..1450997a0107e 100644 Binary files a/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/data.json.gz and b/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/data.json.gz differ diff --git a/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/mappings.json b/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/mappings.json index c7cbb55c32f9b..2d05717fa5725 100644 --- a/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/mappings.json +++ b/x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0/mappings.json @@ -2,3224 +2,43 @@ "type": "index", "value": { "aliases": { - ".kibana": { - }, - ".kibana_8.0.0": { - } - }, - "index": ".kibana_1", - "mappings": { - "_meta": { - "migrationMappingPropertyHashes": { - "action": "38c91d092e0790ecd9ebe58e82145280", - "action_task_params": "0b7bac797714726291526b250c582806", - "alert": "d75d3b0e95fe394753d73d8f7952cd7d", - "api_key_pending_invalidation": "16f515278a295f6245149ad7c5ddedb7", - "apm-indices": "9bb9b2bf1fa636ed8619cbab5ce6a1dd", - "apm-server-schema": "b1d71908f324c17bf744ac72af5038fb", - "apm-telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "app_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "application_usage_daily": "43b8830d5d0df85a6823d290885fc9fd", - "application_usage_totals": "3d1b76c39bfb2cc8296b024d73854724", - "application_usage_transactional": "3d1b76c39bfb2cc8296b024d73854724", - "canvas-element": "7390014e1091044523666d97247392fc", - "canvas-workpad": "b0a1706d356228dbdcb4a17e6b9eb231", - "canvas-workpad-template": "ae2673f678281e2c055d764b153e9715", - "cases": "d5d6a377dfebfacb1b806d8888292b05", - "cases-comments": "fce468d3d08e577b67af2e958e1f9e97", - "cases-configure": "c250ef0bf1ac86c1a1627c0b6398c98f", - "cases-connector-mappings": "17d2e9e0e170a21a471285a5d845353c", - "cases-user-actions": "25035423b7ceb4d4f1124c441d3f6529", - "config": "c63748b75f39d0c54de12d12c1ccbc20", - "core-usage-stats": "3d1b76c39bfb2cc8296b024d73854724", - "coreMigrationVersion": "2f4316de49999235636386fe51dc06c1", - "dashboard": "40554caf09725935e2c02e02563a2d07", - "endpoint:user-artifact": "4a11183eee21e6fbad864f7a30b39ad0", - "endpoint:user-artifact-manifest": "a0d7b04ad405eed54d76e279c3727862", - "enterprise_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "epm-packages": "0cbbb16506734d341a96aaed65ec6413", - "epm-packages-assets": "44621b2f6052ef966da47b7c3a00f33b", - "event_loop_delays_daily": "5df7e292ddd5028e07c1482e130e6654", - "exception-list": "baf108c9934dda844921f692a513adae", - "exception-list-agnostic": "baf108c9934dda844921f692a513adae", - "file-upload-usage-collection-telemetry": "a34fbb8e3263d105044869264860c697", - "fleet-agent-actions": "9511b565b1cc6441a42033db3d5de8e9", - "fleet-agents": "59fd74f819f028f8555776db198d2562", - "fleet-enrollment-api-keys": "a69ef7ae661dab31561d6c6f052ef2a7", - "fleet-preconfiguration-deletion-record": "4c36f199189a367e43541f236141204c", - "graph-workspace": "27a94b2edcb0610c6aea54a7c56d7752", - "index-pattern": "45915a1ad866812242df474eb0479052", - "infrastructure-ui-source": "3d1b76c39bfb2cc8296b024d73854724", - "ingest-agent-policies": "5e91121a6b10c13d8b5339c2ff721e9b", - "ingest-outputs": "1acb789ca37cbee70259ca79e124d9ad", - "ingest-package-policies": "2bdb4dbeca0d8e7b9cf620548137c695", - "ingest_manager_settings": "f159646d76ab261bfbf8ef504d9631e4", - "inventory-view": "3d1b76c39bfb2cc8296b024d73854724", - "kql-telemetry": "d12a98a6f19a2d273696597547e064ee", - "legacy-url-alias": "e8dd3b6056ad7e1de32523f457310ecb", - "lens": "52346cfec69ff7b47d5f0c12361a2797", - "lens-ui-telemetry": "509bfa5978586998e05f9e303c07a327", - "map": "9134b47593116d7953f6adba096fc463", - "maps-telemetry": "5ef305b18111b77789afefbd36b66171", - "metrics-explorer-view": "3d1b76c39bfb2cc8296b024d73854724", - "migrationVersion": "4a1746014a75ade3a714e1db5763276f", - "ml-job": "3bb64c31915acf93fc724af137a0891b", - "ml-module": "46ef4f0d6682636f0fff9799d6a2d7ac", - "monitoring-telemetry": "2669d5ec15e82391cf58df4294ee9c68", - "namespace": "2f4316de49999235636386fe51dc06c1", - "namespaces": "2f4316de49999235636386fe51dc06c1", - "originId": "2f4316de49999235636386fe51dc06c1", - "osquery-saved-query": "6bb1cf319f0fd2984010592ca1ee588e", - "osquery-usage-metric": "4dc4f647d27247c002f56f22742175fe", - "query": "11aaeb7f5f7fa5bb43f25e18ce26e7d9", - "references": "7997cf5a56cc02bdc9c93361bde732b0", - "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", - "search": "db2c00e39b36f40930a3b9fc71c823e1", - "search-session": "c768de003a1212f3d9e51176d118f255", - "search-telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "security-rule": "8ae39a88fc70af3375b7050e8d8d5cc7", - "security-solution-signals-migration": "72761fd374ca11122ac8025a92b84fca", - "siem-detection-engine-rule-actions": "6569b288c169539db10cb262bf79de18", - "siem-detection-engine-rule-status": "ae783f41c6937db6b7a2ef5c93a9e9b0", - "siem-ui-timeline": "3e97beae13cdfc6d62bc1846119f7276", - "siem-ui-timeline-note": "8874706eedc49059d4cf0f5094559084", - "siem-ui-timeline-pinned-event": "20638091112f0e14f0e443d512301c29", - "space": "c5ca8acafa0beaa4d08d014a97b6bc6b", - "spaces-usage-stats": "3d1b76c39bfb2cc8296b024d73854724", - "tag": "83d55da58f6530f7055415717ec06474", - "timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", - "type": "2f4316de49999235636386fe51dc06c1", - "ui-counter": "0d409297dc5ebe1e3a1da691c6ee32e3", - "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", - "updated_at": "00da57df13e94e9d98437d13ace4bfe0", - "upgrade-assistant-ml-upgrade-operation": "ece1011519ca8fd057364605744d75ac", - "upgrade-assistant-reindex-operation": "215107c281839ea9b3ad5f6419819763", - "upgrade-assistant-telemetry": "8169c8bdd753da18d887e038aeb5cbc4", - "uptime-dynamic-settings": "3d1b76c39bfb2cc8296b024d73854724", - "url": "c7f66a0df8b1b52f17c28c4adb111105", - "usage-counters": "8cc260bdceffec4ffc3ad165c97dc1b4", - "visualization": "f819cf6636b75c9e76ba733a0c6ef355", - "workplace_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724" - } - }, - "dynamic": "strict", - "properties": { - "action": { - "properties": { - "actionTypeId": { - "type": "keyword" - }, - "config": { - "enabled": false, - "type": "object" - }, - "isMissingSecrets": { - "type": "boolean" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "secrets": { - "type": "binary" - } - } - }, - "action_task_params": { - "properties": { - "actionId": { - "type": "keyword" - }, - "apiKey": { - "type": "binary" - }, - "params": { - "enabled": false, - "type": "object" - }, - "relatedSavedObjects": { - "enabled": false, - "type": "object" - } - } - }, - "alert": { - "properties": { - "actions": { - "properties": { - "actionRef": { - "type": "keyword" - }, - "actionTypeId": { - "type": "keyword" - }, - "group": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - } - }, - "type": "nested" - }, - "alertTypeId": { - "type": "keyword" - }, - "apiKey": { - "type": "binary" - }, - "apiKeyOwner": { - "type": "keyword" - }, - "consumer": { - "type": "keyword" - }, - "createdAt": { - "type": "date" - }, - "createdBy": { - "type": "keyword" - }, - "enabled": { - "type": "boolean" - }, - "executionStatus": { - "properties": { - "error": { - "properties": { - "message": { - "type": "keyword" - }, - "reason": { - "type": "keyword" - } - } - }, - "lastExecutionDate": { - "type": "date" - }, - "status": { - "type": "keyword" - } - } - }, - "meta": { - "properties": { - "versionApiKeyLastmodified": { - "type": "keyword" - } - } - }, - "muteAll": { - "type": "boolean" - }, - "mutedInstanceIds": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "notifyWhen": { - "type": "keyword" - }, - "params": { - "ignore_above": 4096, - "type": "flattened" - }, - "schedule": { - "properties": { - "interval": { - "type": "keyword" - } - } - }, - "scheduledTaskId": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "throttle": { - "type": "keyword" - }, - "updatedAt": { - "type": "date" - }, - "updatedBy": { - "type": "keyword" - } - } - }, - "api_key_pending_invalidation": { - "properties": { - "apiKeyId": { - "type": "keyword" - }, - "createdAt": { - "type": "date" - } - } - }, - "apm-indices": { - "properties": { - "apm_oss": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } - }, - "apm-server-schema": { - "properties": { - "schemaJson": { - "index": false, - "type": "text" - } - } - }, - "apm-telemetry": { - "dynamic": "false", - "type": "object" - }, - "app_search_telemetry": { - "dynamic": "false", - "type": "object" - }, - "application_usage_daily": { - "dynamic": "false", - "properties": { - "timestamp": { - "type": "date" - } - } - }, - "application_usage_totals": { - "dynamic": "false", - "type": "object" - }, - "application_usage_transactional": { - "dynamic": "false", - "type": "object" - }, - "canvas-element": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "content": { - "type": "text" - }, - "help": { - "type": "text" - }, - "image": { - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "canvas-workpad": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "canvas-workpad-template": { - "dynamic": "false", - "properties": { - "help": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "tags": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "template_key": { - "type": "keyword" - } - } - }, - "cases": { - "properties": { - "closed_at": { - "type": "date" - }, - "closed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "connector": { - "properties": { - "fields": { - "properties": { - "key": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "id": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "description": { - "type": "text" - }, - "external_service": { - "properties": { - "connector_id": { - "type": "keyword" - }, - "connector_name": { - "type": "keyword" - }, - "external_id": { - "type": "keyword" - }, - "external_title": { - "type": "text" - }, - "external_url": { - "type": "text" - }, - "pushed_at": { - "type": "date" - }, - "pushed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "owner": { - "type": "keyword" - }, - "settings": { - "properties": { - "syncAlerts": { - "type": "boolean" - } - } - }, - "status": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-comments": { - "properties": { - "actions": { - "properties": { - "targets": { - "properties": { - "endpointId": { - "type": "keyword" - }, - "hostname": { - "type": "keyword" - } - }, - "type": "nested" - }, - "type": { - "type": "keyword" - } - } - }, - "alertId": { - "type": "keyword" - }, - "associationType": { - "type": "keyword" - }, - "comment": { - "type": "text" - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "index": { - "type": "keyword" - }, - "owner": { - "type": "keyword" - }, - "pushed_at": { - "type": "date" - }, - "pushed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "rule": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - } - } - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-configure": { - "properties": { - "closure_type": { - "type": "keyword" - }, - "connector": { - "properties": { - "fields": { - "properties": { - "key": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "id": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "owner": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-connector-mappings": { - "properties": { - "mappings": { - "properties": { - "action_type": { - "type": "keyword" - }, - "source": { - "type": "keyword" - }, - "target": { - "type": "keyword" - } - } - }, - "owner": { - "type": "keyword" - } - } - }, - "cases-user-actions": { - "properties": { - "action": { - "type": "keyword" - }, - "action_at": { - "type": "date" - }, - "action_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "action_field": { - "type": "keyword" - }, - "new_value": { - "type": "text" - }, - "old_value": { - "type": "text" - }, - "owner": { - "type": "keyword" - } - } - }, - "config": { - "dynamic": "false", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "core-usage-stats": { - "dynamic": "false", - "type": "object" - }, - "coreMigrationVersion": { - "type": "keyword" - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "optionsJSON": { - "index": false, - "type": "text" - }, - "panelsJSON": { - "index": false, - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "pause": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "section": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "value": { - "doc_values": false, - "index": false, - "type": "integer" - } - } - }, - "timeFrom": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "timeRestore": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "timeTo": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "endpoint:user-artifact": { - "properties": { - "body": { - "type": "binary" - }, - "compressionAlgorithm": { - "index": false, - "type": "keyword" - }, - "created": { - "index": false, - "type": "date" - }, - "decodedSha256": { - "index": false, - "type": "keyword" - }, - "decodedSize": { - "index": false, - "type": "long" - }, - "encodedSha256": { - "type": "keyword" - }, - "encodedSize": { - "index": false, - "type": "long" - }, - "encryptionAlgorithm": { - "index": false, - "type": "keyword" - }, - "identifier": { - "type": "keyword" - } - } - }, - "endpoint:user-artifact-manifest": { - "properties": { - "artifacts": { - "properties": { - "artifactId": { - "index": false, - "type": "keyword" - }, - "policyId": { - "index": false, - "type": "keyword" - } - }, - "type": "nested" - }, - "created": { - "index": false, - "type": "date" - }, - "schemaVersion": { - "type": "keyword" - }, - "semanticVersion": { - "index": false, - "type": "keyword" - } - } - }, - "enterprise_search_telemetry": { - "dynamic": "false", - "type": "object" - }, - "epm-packages": { - "properties": { - "es_index_patterns": { - "enabled": false, - "type": "object" - }, - "install_source": { - "type": "keyword" - }, - "install_started_at": { - "type": "date" - }, - "install_status": { - "type": "keyword" - }, - "install_version": { - "type": "keyword" - }, - "installed_es": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "installed_kibana": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "internal": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "package_assets": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "removable": { - "type": "boolean" - }, - "version": { - "type": "keyword" - } - } - }, - "epm-packages-assets": { - "properties": { - "asset_path": { - "type": "keyword" - }, - "data_base64": { - "type": "binary" - }, - "data_utf8": { - "index": false, - "type": "text" - }, - "install_source": { - "type": "keyword" - }, - "media_type": { - "type": "keyword" - }, - "package_name": { - "type": "keyword" - }, - "package_version": { - "type": "keyword" - } - } - }, - "event_loop_delays_daily": { - "dynamic": "false", - "properties": { - "lastUpdatedAt": { - "type": "date" - } - } - }, - "exception-list": { - "properties": { - "_tags": { - "type": "keyword" - }, - "comments": { - "properties": { - "comment": { - "type": "keyword" - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "updated_at": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "keyword" - }, - "entries": { - "properties": { - "entries": { - "properties": { - "field": { - "type": "keyword" - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "field": { - "type": "keyword" - }, - "list": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "immutable": { - "type": "boolean" - }, - "item_id": { - "type": "keyword" - }, - "list_id": { - "type": "keyword" - }, - "list_type": { - "type": "keyword" - }, - "meta": { - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "os_types": { - "type": "keyword" - }, - "tags": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "tie_breaker_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "exception-list-agnostic": { - "properties": { - "_tags": { - "type": "keyword" - }, - "comments": { - "properties": { - "comment": { - "type": "keyword" - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "updated_at": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "keyword" - }, - "entries": { - "properties": { - "entries": { - "properties": { - "field": { - "type": "keyword" - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "field": { - "type": "keyword" - }, - "list": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "immutable": { - "type": "boolean" - }, - "item_id": { - "type": "keyword" - }, - "list_id": { - "type": "keyword" - }, - "list_type": { - "type": "keyword" - }, - "meta": { - "type": "keyword" - }, - "name": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "os_types": { - "type": "keyword" - }, - "tags": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - }, - "tie_breaker_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "file-upload-usage-collection-telemetry": { - "properties": { - "file_upload": { - "properties": { - "index_creation_count": { - "type": "long" - } - } - } - } - }, - "fleet-agent-actions": { - "properties": { - "ack_data": { - "type": "text" - }, - "agent_id": { - "type": "keyword" - }, - "created_at": { - "type": "date" - }, - "data": { - "type": "binary" - }, - "policy_id": { - "type": "keyword" - }, - "policy_revision": { - "type": "integer" - }, - "sent_at": { - "type": "date" - }, - "type": { - "type": "keyword" - } - } - }, - "fleet-agents": { - "properties": { - "access_api_key_id": { - "type": "keyword" - }, - "active": { - "type": "boolean" - }, - "current_error_events": { - "index": false, - "type": "text" - }, - "default_api_key": { - "type": "binary" - }, - "default_api_key_id": { - "type": "keyword" - }, - "enrolled_at": { - "type": "date" - }, - "last_checkin": { - "type": "date" - }, - "last_checkin_status": { - "type": "keyword" - }, - "last_updated": { - "type": "date" - }, - "local_metadata": { - "type": "flattened" - }, - "packages": { - "type": "keyword" - }, - "policy_id": { - "type": "keyword" - }, - "policy_revision": { - "type": "integer" - }, - "type": { - "type": "keyword" - }, - "unenrolled_at": { - "type": "date" - }, - "unenrollment_started_at": { - "type": "date" - }, - "updated_at": { - "type": "date" - }, - "upgrade_started_at": { - "type": "date" - }, - "upgraded_at": { - "type": "date" - }, - "user_provided_metadata": { - "type": "flattened" - }, - "version": { - "type": "keyword" - } - } - }, - "fleet-enrollment-api-keys": { - "properties": { - "active": { - "type": "boolean" - }, - "api_key": { - "type": "binary" - }, - "api_key_id": { - "type": "keyword" - }, - "created_at": { - "type": "date" - }, - "expire_at": { - "type": "date" - }, - "name": { - "type": "keyword" - }, - "policy_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - } - } - }, - "fleet-preconfiguration-deletion-record": { - "properties": { - "id": { - "type": "keyword" - } - } - }, - "graph-workspace": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "legacyIndexPatternRef": { - "index": false, - "type": "text" - }, - "numLinks": { - "type": "integer" - }, - "numVertices": { - "type": "integer" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "wsState": { - "type": "text" - } - } - }, - "index-pattern": { - "dynamic": "false", - "properties": { - "title": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "infrastructure-ui-source": { - "dynamic": "false", - "type": "object" - }, - "ingest-agent-policies": { - "properties": { - "description": { - "type": "text" - }, - "is_default": { - "type": "boolean" - }, - "is_default_fleet_server": { - "type": "boolean" - }, - "is_managed": { - "type": "boolean" - }, - "is_preconfigured": { - "type": "keyword" - }, - "monitoring_enabled": { - "index": false, - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "namespace": { - "type": "keyword" - }, - "package_policies": { - "type": "keyword" - }, - "revision": { - "type": "integer" - }, - "status": { - "type": "keyword" - }, - "unenroll_timeout": { - "type": "integer" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "ingest-outputs": { - "properties": { - "ca_sha256": { - "index": false, - "type": "keyword" - }, - "config": { - "type": "flattened" - }, - "config_yaml": { - "type": "text" - }, - "hosts": { - "type": "keyword" - }, - "is_default": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "ingest-package-policies": { - "properties": { - "created_at": { - "type": "date" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "enabled": { - "type": "boolean" - }, - "inputs": { - "enabled": false, - "properties": { - "compiled_input": { - "type": "flattened" - }, - "config": { - "type": "flattened" - }, - "enabled": { - "type": "boolean" - }, - "policy_template": { - "type": "keyword" - }, - "streams": { - "properties": { - "compiled_stream": { - "type": "flattened" - }, - "config": { - "type": "flattened" - }, - "data_stream": { - "properties": { - "dataset": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "enabled": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "vars": { - "type": "flattened" - } - }, - "type": "nested" - }, - "type": { - "type": "keyword" - }, - "vars": { - "type": "flattened" - } - }, - "type": "nested" - }, - "name": { - "type": "keyword" - }, - "namespace": { - "type": "keyword" - }, - "output_id": { - "type": "keyword" - }, - "package": { - "properties": { - "name": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "policy_id": { - "type": "keyword" - }, - "revision": { - "type": "integer" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "type": "keyword" - }, - "vars": { - "type": "flattened" - } - } - }, - "ingest_manager_settings": { - "properties": { - "fleet_server_hosts": { - "type": "keyword" - }, - "has_seen_add_data_notice": { - "index": false, - "type": "boolean" - }, - "has_seen_fleet_migration_notice": { - "index": false, - "type": "boolean" - } - } - }, - "inventory-view": { - "dynamic": "false", - "type": "object" - }, - "kql-telemetry": { - "properties": { - "optInCount": { - "type": "long" - }, - "optOutCount": { - "type": "long" - } - } - }, - "legacy-url-alias": { - "dynamic": "false", - "properties": { - "disabled": { - "type": "boolean" - }, - "resolveCounter": { - "type": "long" - }, - "sourceId": { - "type": "keyword" - }, - "targetType": { - "type": "keyword" - } - } - }, - "lens": { - "properties": { - "description": { - "type": "text" - }, - "expression": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "state": { - "type": "flattened" - }, - "title": { - "type": "text" - }, - "visualizationType": { - "type": "keyword" - } - } - }, - "lens-ui-telemetry": { - "properties": { - "count": { - "type": "integer" - }, - "date": { - "type": "date" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "map": { - "properties": { - "bounds": { - "dynamic": "false", - "type": "object" - }, - "description": { - "type": "text" - }, - "layerListJSON": { - "type": "text" - }, - "mapStateJSON": { - "type": "text" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "maps-telemetry": { - "enabled": false, - "type": "object" - }, - "metrics-explorer-view": { - "dynamic": "false", - "type": "object" - }, - "migrationVersion": { - "dynamic": "true", - "properties": { - "action": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "alert": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "canvas-workpad": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "cases": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "cases-user-actions": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "config": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "core-usage-stats": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "dashboard": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "endpoint:user-artifact-manifest": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "exception-list-agnostic": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "fleet-agent-actions": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "graph-workspace": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "index-pattern": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "infrastructure-ui-source": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "ingest-agent-policies": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "ingest-outputs": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "ingest-package-policies": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "ingest_manager_settings": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "lens": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "map": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "ml-job": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "ml-module": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "search": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "search-session": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "search-telemetry": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "siem-detection-engine-rule-actions": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "space": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "spaces-usage-stats": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "visualization": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "ml-job": { - "properties": { - "datafeed_id": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "job_id": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "ml-module": { - "dynamic": "false", - "properties": { - "datafeeds": { - "type": "object" - }, - "defaultIndexPattern": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "description": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "id": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "jobs": { - "type": "object" - }, - "logo": { - "type": "object" - }, - "query": { - "type": "object" - }, - "title": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "type": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "monitoring-telemetry": { - "properties": { - "reportedClusterUuids": { - "type": "keyword" - } - } - }, - "namespace": { - "type": "keyword" - }, - "namespaces": { - "type": "keyword" - }, - "originId": { - "type": "keyword" - }, - "osquery-saved-query": { - "properties": { - "created_at": { - "type": "date" - }, - "created_by": { - "type": "text" - }, - "description": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "interval": { - "type": "keyword" - }, - "platform": { - "type": "keyword" - }, - "query": { - "type": "text" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "type": "text" - }, - "version": { - "type": "keyword" - } - } - }, - "osquery-usage-metric": { - "properties": { - "count": { - "type": "long" - }, - "errors": { - "type": "long" - } - } - }, - "query": { - "properties": { - "description": { - "type": "text" - }, - "filters": { - "enabled": false, - "type": "object" - }, - "query": { - "properties": { - "language": { - "type": "keyword" - }, - "query": { - "index": false, - "type": "keyword" - } - } - }, - "timefilter": { - "enabled": false, - "type": "object" - }, - "title": { - "type": "text" - } - } - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "sample-data-telemetry": { - "properties": { - "installCount": { - "type": "long" - }, - "unInstallCount": { - "type": "long" - } - } - }, - "search": { - "properties": { - "columns": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "description": { - "type": "text" - }, - "grid": { - "enabled": false, - "type": "object" - }, - "hideChart": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "hits": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "sort": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "search-session": { - "properties": { - "appId": { - "type": "keyword" - }, - "completed": { - "type": "date" - }, - "created": { - "type": "date" - }, - "expires": { - "type": "date" - }, - "idMapping": { - "enabled": false, - "type": "object" - }, - "initialState": { - "enabled": false, - "type": "object" - }, - "name": { - "type": "keyword" - }, - "persisted": { - "type": "boolean" - }, - "realmName": { - "type": "keyword" - }, - "realmType": { - "type": "keyword" - }, - "restoreState": { - "enabled": false, - "type": "object" - }, - "sessionId": { - "type": "keyword" - }, - "status": { - "type": "keyword" - }, - "touched": { - "type": "date" - }, - "urlGeneratorId": { - "type": "keyword" - }, - "username": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "search-telemetry": { - "dynamic": "false", - "type": "object" - }, - "security-rule": { - "dynamic": "false", - "properties": { - "name": { - "type": "keyword" - }, - "rule_id": { - "type": "keyword" - }, - "version": { - "type": "long" - } - } - }, - "security-solution-signals-migration": { - "properties": { - "created": { - "index": false, - "type": "date" - }, - "createdBy": { - "index": false, - "type": "text" - }, - "destinationIndex": { - "index": false, - "type": "keyword" - }, - "error": { - "index": false, - "type": "text" - }, - "sourceIndex": { - "type": "keyword" - }, - "status": { - "index": false, - "type": "keyword" - }, - "taskId": { - "index": false, - "type": "keyword" - }, - "updated": { - "index": false, - "type": "date" - }, - "updatedBy": { - "index": false, - "type": "text" - }, - "version": { - "type": "long" - } - } - }, - "siem-detection-engine-rule-actions": { - "properties": { - "actions": { - "properties": { - "action_type_id": { - "type": "keyword" - }, - "group": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - } - } - }, - "alertThrottle": { - "type": "keyword" - }, - "ruleAlertId": { - "type": "keyword" - }, - "ruleThrottle": { - "type": "keyword" - } - } - }, - "siem-detection-engine-rule-status": { - "properties": { - "alertId": { - "type": "keyword" - }, - "bulkCreateTimeDurations": { - "type": "float" - }, - "gap": { - "type": "text" - }, - "lastFailureAt": { - "type": "date" - }, - "lastFailureMessage": { - "type": "text" - }, - "lastLookBackDate": { - "type": "date" - }, - "lastSuccessAt": { - "type": "date" - }, - "lastSuccessMessage": { - "type": "text" - }, - "searchAfterTimeDurations": { - "type": "float" - }, - "status": { - "type": "keyword" - }, - "statusDate": { - "type": "date" - } - } - }, - "siem-ui-timeline": { - "properties": { - "columns": { - "properties": { - "aggregatable": { - "type": "boolean" - }, - "category": { - "type": "keyword" - }, - "columnHeaderType": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "example": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "indexes": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "placeholder": { - "type": "text" - }, - "searchable": { - "type": "boolean" - }, - "type": { - "type": "keyword" - } - } - }, - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "dataProviders": { - "properties": { - "and": { - "properties": { - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "type": { - "type": "text" - } - } - }, - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "type": { - "type": "text" - } - } - }, - "dateRange": { - "properties": { - "end": { - "type": "date" - }, - "start": { - "type": "date" - } - } - }, - "description": { - "type": "text" - }, - "eqlOptions": { - "properties": { - "eventCategoryField": { - "type": "text" - }, - "query": { - "type": "text" - }, - "size": { - "type": "text" - }, - "tiebreakerField": { - "type": "text" - }, - "timestampField": { - "type": "text" - } - } - }, - "eventType": { - "type": "keyword" - }, - "excludedRowRendererIds": { - "type": "text" - }, - "favorite": { - "properties": { - "favoriteDate": { - "type": "date" - }, - "fullName": { - "type": "text" - }, - "keySearch": { - "type": "text" - }, - "userName": { - "type": "text" - } - } - }, - "filters": { - "properties": { - "exists": { - "type": "text" - }, - "match_all": { - "type": "text" - }, - "meta": { - "properties": { - "alias": { - "type": "text" - }, - "controlledBy": { - "type": "text" - }, - "disabled": { - "type": "boolean" - }, - "field": { - "type": "text" - }, - "formattedValue": { - "type": "text" - }, - "index": { - "type": "keyword" - }, - "key": { - "type": "keyword" - }, - "negate": { - "type": "boolean" - }, - "params": { - "type": "text" - }, - "type": { - "type": "keyword" - }, - "value": { - "type": "text" - } - } - }, - "missing": { - "type": "text" - }, - "query": { - "type": "text" - }, - "range": { - "type": "text" - }, - "script": { - "type": "text" - } - } - }, - "indexNames": { - "type": "text" - }, - "kqlMode": { - "type": "keyword" - }, - "kqlQuery": { - "properties": { - "filterQuery": { - "properties": { - "kuery": { - "properties": { - "expression": { - "type": "text" - }, - "kind": { - "type": "keyword" - } - } - }, - "serializedQuery": { - "type": "text" - } - } - } - } - }, - "savedQueryId": { - "type": "keyword" - }, - "sort": { - "dynamic": "false", - "properties": { - "columnId": { - "type": "keyword" - }, - "columnType": { - "type": "keyword" - }, - "sortDirection": { - "type": "keyword" - } - } - }, - "status": { - "type": "keyword" - }, - "templateTimelineId": { - "type": "text" - }, - "templateTimelineVersion": { - "type": "integer" - }, - "timelineType": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-note": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "note": { - "type": "text" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-pinned-event": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "space": { - "properties": { - "_reserved": { - "type": "boolean" - }, - "color": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "disabledFeatures": { - "type": "keyword" - }, - "imageUrl": { - "index": false, - "type": "text" - }, - "initials": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "spaces-usage-stats": { - "dynamic": "false", - "type": "object" - }, - "tag": { - "properties": { - "color": { - "type": "text" - }, - "description": { - "type": "text" - }, - "name": { - "type": "text" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "type": { - "type": "keyword" - }, - "ui-counter": { - "properties": { - "count": { - "type": "integer" - } - } - }, - "ui-metric": { - "properties": { - "count": { - "type": "integer" - } - } - }, - "updated_at": { - "type": "date" - }, - "upgrade-assistant-ml-upgrade-operation": { - "properties": { - "jobId": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "nodeId": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "snapshotId": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "status": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "upgrade-assistant-reindex-operation": { - "properties": { - "errorMessage": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "indexName": { - "type": "keyword" - }, - "lastCompletedStep": { - "type": "long" - }, - "locked": { - "type": "date" - }, - "newIndexName": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "reindexOptions": { - "properties": { - "openAndClose": { - "type": "boolean" - }, - "queueSettings": { - "properties": { - "queuedAt": { - "type": "long" - }, - "startedAt": { - "type": "long" - } - } - } - } - }, - "reindexTaskId": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "reindexTaskPercComplete": { - "type": "float" - }, - "runningReindexCount": { - "type": "integer" - }, - "status": { - "type": "integer" - } - } - }, - "upgrade-assistant-telemetry": { - "properties": { - "features": { - "properties": { - "deprecation_logging": { - "properties": { - "enabled": { - "null_value": true, - "type": "boolean" - } - } - } - } - }, - "ui_open": { - "properties": { - "cluster": { - "null_value": 0, - "type": "long" - }, - "indices": { - "null_value": 0, - "type": "long" - }, - "kibana": { - "null_value": 0, - "type": "long" - }, - "overview": { - "null_value": 0, - "type": "long" - } - } - }, - "ui_reindex": { - "properties": { - "close": { - "null_value": 0, - "type": "long" - }, - "open": { - "null_value": 0, - "type": "long" - }, - "start": { - "null_value": 0, - "type": "long" - }, - "stop": { - "null_value": 0, - "type": "long" - } - } - } - } - }, - "uptime-dynamic-settings": { - "dynamic": "false", - "type": "object" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "usage-counters": { - "dynamic": "false", - "properties": { - "domainId": { - "type": "keyword" - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "savedSearchRefName": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "index": false, - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "index": false, - "type": "text" - } - } - }, - "workplace_search_telemetry": { - "dynamic": "false", - "type": "object" - } - } - }, - "settings": { - "index": { - "auto_expand_replicas": "0-1", - "number_of_replicas": "1", - "number_of_shards": "1", - "priority": "10", - "refresh_interval": "1s" - } - } - } -} - -{ - "type": "index", - "value": { - "aliases": { - ".ml-anomalies-.write-apm-production-802c-high_mean_transaction_duration": { + ".ml-anomalies-.write-apm-environment_not_defined-337d-high_mean_transaction_duration": { "is_hidden": true }, - ".ml-anomalies-.write-apm-production-d08f-high_mean_transaction_duration": { + ".ml-anomalies-.write-apm-production-6117-high_mean_transaction_duration": { "is_hidden": true }, - ".ml-anomalies-.write-high_sum_total_sales": { + ".ml-anomalies-.write-apm-testing-41e5-high_mean_transaction_duration": { "is_hidden": true }, - ".ml-anomalies-apm-production-802c-high_mean_transaction_duration": { + ".ml-anomalies-apm-environment_not_defined-337d-high_mean_transaction_duration": { "filter": { "term": { "job_id": { "boost": 1, - "value": "apm-production-802c-high_mean_transaction_duration" + "value": "apm-environment_not_defined-337d-high_mean_transaction_duration" } } }, "is_hidden": true }, - ".ml-anomalies-apm-production-d08f-high_mean_transaction_duration": { + ".ml-anomalies-apm-production-6117-high_mean_transaction_duration": { "filter": { "term": { "job_id": { "boost": 1, - "value": "apm-production-d08f-high_mean_transaction_duration" + "value": "apm-production-6117-high_mean_transaction_duration" } } }, "is_hidden": true }, - ".ml-anomalies-high_sum_total_sales": { + ".ml-anomalies-apm-testing-41e5-high_mean_transaction_duration": { "filter": { "term": { "job_id": { "boost": 1, - "value": "high_sum_total_sales" + "value": "apm-testing-41e5-high_mean_transaction_duration" } } }, @@ -3229,7 +48,7 @@ "index": ".ml-anomalies-shared", "mappings": { "_meta": { - "version": "8.0.0" + "version": "7.14.0" }, "dynamic_templates": [ { @@ -3317,13 +136,6 @@ "categorized_doc_count": { "type": "keyword" }, - "category": { - "properties": { - "keyword": { - "type": "keyword" - } - } - }, "category_id": { "type": "long" }, @@ -3393,13 +205,6 @@ }, "type": "nested" }, - "customer_full_name": { - "properties": { - "keyword": { - "type": "keyword" - } - } - }, "dead_category_count": { "type": "keyword" }, @@ -3809,9 +614,6 @@ "settings": { "index": { "auto_expand_replicas": "0-1", - "blocks": { - "read_only_allow_delete": "false" - }, "hidden": "true", "number_of_replicas": "1", "number_of_shards": "1", @@ -3831,7 +633,7 @@ "index": ".ml-config", "mappings": { "_meta": { - "version": "8.0.0" + "version": "7.14.0" }, "dynamic_templates": [ { @@ -4321,6 +1123,9 @@ "settings": { "index": { "auto_expand_replicas": "0-1", + "blocks": { + "read_only_allow_delete": "false" + }, "max_result_window": "10000", "number_of_replicas": "1", "number_of_shards": "1" @@ -4333,15 +1138,15 @@ "type": "index", "value": { "aliases": { - "apm-8.0.0-error": { + "apm-7.14.0-error": { "is_write_index": true } }, - "index": "apm-8.0.0-error-000002", + "index": "apm-7.14.0-error-000001", "mappings": { "_meta": { "beat": "apm", - "version": "8.0.0" + "version": "7.14.0" }, "date_detection": false, "dynamic_templates": [ @@ -4487,8 +1292,8 @@ "type": "keyword" }, "hostname": { - "path": "agent.name", - "type": "alias" + "ignore_above": 1024, + "type": "keyword" }, "id": { "ignore_above": 1024, @@ -6260,58 +3065,24 @@ "labels": { "dynamic": "true", "properties": { - "city": { - "type": "keyword" - }, "company": { "type": "keyword" }, - "country_code": { - "type": "keyword" - }, - "customerId": { - "type": "keyword" - }, "customer_tier": { "type": "keyword" }, "foo": { "type": "keyword" }, - "git_rev": { - "type": "keyword" - }, - "in_eu": { - "type": "boolean" - }, - "ip": { - "type": "keyword" - }, - "lang": { - "type": "keyword" - }, "lorem": { "type": "keyword" }, "multi-line": { "type": "keyword" }, - "orderPrice": { - "scaling_factor": 1000000, - "type": "scaled_float" - }, - "orderPriceRange": { - "type": "keyword" - }, - "plugin": { - "type": "keyword" - }, "request_id": { "type": "keyword" }, - "shippingCountry": { - "type": "keyword" - }, "this-is-a-very-long-tag-name-without-any-spaces": { "type": "keyword" } @@ -9437,13 +6208,14 @@ }, "settings": { "index": { + "auto_expand_replicas": "0-1", "blocks": { "read_only_allow_delete": "false" }, "codec": "best_compression", "lifecycle": { "name": "apm-rollover-30-days", - "rollover_alias": "apm-8.0.0-error" + "rollover_alias": "apm-7.14.0-error" }, "mapping": { "total_fields": { @@ -9453,6 +6225,7 @@ "max_docvalue_fields_search": "200", "number_of_replicas": "1", "number_of_shards": "1", + "priority": "100", "refresh_interval": "5s" } } @@ -9463,15 +6236,15 @@ "type": "index", "value": { "aliases": { - "apm-8.0.0-metric": { + "apm-7.14.0-metric": { "is_write_index": true } }, - "index": "apm-8.0.0-metric-000002", + "index": "apm-7.14.0-metric-000001", "mappings": { "_meta": { "beat": "apm", - "version": "8.0.0" + "version": "7.14.0" }, "date_detection": false, "dynamic_templates": [ @@ -9617,8 +6390,8 @@ "type": "keyword" }, "hostname": { - "path": "agent.name", - "type": "alias" + "ignore_above": 1024, + "type": "keyword" }, "id": { "ignore_above": 1024, @@ -9641,9 +6414,6 @@ "agent_config_applied": { "type": "long" }, - "antifraud_order_check": { - "type": "long" - }, "as": { "properties": { "number": { @@ -9665,18 +6435,6 @@ } } }, - "cache_evictions": { - "type": "long" - }, - "cache_gets": { - "type": "long" - }, - "cache_puts": { - "type": "long" - }, - "cache_size": { - "type": "long" - }, "child": { "dynamic": "false", "properties": { @@ -9960,13 +6718,13 @@ "type": "float" }, "gen2size": { - "type": "float" + "type": "long" }, "gen3size": { "type": "float" }, "time": { - "type": "long" + "type": "float" } } } @@ -10956,13 +7714,13 @@ "type": "float" }, "frees": { - "type": "float" + "type": "long" }, "idle": { "type": "float" }, "mallocs": { - "type": "float" + "type": "long" }, "objects": { "type": "long" @@ -11044,71 +7802,11 @@ }, "sha512": { "ignore_above": 1024, - "type": "keyword" - }, - "ssdeep": { - "ignore_above": 1024, - "type": "keyword" - } - } - }, - "hikaricp_connections_acquire": { - "properties": { - "count": { - "type": "long" - }, - "sum": { - "properties": { - "us": { - "type": "long" - } - } - } - } - }, - "hikaricp_connections_active": { - "type": "long" - }, - "hikaricp_connections_creation": { - "properties": { - "count": { - "type": "long" - }, - "sum": { - "properties": { - "us": { - "type": "long" - } - } - } - } - }, - "hikaricp_connections_idle": { - "type": "long" - }, - "hikaricp_connections_max": { - "type": "long" - }, - "hikaricp_connections_min": { - "type": "long" - }, - "hikaricp_connections_pending": { - "type": "long" - }, - "hikaricp_connections_timeout": { - "type": "long" - }, - "hikaricp_connections_usage": { - "properties": { - "count": { - "type": "long" + "type": "keyword" }, - "sum": { - "properties": { - "us": { - "type": "float" - } - } + "ssdeep": { + "ignore_above": 1024, + "type": "keyword" } } }, @@ -11454,20 +8152,6 @@ } } }, - "http_server_requests": { - "properties": { - "count": { - "type": "long" - }, - "sum": { - "properties": { - "us": { - "type": "float" - } - } - } - } - }, "interface": { "properties": { "alias": { @@ -11484,18 +8168,6 @@ } } }, - "jdbc_connections_active": { - "type": "long" - }, - "jdbc_connections_idle": { - "type": "long" - }, - "jdbc_connections_max": { - "type": "long" - }, - "jdbc_connections_min": { - "type": "long" - }, "jvm": { "properties": { "gc": { @@ -11563,68 +8235,6 @@ } } }, - "jvm_buffer_count": { - "type": "long" - }, - "jvm_buffer_memory_used": { - "type": "long" - }, - "jvm_buffer_total_capacity": { - "type": "long" - }, - "jvm_classes_loaded": { - "type": "long" - }, - "jvm_classes_unloaded": { - "type": "long" - }, - "jvm_gc_live_data_size": { - "type": "long" - }, - "jvm_gc_max_data_size": { - "type": "float" - }, - "jvm_gc_memory_allocated": { - "type": "float" - }, - "jvm_gc_memory_promoted": { - "type": "float" - }, - "jvm_gc_pause": { - "properties": { - "count": { - "type": "long" - }, - "sum": { - "properties": { - "us": { - "type": "long" - } - } - } - } - }, - "jvm_memory_committed": { - "type": "float" - }, - "jvm_memory_max": { - "type": "float" - }, - "jvm_memory_used": { - "type": "float" - }, - "jvm_threads_daemon": { - "type": "long" - }, - "jvm_threads_live": { - "type": "long" - }, - "jvm_threads_peak": { - "type": "long" - }, - "jvm_threads_states": { - "type": "long" - }, "kubernetes": { "dynamic": "false", "properties": { @@ -11724,75 +8334,27 @@ "a": { "type": "keyword" }, - "action": { - "type": "keyword" - }, - "antifraud_order_check_price_range": { - "type": "keyword" - }, - "antifraud_order_check_shipping_country": { - "type": "keyword" - }, - "antifraud_order_check_success": { - "type": "keyword" - }, - "area": { - "type": "keyword" - }, - "cache": { - "type": "keyword" - }, - "cause": { - "type": "keyword" - }, "charset": { "type": "keyword" }, - "city": { - "type": "keyword" - }, "connection": { "type": "keyword" }, - "country_code": { - "type": "keyword" - }, "env": { "type": "keyword" }, "etag": { "type": "keyword" }, - "exception": { - "type": "keyword" - }, "generation": { "type": "keyword" }, - "git_rev": { - "type": "keyword" - }, "hostname": { "type": "keyword" }, - "id": { - "type": "keyword" - }, "implementation": { "type": "keyword" }, - "in_eu": { - "type": "boolean" - }, - "ip": { - "type": "keyword" - }, - "lang": { - "type": "keyword" - }, - "level": { - "type": "keyword" - }, "major": { "type": "keyword" }, @@ -11805,24 +8367,9 @@ "name": { "type": "keyword" }, - "outcome": { - "type": "keyword" - }, "patchlevel": { "type": "keyword" }, - "pool": { - "type": "keyword" - }, - "result": { - "type": "keyword" - }, - "shipping_country": { - "type": "keyword" - }, - "state": { - "type": "keyword" - }, "status": { "type": "keyword" }, @@ -11832,12 +8379,6 @@ "type": { "type": "keyword" }, - "u": { - "type": "keyword" - }, - "uri": { - "type": "keyword" - }, "version": { "type": "keyword" }, @@ -11919,9 +8460,6 @@ } } }, - "logback_events": { - "type": "long" - }, "message": { "norms": false, "type": "text" @@ -12047,7 +8585,7 @@ "avg": { "properties": { "ms": { - "type": "float" + "type": "long" } } } @@ -12067,7 +8605,7 @@ "arrayBuffers": { "properties": { "bytes": { - "type": "float" + "type": "long" } } }, @@ -12365,32 +8903,6 @@ } } }, - "order": { - "properties": { - "count": { - "type": "long" - }, - "sum": { - "type": "long" - } - } - }, - "order_count_counter": { - "type": "long" - }, - "order_per_country": { - "properties": { - "count": { - "type": "long" - }, - "sum": { - "type": "long" - } - } - }, - "order_value_counter": { - "type": "long" - }, "organization": { "properties": { "id": { @@ -12901,21 +9413,6 @@ } } }, - "process_cpu_usage": { - "type": "float" - }, - "process_files_max": { - "type": "long" - }, - "process_files_open": { - "type": "long" - }, - "process_start_time": { - "type": "float" - }, - "process_uptime": { - "type": "float" - }, "processor": { "properties": { "event": { @@ -13222,7 +9719,7 @@ "allocations": { "properties": { "total": { - "type": "float" + "type": "long" } } }, @@ -14123,15 +10620,6 @@ } } }, - "system_cpu_count": { - "type": "long" - }, - "system_cpu_usage": { - "type": "float" - }, - "system_load_average_1m": { - "type": "float" - }, "tags": { "ignore_above": 1024, "type": "keyword" @@ -14559,24 +11047,6 @@ } } }, - "tomcat_sessions_active_current": { - "type": "long" - }, - "tomcat_sessions_active_max": { - "type": "long" - }, - "tomcat_sessions_alive_max": { - "type": "long" - }, - "tomcat_sessions_created": { - "type": "long" - }, - "tomcat_sessions_expired": { - "type": "long" - }, - "tomcat_sessions_rejected": { - "type": "long" - }, "trace": { "dynamic": "false", "properties": { @@ -15289,13 +11759,14 @@ }, "settings": { "index": { + "auto_expand_replicas": "0-1", "blocks": { "read_only_allow_delete": "false" }, "codec": "best_compression", "lifecycle": { "name": "apm-rollover-30-days", - "rollover_alias": "apm-8.0.0-metric" + "rollover_alias": "apm-7.14.0-metric" }, "mapping": { "total_fields": { @@ -15305,6 +11776,7 @@ "max_docvalue_fields_search": "200", "number_of_replicas": "1", "number_of_shards": "1", + "priority": "100", "refresh_interval": "5s" } } @@ -15315,15 +11787,15 @@ "type": "index", "value": { "aliases": { - "apm-8.0.0-span": { + "apm-7.14.0-span": { "is_write_index": true } }, - "index": "apm-8.0.0-span-000008", + "index": "apm-7.14.0-span-000001", "mappings": { "_meta": { "beat": "apm", - "version": "8.0.0" + "version": "7.14.0" }, "date_detection": false, "dynamic_templates": [ @@ -15469,8 +11941,8 @@ "type": "keyword" }, "hostname": { - "path": "agent.name", - "type": "alias" + "ignore_above": 1024, + "type": "keyword" }, "id": { "ignore_above": 1024, @@ -17242,12 +13714,6 @@ "labels": { "dynamic": "true", "properties": { - "city": { - "type": "keyword" - }, - "country_code": { - "type": "keyword" - }, "events_encoded": { "scaling_factor": 1000000, "type": "scaled_float" @@ -17267,21 +13733,6 @@ "foo": { "type": "keyword" }, - "git_rev": { - "type": "keyword" - }, - "in_eu": { - "type": "boolean" - }, - "ip": { - "type": "keyword" - }, - "lang": { - "type": "keyword" - }, - "plugin": { - "type": "keyword" - }, "productId": { "type": "keyword" } @@ -18939,25 +15390,6 @@ "ignore_above": 1024, "type": "keyword" }, - "composite": { - "dynamic": "false", - "properties": { - "compression_strategy": { - "ignore_above": 1024, - "type": "keyword" - }, - "count": { - "type": "long" - }, - "sum": { - "properties": { - "us": { - "type": "long" - } - } - } - } - }, "db": { "dynamic": "false", "properties": { @@ -20426,10 +16858,14 @@ }, "settings": { "index": { + "auto_expand_replicas": "0-1", + "blocks": { + "read_only_allow_delete": "false" + }, "codec": "best_compression", "lifecycle": { "name": "apm-rollover-30-days", - "rollover_alias": "apm-8.0.0-span" + "rollover_alias": "apm-7.14.0-span" }, "mapping": { "total_fields": { @@ -20439,6 +16875,7 @@ "max_docvalue_fields_search": "200", "number_of_replicas": "1", "number_of_shards": "1", + "priority": "100", "refresh_interval": "5s" } } @@ -20449,15 +16886,15 @@ "type": "index", "value": { "aliases": { - "apm-8.0.0-transaction": { + "apm-7.14.0-transaction": { "is_write_index": true } }, - "index": "apm-8.0.0-transaction-000002", + "index": "apm-7.14.0-transaction-000001", "mappings": { "_meta": { "beat": "apm", - "version": "8.0.0" + "version": "7.14.0" }, "date_detection": false, "dynamic_templates": [ @@ -20603,8 +17040,8 @@ "type": "keyword" }, "hostname": { - "path": "agent.name", - "type": "alias" + "ignore_above": 1024, + "type": "keyword" }, "id": { "ignore_above": 1024, @@ -22376,15 +18813,9 @@ "labels": { "dynamic": "true", "properties": { - "city": { - "type": "keyword" - }, "company": { "type": "keyword" }, - "country_code": { - "type": "keyword" - }, "customer_email": { "type": "keyword" }, @@ -22397,40 +18828,18 @@ "foo": { "type": "keyword" }, - "git_rev": { - "type": "keyword" - }, - "in_eu": { - "type": "boolean" - }, - "ip": { - "type": "keyword" - }, - "lang": { - "type": "keyword" - }, "lorem": { "type": "keyword" }, "multi-line": { "type": "keyword" }, - "plugin": { - "type": "keyword" - }, "request_id": { "type": "keyword" }, "served_from_cache": { "type": "keyword" }, - "session_id": { - "type": "keyword" - }, - "session_seq": { - "scaling_factor": 1000000, - "type": "scaled_float" - }, "this-is-a-very-long-tag-name-without-any-spaces": { "type": "keyword" }, @@ -24091,25 +20500,6 @@ "ignore_above": 1024, "type": "keyword" }, - "composite": { - "dynamic": "false", - "properties": { - "compression_strategy": { - "ignore_above": 1024, - "type": "keyword" - }, - "count": { - "type": "long" - }, - "sum": { - "properties": { - "us": { - "type": "long" - } - } - } - } - }, "db": { "dynamic": "false", "properties": { @@ -24964,14 +21354,6 @@ "scaling_factor": 1000000, "type": "scaled_float" }, - "firstContentfulPaint": { - "scaling_factor": 1000000, - "type": "scaled_float" - }, - "largestContentfulPaint": { - "scaling_factor": 1000000, - "type": "scaled_float" - }, "timeToFirstByte": { "scaling_factor": 1000000, "type": "scaled_float" @@ -25666,10 +22048,14 @@ }, "settings": { "index": { + "auto_expand_replicas": "0-1", + "blocks": { + "read_only_allow_delete": "false" + }, "codec": "best_compression", "lifecycle": { "name": "apm-rollover-30-days", - "rollover_alias": "apm-8.0.0-transaction" + "rollover_alias": "apm-7.14.0-transaction" }, "mapping": { "total_fields": { @@ -25679,6 +22065,7 @@ "max_docvalue_fields_search": "200", "number_of_replicas": "1", "number_of_shards": "1", + "priority": "100", "refresh_interval": "5s" } } diff --git a/x-pack/test/apm_api_integration/common/fixtures/es_archiver/archives_metadata.ts b/x-pack/test/apm_api_integration/common/fixtures/es_archiver/archives_metadata.ts index efb0af05668eb..3382f0f8ee460 100644 --- a/x-pack/test/apm_api_integration/common/fixtures/es_archiver/archives_metadata.ts +++ b/x-pack/test/apm_api_integration/common/fixtures/es_archiver/archives_metadata.ts @@ -8,7 +8,7 @@ /* eslint-disable-next-line*/ export default { 'apm_8.0.0': { - start: '2021-07-27T08:08:11.069Z', - end: '2021-07-27T08:38:11.069Z', + start: '2021-08-03T06:50:15.910Z', + end: '2021-08-03T07:20:15.910Z', }, }; diff --git a/x-pack/test/apm_api_integration/common/registry.ts b/x-pack/test/apm_api_integration/common/registry.ts index 13cafcffe3af4..0f0af0bda6ab8 100644 --- a/x-pack/test/apm_api_integration/common/registry.ts +++ b/x-pack/test/apm_api_integration/common/registry.ts @@ -109,6 +109,9 @@ export const registry = { running = true; const esArchiver = context.getService('esArchiver'); const logger = context.getService('log'); + + const supertest = context.getService('supertestAsApmWriteUser'); + const logWithTimer = () => { const start = process.hrtime(); @@ -148,6 +151,9 @@ export const registry = { archiveName ) ); + + // sync jobs from .ml-config to .kibana SOs + await supertest.get('/api/ml/saved_objects/sync').set('kbn-xsrf', 'foo'); } if (condition.archives.length) { log('Loaded all archives'); diff --git a/x-pack/test/apm_api_integration/tests/correlations/errors_failed_transactions.ts b/x-pack/test/apm_api_integration/tests/correlations/errors_failed_transactions.ts index 93196baadbd98..0f203a03b7b70 100644 --- a/x-pack/test/apm_api_integration/tests/correlations/errors_failed_transactions.ts +++ b/x-pack/test/apm_api_integration/tests/correlations/errors_failed_transactions.ts @@ -64,6 +64,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(sortedFieldNames).toMatchInline(` Array [ "user_agent.name", + "user_agent.name", ] `); }); @@ -73,6 +74,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(significantTerms.map((term) => term.timeseries.length)).toMatchInline(` Array [ 31, + 31, ] `); }); diff --git a/x-pack/test/apm_api_integration/tests/correlations/latency_overall.ts b/x-pack/test/apm_api_integration/tests/correlations/latency_overall.ts index 781fef7e6fb34..214cc363a3239 100644 --- a/x-pack/test/apm_api_integration/tests/correlations/latency_overall.ts +++ b/x-pack/test/apm_api_integration/tests/correlations/latency_overall.ts @@ -59,9 +59,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns overall distribution', () => { // less precision for distributionInterval as it is not exact expectSnapshot(response.body?.distributionInterval?.toPrecision(2)).toMatchInline( - `"3.3e+5"` + `"3.8e+5"` ); - expectSnapshot(response.body?.maxLatency?.toPrecision(2)).toMatchInline(`"5.0e+6"`); + expectSnapshot(response.body?.maxLatency?.toPrecision(2)).toMatchInline(`"5.8e+6"`); expectSnapshot(response.body?.overallDistribution?.length).toMatchInline(`15`); }); } diff --git a/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts b/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts index e2251fb28d379..a002996c83174 100644 --- a/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts +++ b/x-pack/test/apm_api_integration/tests/correlations/latency_slow_transactions.ts @@ -66,15 +66,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { const sortedFieldNames = significantTerms.map(({ fieldName }) => fieldName).sort(); expectSnapshot(sortedFieldNames).toMatchInline(` Array [ - "url.original", - "url.original", - "url.original", - "url.original", - "url.original", "url.original", "url.original", "url.original", "user_agent.name", + "user_agent.name", + "user_agent.name", + "user_agent.name", "user_agent.os.name", ] `); @@ -92,8 +90,6 @@ export default function ApiTest({ getService }: FtrProviderContext) { 15, 15, 15, - 15, - 15, ] `); }); diff --git a/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts b/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts index f8012c42526cf..8760b80f5c737 100644 --- a/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts +++ b/x-pack/test/apm_api_integration/tests/observability_overview/observability_overview.ts @@ -52,9 +52,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(response.body.serviceCount).to.be.greaterThan(0); expect(response.body.transactionPerMinute.timeseries.length).to.be.greaterThan(0); - expectSnapshot(response.body.serviceCount).toMatchInline(`10`); + expectSnapshot(response.body.serviceCount).toMatchInline(`8`); - expectSnapshot(response.body.transactionPerMinute.value).toMatchInline(`132.833333333333`); + expectSnapshot(response.body.transactionPerMinute.value).toMatchInline(`58.9`); expectSnapshot(response.body.transactionPerMinute.timeseries.length).toMatchInline(`30`); expectSnapshot( @@ -67,24 +67,24 @@ export default function ApiTest({ getService }: FtrProviderContext) { ).toMatchInline(` Array [ Object { - "x": "2021-07-27T08:08:00.000Z", - "y": 85, + "x": "2021-08-03T06:50:00.000Z", + "y": 36, }, Object { - "x": "2021-07-27T08:09:00.000Z", - "y": 108, + "x": "2021-08-03T06:51:00.000Z", + "y": 55, }, Object { - "x": "2021-07-27T08:10:00.000Z", - "y": 76, + "x": "2021-08-03T06:52:00.000Z", + "y": 40, }, Object { - "x": "2021-07-27T08:11:00.000Z", - "y": 77, + "x": "2021-08-03T06:53:00.000Z", + "y": 53, }, Object { - "x": "2021-07-27T08:12:00.000Z", - "y": 56, + "x": "2021-08-03T06:54:00.000Z", + "y": 39, }, ] `); diff --git a/x-pack/test/apm_api_integration/tests/service_maps/__snapshots__/service_maps.snap b/x-pack/test/apm_api_integration/tests/service_maps/__snapshots__/service_maps.snap index 9b913da4ca2e5..c66609b8a8a91 100644 --- a/x-pack/test/apm_api_integration/tests/service_maps/__snapshots__/service_maps.snap +++ b/x-pack/test/apm_api_integration/tests/service_maps/__snapshots__/service_maps.snap @@ -4,37 +4,20 @@ exports[`APM API tests trial apm_8.0.0 Service Map with data /api/apm/service-ma Array [ Object { "data": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", + "agent.name": "rum-js", + "id": "opbeans-rum", + "service.environment": "testing", + "service.name": "opbeans-rum", "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, + "actualValue": 1020870.96774194, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", - "transactionType": "request", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", }, }, }, - Object { - "data": Object { - "id": ">8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "label": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.destination.service.resource": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.subtype": "https", - "span.type": "external", - }, - }, - Object { - "data": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "testing", - "service.name": "opbeans-node", - }, - }, Object { "data": Object { "agent.name": "ruby", @@ -42,39 +25,15 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, }, }, - Object { - "data": Object { - "agent.name": "java", - "id": "opbeans-java", - "service.environment": "production", - "service.name": "opbeans-java", - "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-java", - "transactionType": "request", - }, - }, - }, - Object { - "data": Object { - "agent.name": "rum-js", - "id": "opbeans-rum", - "service.environment": "testing", - "service.name": "opbeans-rum", - }, - }, Object { "data": Object { "id": ">postgresql", @@ -91,10 +50,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -109,6 +68,22 @@ Array [ "span.type": "db", }, }, + Object { + "data": Object { + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, + }, + }, Object { "data": Object { "agent.name": "dotnet", @@ -116,10 +91,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -136,27 +111,34 @@ Array [ }, Object { "data": Object { - "agent.name": "rum-js", - "id": "kibana-frontend", + "agent.name": "java", + "id": "opbeans-java", "service.environment": "production", - "service.name": "kibana-frontend", + "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 3580000, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana-frontend", - "transactionType": "page-load", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", }, }, }, Object { "data": Object { - "id": ">epr-snapshot.elastic.co:443", - "label": "epr-snapshot.elastic.co:443", - "span.destination.service.resource": "epr-snapshot.elastic.co:443", - "span.subtype": "https", - "span.type": "external", + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, Object { @@ -168,23 +150,6 @@ Array [ "span.type": "cache", }, }, - Object { - "data": Object { - "agent.name": "go", - "id": "opbeans-go", - "service.environment": "testing", - "service.name": "opbeans-go", - }, - }, - Object { - "data": Object { - "id": ">feeds.elastic.co:443", - "label": "feeds.elastic.co:443", - "span.destination.service.resource": "feeds.elastic.co:443", - "span.subtype": "http", - "span.type": "external", - }, - }, Object { "data": Object { "agent.name": "go", @@ -193,153 +158,6 @@ Array [ "service.name": "auditbeat", }, }, - Object { - "data": Object { - "id": "kibana-frontend~>feeds.elastic.co:443", - "source": "kibana-frontend", - "sourceData": Object { - "agent.name": "rum-js", - "id": "kibana-frontend", - "service.environment": "production", - "service.name": "kibana-frontend", - "serviceAnomalyStats": Object { - "actualValue": 3580000, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana-frontend", - "transactionType": "page-load", - }, - }, - "target": ">feeds.elastic.co:443", - "targetData": Object { - "id": ">feeds.elastic.co:443", - "label": "feeds.elastic.co:443", - "span.destination.service.resource": "feeds.elastic.co:443", - "span.subtype": "http", - "span.type": "external", - }, - }, - }, - Object { - "data": Object { - "id": "kibana-frontend~kibana", - "source": "kibana-frontend", - "sourceData": Object { - "agent.name": "rum-js", - "id": "kibana-frontend", - "service.environment": "production", - "service.name": "kibana-frontend", - "serviceAnomalyStats": Object { - "actualValue": 3580000, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana-frontend", - "transactionType": "page-load", - }, - }, - "target": "kibana", - "targetData": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", - "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", - "transactionType": "request", - }, - }, - }, - }, - Object { - "data": Object { - "id": "kibana~>8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "source": "kibana", - "sourceData": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", - "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", - "transactionType": "request", - }, - }, - "target": ">8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "targetData": Object { - "id": ">8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "label": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.destination.service.resource": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.subtype": "https", - "span.type": "external", - }, - }, - }, - Object { - "data": Object { - "id": "kibana~>elasticsearch", - "source": "kibana", - "sourceData": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", - "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", - "transactionType": "request", - }, - }, - "target": ">elasticsearch", - "targetData": Object { - "id": ">elasticsearch", - "label": "elasticsearch", - "span.destination.service.resource": "elasticsearch", - "span.subtype": "elasticsearch", - "span.type": "db", - }, - }, - }, - Object { - "data": Object { - "id": "kibana~>epr-snapshot.elastic.co:443", - "source": "kibana", - "sourceData": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", - "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", - "transactionType": "request", - }, - }, - "target": ">epr-snapshot.elastic.co:443", - "targetData": Object { - "id": ">epr-snapshot.elastic.co:443", - "label": "epr-snapshot.elastic.co:443", - "span.destination.service.resource": "epr-snapshot.elastic.co:443", - "span.subtype": "https", - "span.type": "external", - }, - }, - }, Object { "data": Object { "id": "opbeans-dotnet~>sqlite", @@ -350,10 +168,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -377,6 +195,14 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -397,6 +223,14 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, "target": "opbeans-dotnet", "targetData": Object { @@ -405,10 +239,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -417,6 +251,7 @@ Array [ }, Object { "data": Object { + "bidirectional": true, "id": "opbeans-go~opbeans-java", "source": "opbeans-go", "sourceData": Object { @@ -424,6 +259,14 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, "target": "opbeans-java", "targetData": Object { @@ -432,16 +275,52 @@ Array [ "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, }, }, }, + Object { + "data": Object { + "bidirectional": true, + "id": "opbeans-go~opbeans-node", + "source": "opbeans-go", + "sourceData": Object { + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, + }, + "target": "opbeans-node", + "targetData": Object { + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, + }, + }, + }, Object { "data": Object { "bidirectional": true, @@ -452,6 +331,14 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, "target": "opbeans-python", "targetData": Object { @@ -460,10 +347,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -480,6 +367,14 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -488,10 +383,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -508,10 +403,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, @@ -528,80 +423,221 @@ Array [ }, Object { "data": Object { - "id": "opbeans-node~>postgresql", - "source": "opbeans-node", + "id": "opbeans-java~opbeans-dotnet", + "source": "opbeans-java", "sourceData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "testing", - "service.name": "opbeans-node", + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, }, - "target": ">postgresql", + "target": "opbeans-dotnet", "targetData": Object { - "id": ">postgresql", - "label": "postgresql", - "span.destination.service.resource": "postgresql", - "span.subtype": "postgresql", - "span.type": "db", - }, - }, - }, - Object { + "agent.name": "dotnet", + "id": "opbeans-dotnet", + "service.environment": "production", + "service.name": "opbeans-dotnet", + "serviceAnomalyStats": Object { + "actualValue": 868025.86875, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-dotnet", + "transactionType": "request", + }, + }, + }, + }, + Object { "data": Object { - "id": "opbeans-node~>redis", - "source": "opbeans-node", + "id": "opbeans-java~opbeans-go", + "isInverseEdge": true, + "source": "opbeans-java", + "sourceData": Object { + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, + }, + "target": "opbeans-go", + "targetData": Object { + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, + }, + }, + }, + Object { + "data": Object { + "bidirectional": true, + "id": "opbeans-java~opbeans-node", + "source": "opbeans-java", "sourceData": Object { + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, + }, + "target": "opbeans-node", + "targetData": Object { "agent.name": "nodejs", "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, - "target": ">redis", + }, + }, + Object { + "data": Object { + "bidirectional": true, + "id": "opbeans-java~opbeans-ruby", + "source": "opbeans-java", + "sourceData": Object { + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, + }, + "target": "opbeans-ruby", "targetData": Object { - "id": ">redis", - "label": "redis", - "span.destination.service.resource": "redis", - "span.subtype": "redis", - "span.type": "cache", + "agent.name": "ruby", + "id": "opbeans-ruby", + "service.environment": "production", + "service.name": "opbeans-ruby", + "serviceAnomalyStats": Object { + "actualValue": 62009.3356643357, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-ruby", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "opbeans-node~opbeans-dotnet", + "id": "opbeans-node~>postgresql", "source": "opbeans-node", "sourceData": Object { "agent.name": "nodejs", "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, - "target": "opbeans-dotnet", + "target": ">postgresql", "targetData": Object { - "agent.name": "dotnet", - "id": "opbeans-dotnet", - "service.environment": "production", - "service.name": "opbeans-dotnet", + "id": ">postgresql", + "label": "postgresql", + "span.destination.service.resource": "postgresql", + "span.subtype": "postgresql", + "span.type": "db", + }, + }, + }, + Object { + "data": Object { + "id": "opbeans-node~>redis", + "source": "opbeans-node", + "sourceData": Object { + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 24819.2962962963, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-dotnet", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", "transactionType": "request", }, }, + "target": ">redis", + "targetData": Object { + "id": ">redis", + "label": "redis", + "span.destination.service.resource": "redis", + "span.subtype": "redis", + "span.type": "cache", + }, }, }, Object { "data": Object { "id": "opbeans-node~opbeans-go", + "isInverseEdge": true, "source": "opbeans-node", "sourceData": Object { "agent.name": "nodejs", "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": "opbeans-go", "targetData": Object { @@ -609,18 +645,35 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, Object { "data": Object { "id": "opbeans-node~opbeans-java", + "isInverseEdge": true, "source": "opbeans-node", "sourceData": Object { "agent.name": "nodejs", "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": "opbeans-java", "targetData": Object { @@ -629,10 +682,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, @@ -649,6 +702,14 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": "opbeans-python", "targetData": Object { @@ -657,10 +718,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -677,6 +738,14 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -685,10 +754,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -705,10 +774,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -733,10 +802,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -761,10 +830,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -790,10 +859,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -804,6 +873,14 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, @@ -817,10 +894,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -832,10 +909,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, @@ -853,10 +930,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -867,6 +944,50 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, + }, + }, + }, + Object { + "data": Object { + "bidirectional": true, + "id": "opbeans-python~opbeans-ruby", + "source": "opbeans-python", + "sourceData": Object { + "agent.name": "python", + "id": "opbeans-python", + "service.environment": "production", + "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-python", + "transactionType": "request", + }, + }, + "target": "opbeans-ruby", + "targetData": Object { + "agent.name": "ruby", + "id": "opbeans-ruby", + "service.environment": "production", + "service.name": "opbeans-ruby", + "serviceAnomalyStats": Object { + "actualValue": 62009.3356643357, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-ruby", + "transactionType": "request", + }, }, }, }, @@ -880,10 +1001,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -908,10 +1029,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -923,10 +1044,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -944,10 +1065,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -958,12 +1079,21 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, Object { "data": Object { "id": "opbeans-ruby~opbeans-java", + "isInverseEdge": true, "source": "opbeans-ruby", "sourceData": Object { "agent.name": "ruby", @@ -971,10 +1101,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -986,10 +1116,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, @@ -1007,10 +1137,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -1021,12 +1151,21 @@ Array [ "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, }, }, Object { "data": Object { "id": "opbeans-ruby~opbeans-python", + "isInverseEdge": true, "source": "opbeans-ruby", "sourceData": Object { "agent.name": "ruby", @@ -1034,10 +1173,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -1049,10 +1188,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -1068,6 +1207,14 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, "target": "opbeans-dotnet", "targetData": Object { @@ -1076,10 +1223,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -1095,6 +1242,14 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, "target": "opbeans-go", "targetData": Object { @@ -1102,50 +1257,82 @@ Array [ "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "opbeans-rum~opbeans-node", + "id": "opbeans-rum~opbeans-java", "source": "opbeans-rum", "sourceData": Object { "agent.name": "rum-js", "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, - "target": "opbeans-node", + "target": "opbeans-java", "targetData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "testing", - "service.name": "opbeans-node", - }, - }, - }, + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, + }, + }, + }, Object { "data": Object { - "id": "opbeans-rum~opbeans-python", + "id": "opbeans-rum~opbeans-node", "source": "opbeans-rum", "sourceData": Object { "agent.name": "rum-js", "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, - "target": "opbeans-python", + "target": "opbeans-node", "targetData": Object { - "agent.name": "python", - "id": "opbeans-python", - "service.environment": "production", - "service.name": "opbeans-python", + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, + "actualValue": 24819.2962962963, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-python", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", "transactionType": "request", }, }, @@ -1160,6 +1347,14 @@ Array [ "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -1168,10 +1363,10 @@ Array [ "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -1186,37 +1381,20 @@ Object { "elements": Array [ Object { "data": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", + "agent.name": "rum-js", + "id": "opbeans-rum", + "service.environment": "testing", + "service.name": "opbeans-rum", "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, + "actualValue": 1020870.96774194, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", - "transactionType": "request", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", }, }, }, - Object { - "data": Object { - "id": ">8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "label": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.destination.service.resource": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.subtype": "https", - "span.type": "external", - }, - }, - Object { - "data": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "testing", - "service.name": "opbeans-node", - }, - }, Object { "data": Object { "agent.name": "ruby", @@ -1224,39 +1402,15 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, }, }, - Object { - "data": Object { - "agent.name": "java", - "id": "opbeans-java", - "service.environment": "production", - "service.name": "opbeans-java", - "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, - "anomalyScore": 0, - "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-java", - "transactionType": "request", - }, - }, - }, - Object { - "data": Object { - "agent.name": "rum-js", - "id": "opbeans-rum", - "service.environment": "testing", - "service.name": "opbeans-rum", - }, - }, Object { "data": Object { "id": ">postgresql", @@ -1273,10 +1427,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -1291,6 +1445,22 @@ Object { "span.type": "db", }, }, + Object { + "data": Object { + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, + }, + }, Object { "data": Object { "agent.name": "dotnet", @@ -1298,10 +1468,10 @@ Object { "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -1318,27 +1488,34 @@ Object { }, Object { "data": Object { - "agent.name": "rum-js", - "id": "kibana-frontend", + "agent.name": "java", + "id": "opbeans-java", "service.environment": "production", - "service.name": "kibana-frontend", + "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 3580000, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana-frontend", - "transactionType": "page-load", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", }, }, }, Object { "data": Object { - "id": ">epr-snapshot.elastic.co:443", - "label": "epr-snapshot.elastic.co:443", - "span.destination.service.resource": "epr-snapshot.elastic.co:443", - "span.subtype": "https", - "span.type": "external", + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, Object { @@ -1350,23 +1527,6 @@ Object { "span.type": "cache", }, }, - Object { - "data": Object { - "agent.name": "go", - "id": "opbeans-go", - "service.environment": "testing", - "service.name": "opbeans-go", - }, - }, - Object { - "data": Object { - "id": ">feeds.elastic.co:443", - "label": "feeds.elastic.co:443", - "span.destination.service.resource": "feeds.elastic.co:443", - "span.subtype": "http", - "span.type": "external", - }, - }, Object { "data": Object { "agent.name": "go", @@ -1377,62 +1537,90 @@ Object { }, Object { "data": Object { - "id": "kibana-frontend~>feeds.elastic.co:443", - "source": "kibana-frontend", + "id": "opbeans-dotnet~>sqlite", + "source": "opbeans-dotnet", "sourceData": Object { - "agent.name": "rum-js", - "id": "kibana-frontend", + "agent.name": "dotnet", + "id": "opbeans-dotnet", "service.environment": "production", - "service.name": "kibana-frontend", + "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 3580000, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana-frontend", - "transactionType": "page-load", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-dotnet", + "transactionType": "request", }, }, - "target": ">feeds.elastic.co:443", + "target": ">sqlite", "targetData": Object { - "id": ">feeds.elastic.co:443", - "label": "feeds.elastic.co:443", - "span.destination.service.resource": "feeds.elastic.co:443", - "span.subtype": "http", - "span.type": "external", + "id": ">sqlite", + "label": "sqlite", + "span.destination.service.resource": "sqlite", + "span.subtype": "sqlite", + "span.type": "db", }, }, }, Object { "data": Object { - "id": "kibana-frontend~kibana", - "source": "kibana-frontend", + "id": "opbeans-go~>postgresql", + "source": "opbeans-go", "sourceData": Object { - "agent.name": "rum-js", - "id": "kibana-frontend", - "service.environment": "production", - "service.name": "kibana-frontend", + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", "serviceAnomalyStats": Object { - "actualValue": 3580000, + "actualValue": 102786.319148936, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana-frontend", - "transactionType": "page-load", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", }, }, - "target": "kibana", + "target": ">postgresql", "targetData": Object { - "agent.name": "nodejs", - "id": "kibana", + "id": ">postgresql", + "label": "postgresql", + "span.destination.service.resource": "postgresql", + "span.subtype": "postgresql", + "span.type": "db", + }, + }, + }, + Object { + "data": Object { + "id": "opbeans-go~opbeans-dotnet", + "source": "opbeans-go", + "sourceData": Object { + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, + }, + "target": "opbeans-dotnet", + "targetData": Object { + "agent.name": "dotnet", + "id": "opbeans-dotnet", "service.environment": "production", - "service.name": "kibana", + "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-dotnet", "transactionType": "request", }, }, @@ -1440,125 +1628,165 @@ Object { }, Object { "data": Object { - "id": "kibana~>8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "source": "kibana", + "bidirectional": true, + "id": "opbeans-go~opbeans-java", + "source": "opbeans-go", "sourceData": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, + "actualValue": 102786.319148936, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", "transactionType": "request", }, }, - "target": ">8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", + "target": "opbeans-java", "targetData": Object { - "id": ">8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "label": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.destination.service.resource": "8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", - "span.subtype": "https", - "span.type": "external", + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "kibana~>elasticsearch", - "source": "kibana", + "bidirectional": true, + "id": "opbeans-go~opbeans-node", + "source": "opbeans-go", "sourceData": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, + "actualValue": 102786.319148936, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", "transactionType": "request", }, }, - "target": ">elasticsearch", + "target": "opbeans-node", "targetData": Object { - "id": ">elasticsearch", - "label": "elasticsearch", - "span.destination.service.resource": "elasticsearch", - "span.subtype": "elasticsearch", - "span.type": "db", + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "kibana~>epr-snapshot.elastic.co:443", - "source": "kibana", + "bidirectional": true, + "id": "opbeans-go~opbeans-python", + "source": "opbeans-go", "sourceData": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, + "actualValue": 102786.319148936, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", "transactionType": "request", }, }, - "target": ">epr-snapshot.elastic.co:443", + "target": "opbeans-python", "targetData": Object { - "id": ">epr-snapshot.elastic.co:443", - "label": "epr-snapshot.elastic.co:443", - "span.destination.service.resource": "epr-snapshot.elastic.co:443", - "span.subtype": "https", - "span.type": "external", + "agent.name": "python", + "id": "opbeans-python", + "service.environment": "production", + "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-python", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "opbeans-dotnet~>sqlite", - "source": "opbeans-dotnet", + "bidirectional": true, + "id": "opbeans-go~opbeans-ruby", + "source": "opbeans-go", "sourceData": Object { - "agent.name": "dotnet", - "id": "opbeans-dotnet", - "service.environment": "production", - "service.name": "opbeans-dotnet", + "agent.name": "go", + "id": "opbeans-go", + "service.environment": "testing", + "service.name": "opbeans-go", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 102786.319148936, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-dotnet", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", "transactionType": "request", }, }, - "target": ">sqlite", + "target": "opbeans-ruby", "targetData": Object { - "id": ">sqlite", - "label": "sqlite", - "span.destination.service.resource": "sqlite", - "span.subtype": "sqlite", - "span.type": "db", + "agent.name": "ruby", + "id": "opbeans-ruby", + "service.environment": "production", + "service.name": "opbeans-ruby", + "serviceAnomalyStats": Object { + "actualValue": 62009.3356643357, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-ruby", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "opbeans-go~>postgresql", - "source": "opbeans-go", + "id": "opbeans-java~>postgresql", + "source": "opbeans-java", "sourceData": Object { - "agent.name": "go", - "id": "opbeans-go", - "service.environment": "testing", - "service.name": "opbeans-go", + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -1572,13 +1800,21 @@ Object { }, Object { "data": Object { - "id": "opbeans-go~opbeans-dotnet", - "source": "opbeans-go", + "id": "opbeans-java~opbeans-dotnet", + "source": "opbeans-java", "sourceData": Object { - "agent.name": "go", - "id": "opbeans-go", - "service.environment": "testing", - "service.name": "opbeans-go", + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, }, "target": "opbeans-dotnet", "targetData": Object { @@ -1587,10 +1823,10 @@ Object { "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -1599,54 +1835,35 @@ Object { }, Object { "data": Object { - "id": "opbeans-go~opbeans-java", - "source": "opbeans-go", + "id": "opbeans-java~opbeans-go", + "isInverseEdge": true, + "source": "opbeans-java", "sourceData": Object { - "agent.name": "go", - "id": "opbeans-go", - "service.environment": "testing", - "service.name": "opbeans-go", - }, - "target": "opbeans-java", - "targetData": Object { "agent.name": "java", "id": "opbeans-java", "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, }, - }, - }, - Object { - "data": Object { - "bidirectional": true, - "id": "opbeans-go~opbeans-python", - "source": "opbeans-go", - "sourceData": Object { + "target": "opbeans-go", + "targetData": Object { "agent.name": "go", "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", - }, - "target": "opbeans-python", - "targetData": Object { - "agent.name": "python", - "id": "opbeans-python", - "service.environment": "production", - "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, + "actualValue": 102786.319148936, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-python", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", "transactionType": "request", }, }, @@ -1655,26 +1872,34 @@ Object { Object { "data": Object { "bidirectional": true, - "id": "opbeans-go~opbeans-ruby", - "source": "opbeans-go", + "id": "opbeans-java~opbeans-node", + "source": "opbeans-java", "sourceData": Object { - "agent.name": "go", - "id": "opbeans-go", - "service.environment": "testing", - "service.name": "opbeans-go", + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, }, - "target": "opbeans-ruby", + "target": "opbeans-node", "targetData": Object { - "agent.name": "ruby", - "id": "opbeans-ruby", - "service.environment": "production", - "service.name": "opbeans-ruby", + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 24819.2962962963, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-ruby", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", "transactionType": "request", }, }, @@ -1682,7 +1907,8 @@ Object { }, Object { "data": Object { - "id": "opbeans-java~>postgresql", + "bidirectional": true, + "id": "opbeans-java~opbeans-ruby", "source": "opbeans-java", "sourceData": Object { "agent.name": "java", @@ -1690,21 +1916,28 @@ Object { "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, }, - "target": ">postgresql", + "target": "opbeans-ruby", "targetData": Object { - "id": ">postgresql", - "label": "postgresql", - "span.destination.service.resource": "postgresql", - "span.subtype": "postgresql", - "span.type": "db", + "agent.name": "ruby", + "id": "opbeans-ruby", + "service.environment": "production", + "service.name": "opbeans-ruby", + "serviceAnomalyStats": Object { + "actualValue": 62009.3356643357, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-ruby", + "transactionType": "request", + }, }, }, }, @@ -1717,6 +1950,14 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": ">postgresql", "targetData": Object { @@ -1737,6 +1978,14 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": ">redis", "targetData": Object { @@ -1750,59 +1999,58 @@ Object { }, Object { "data": Object { - "id": "opbeans-node~opbeans-dotnet", + "id": "opbeans-node~opbeans-go", + "isInverseEdge": true, "source": "opbeans-node", "sourceData": Object { "agent.name": "nodejs", "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", - }, - "target": "opbeans-dotnet", - "targetData": Object { - "agent.name": "dotnet", - "id": "opbeans-dotnet", - "service.environment": "production", - "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 24819.2962962963, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-dotnet", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", "transactionType": "request", }, }, - }, - }, - Object { - "data": Object { - "id": "opbeans-node~opbeans-go", - "source": "opbeans-node", - "sourceData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "testing", - "service.name": "opbeans-node", - }, "target": "opbeans-go", "targetData": Object { "agent.name": "go", "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, Object { "data": Object { "id": "opbeans-node~opbeans-java", + "isInverseEdge": true, "source": "opbeans-node", "sourceData": Object { "agent.name": "nodejs", "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": "opbeans-java", "targetData": Object { @@ -1811,10 +2059,10 @@ Object { "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, @@ -1831,6 +2079,14 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": "opbeans-python", "targetData": Object { @@ -1839,10 +2095,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -1859,6 +2115,14 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -1867,10 +2131,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -1887,10 +2151,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -1915,10 +2179,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -1943,10 +2207,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -1972,10 +2236,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -1986,6 +2250,14 @@ Object { "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, @@ -1999,10 +2271,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -2014,10 +2286,10 @@ Object { "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, @@ -2035,10 +2307,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -2049,6 +2321,50 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, + }, + }, + }, + Object { + "data": Object { + "bidirectional": true, + "id": "opbeans-python~opbeans-ruby", + "source": "opbeans-python", + "sourceData": Object { + "agent.name": "python", + "id": "opbeans-python", + "service.environment": "production", + "service.name": "opbeans-python", + "serviceAnomalyStats": Object { + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-python", + "transactionType": "request", + }, + }, + "target": "opbeans-ruby", + "targetData": Object { + "agent.name": "ruby", + "id": "opbeans-ruby", + "service.environment": "production", + "service.name": "opbeans-ruby", + "serviceAnomalyStats": Object { + "actualValue": 62009.3356643357, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-ruby", + "transactionType": "request", + }, }, }, }, @@ -2062,10 +2378,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -2090,10 +2406,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -2105,10 +2421,10 @@ Object { "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -2126,10 +2442,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -2140,12 +2456,21 @@ Object { "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, Object { "data": Object { "id": "opbeans-ruby~opbeans-java", + "isInverseEdge": true, "source": "opbeans-ruby", "sourceData": Object { "agent.name": "ruby", @@ -2153,10 +2478,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -2168,10 +2493,10 @@ Object { "service.environment": "production", "service.name": "opbeans-java", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, + "actualValue": 175568.855769231, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-java", "transactionType": "request", }, @@ -2189,10 +2514,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -2203,12 +2528,21 @@ Object { "id": "opbeans-node", "service.environment": "testing", "service.name": "opbeans-node", + "serviceAnomalyStats": Object { + "actualValue": 24819.2962962963, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", + "transactionType": "request", + }, }, }, }, Object { "data": Object { "id": "opbeans-ruby~opbeans-python", + "isInverseEdge": true, "source": "opbeans-ruby", "sourceData": Object { "agent.name": "ruby", @@ -2216,10 +2550,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -2231,10 +2565,10 @@ Object { "service.environment": "production", "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-python", "transactionType": "request", }, @@ -2250,6 +2584,14 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, "target": "opbeans-dotnet", "targetData": Object { @@ -2258,10 +2600,10 @@ Object { "service.environment": "production", "service.name": "opbeans-dotnet", "serviceAnomalyStats": Object { - "actualValue": 653671.165289257, + "actualValue": 868025.86875, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-dotnet", "transactionType": "request", }, @@ -2277,6 +2619,14 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, "target": "opbeans-go", "targetData": Object { @@ -2284,50 +2634,82 @@ Object { "id": "opbeans-go", "service.environment": "testing", "service.name": "opbeans-go", + "serviceAnomalyStats": Object { + "actualValue": 102786.319148936, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-go", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "opbeans-rum~opbeans-node", + "id": "opbeans-rum~opbeans-java", "source": "opbeans-rum", "sourceData": Object { "agent.name": "rum-js", "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, - "target": "opbeans-node", + "target": "opbeans-java", "targetData": Object { - "agent.name": "nodejs", - "id": "opbeans-node", - "service.environment": "testing", - "service.name": "opbeans-node", + "agent.name": "java", + "id": "opbeans-java", + "service.environment": "production", + "service.name": "opbeans-java", + "serviceAnomalyStats": Object { + "actualValue": 175568.855769231, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-java", + "transactionType": "request", + }, }, }, }, Object { "data": Object { - "id": "opbeans-rum~opbeans-python", + "id": "opbeans-rum~opbeans-node", "source": "opbeans-rum", "sourceData": Object { "agent.name": "rum-js", "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, - "target": "opbeans-python", + "target": "opbeans-node", "targetData": Object { - "agent.name": "python", - "id": "opbeans-python", - "service.environment": "production", - "service.name": "opbeans-python", + "agent.name": "nodejs", + "id": "opbeans-node", + "service.environment": "testing", + "service.name": "opbeans-node", "serviceAnomalyStats": Object { - "actualValue": 42906.4512195122, + "actualValue": 24819.2962962963, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-python", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-node", "transactionType": "request", }, }, @@ -2342,6 +2724,14 @@ Object { "id": "opbeans-rum", "service.environment": "testing", "service.name": "opbeans-rum", + "serviceAnomalyStats": Object { + "actualValue": 1020870.96774194, + "anomalyScore": 0, + "healthStatus": "healthy", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", + }, }, "target": "opbeans-ruby", "targetData": Object { @@ -2350,10 +2740,10 @@ Object { "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, diff --git a/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts b/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts index 2453cb85d93bc..b043efe05b523 100644 --- a/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts +++ b/x-pack/test/apm_api_integration/tests/service_maps/service_maps.ts @@ -89,8 +89,6 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) expectSnapshot(serviceNames).toMatchInline(` Array [ "auditbeat", - "kibana", - "kibana-frontend", "opbeans-dotnet", "opbeans-go", "opbeans-java", @@ -109,10 +107,7 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) expectSnapshot(externalDestinations).toMatchInline(` Array [ - ">8b37cb7ca2ae49ada54db165f32d3a19.us-central1.gcp.foundit.no:9243", ">elasticsearch", - ">epr-snapshot.elastic.co:443", - ">feeds.elastic.co:443", ">postgresql", ">redis", ">sqlite", @@ -150,22 +145,22 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) expect(dataWithAnomalies).not.to.be.empty(); - expectSnapshot(dataWithAnomalies.length).toMatchInline(`6`); + expectSnapshot(dataWithAnomalies.length).toMatchInline(`7`); expectSnapshot(dataWithAnomalies.slice(0, 3)).toMatchInline(` Array [ Object { "data": Object { - "agent.name": "nodejs", - "id": "kibana", - "service.environment": "production", - "service.name": "kibana", + "agent.name": "rum-js", + "id": "opbeans-rum", + "service.environment": "testing", + "service.name": "opbeans-rum", "serviceAnomalyStats": Object { - "actualValue": 635652.26283725, + "actualValue": 1020870.96774194, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "kibana", - "transactionType": "request", + "jobId": "apm-testing-41e5-high_mean_transaction_duration", + "serviceName": "opbeans-rum", + "transactionType": "page-load", }, }, }, @@ -176,10 +171,10 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) "service.environment": "production", "service.name": "opbeans-ruby", "serviceAnomalyStats": Object { - "actualValue": 24400.8867924528, + "actualValue": 62009.3356643357, "anomalyScore": 0, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", + "jobId": "apm-production-6117-high_mean_transaction_duration", "serviceName": "opbeans-ruby", "transactionType": "request", }, @@ -187,16 +182,16 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext) }, Object { "data": Object { - "agent.name": "java", - "id": "opbeans-java", + "agent.name": "python", + "id": "opbeans-python", "service.environment": "production", - "service.name": "opbeans-java", + "service.name": "opbeans-python", "serviceAnomalyStats": Object { - "actualValue": 19105.8492063492, - "anomalyScore": 0, + "actualValue": 38862.7831325301, + "anomalyScore": 0.0725701910161626, "healthStatus": "healthy", - "jobId": "apm-production-802c-high_mean_transaction_duration", - "serviceName": "opbeans-java", + "jobId": "apm-production-6117-high_mean_transaction_duration", + "serviceName": "opbeans-python", "transactionType": "request", }, }, diff --git a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap index aaeeb9a512522..5daadd8079baa 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap +++ b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instance_details.snap @@ -2,17 +2,17 @@ exports[`APM API tests basic apm_8.0.0 Instance details when data is loaded fetch instance details return the correct data 1`] = ` Object { - "@timestamp": "2021-07-27T08:08:17.707Z", + "@timestamp": "2021-08-03T06:50:50.204Z", "agent": Object { - "ephemeral_id": "1f810e6f-e78a-4f49-9773-2142b9af9943", + "ephemeral_id": "2745d454-f57f-4473-a09b-fe6bef295860", "name": "java", "version": "1.25.1-SNAPSHOT.UNKNOWN", }, "cloud": Object { "availability_zone": "europe-west1-c", "instance": Object { - "id": "4295368814211072338", - "name": "gke-edge-oblt-gcp-edge-oblt-gcp-pool-b6b9e929-92m2", + "id": "2549868447004523210", + "name": "gke-release-oblt-release-oblt-pool-d839a4cc-7sjc", }, "machine": Object { "type": "n1-standard-4", @@ -25,25 +25,26 @@ Object { "region": "europe-west1", }, "container": Object { - "id": "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "id": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", }, "host": Object { "architecture": "amd64", - "ip": "10.40.0.248", + "ip": "35.233.127.253", "os": Object { "platform": "Linux", }, }, "kubernetes": Object { "pod": Object { - "name": "opbeans-java-59f5cddddf-s9bvt", - "uid": "9aa1e495-4eca-49ca-bd26-2914e05a0226", + "name": "opbeans-java-b8fcdf794-czvtr", + "uid": "e0bf3100-4a0d-4d96-88ef-4e3aa3c78a5d", }, }, "service": Object { "environment": "production", "framework": Object { - "name": "Servlet API", + "name": "Spring Web MVC", + "version": "5.0.6.RELEASE", }, "language": Object { "name": "Java", @@ -51,13 +52,13 @@ Object { }, "name": "opbeans-java", "node": Object { - "name": "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "name": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", }, "runtime": Object { "name": "Java", "version": "11.0.11", }, - "version": "2021-07-27 03:47:01", + "version": "2021-08-03 04:26:27", }, } `; diff --git a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap index 42570f591367f..7ae3fa1da3380 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap +++ b/x-pack/test/apm_api_integration/tests/service_overview/__snapshots__/instances_detailed_statistics.snap @@ -3,670 +3,670 @@ exports[`APM API tests basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data with comparison returns the right data for current and previous periods 5`] = ` Object { "currentPeriod": Object { - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2": Object { + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad": Object { "cpuUsage": Array [ Object { - "x": 1627374180000, - "y": 0.002, + "x": 1627974300000, + "y": 0.0015, }, Object { - "x": 1627374240000, - "y": 0.0015, + "x": 1627974360000, + "y": 0.001, }, Object { - "x": 1627374300000, - "y": 0.002, + "x": 1627974420000, + "y": 0.0025, }, Object { - "x": 1627374360000, - "y": 0.002, + "x": 1627974480000, + "y": 0.0015, }, Object { - "x": 1627374420000, - "y": 0.0025, + "x": 1627974540000, + "y": 0.0015, }, Object { - "x": 1627374480000, - "y": 0.002, + "x": 1627974600000, + "y": 0.0015, }, Object { - "x": 1627374540000, - "y": 0.007, + "x": 1627974660000, + "y": 0.0015, }, Object { - "x": 1627374600000, + "x": 1627974720000, "y": 0.002, }, Object { - "x": 1627374660000, - "y": 0.002, + "x": 1627974780000, + "y": 0.0015, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": 0.002, }, Object { - "x": 1627374780000, - "y": 0.0035, + "x": 1627974900000, + "y": 0.0025, }, Object { - "x": 1627374840000, - "y": 0.002, + "x": 1627974960000, + "y": 0.001, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0.002, }, Object { - "x": 1627374960000, - "y": 0.0015, + "x": 1627975080000, + "y": 0.002, }, Object { - "x": 1627375020000, - "y": 0.0015, + "x": 1627975140000, + "y": 0.0025, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], "errorRate": Array [ Object { - "x": 1627374180000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374240000, - "y": 0, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374300000, - "y": 0.0714285714285714, + "x": 1627974420000, + "y": 0, }, Object { - "x": 1627374360000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374420000, - "y": 0.0263157894736842, + "x": 1627974540000, + "y": 0, }, Object { - "x": 1627374480000, - "y": 0.0294117647058824, + "x": 1627974600000, + "y": 0.0526315789473684, }, Object { - "x": 1627374540000, - "y": 0, + "x": 1627974660000, + "y": 0.142857142857143, }, Object { - "x": 1627374600000, - "y": 0.0465116279069767, + "x": 1627974720000, + "y": 0.0416666666666667, }, Object { - "x": 1627374660000, + "x": 1627974780000, "y": 0, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374780000, - "y": 0.125, + "x": 1627974900000, + "y": 0.024390243902439, }, Object { - "x": 1627374840000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374960000, + "x": 1627975080000, "y": 0, }, Object { - "x": 1627375020000, - "y": 0, + "x": 1627975140000, + "y": 0.0555555555555556, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], "latency": Array [ Object { - "x": 1627374180000, - "y": 9821.54545454545, + "x": 1627974300000, + "y": 34887.8888888889, }, Object { - "x": 1627374240000, - "y": 15175, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374300000, - "y": 11944.1428571429, + "x": 1627974420000, + "y": 4983, }, Object { - "x": 1627374360000, - "y": 10557.2222222222, + "x": 1627974480000, + "y": 41285.4, }, Object { - "x": 1627374420000, - "y": 25429.1538461538, + "x": 1627974540000, + "y": 13820.3333333333, }, Object { - "x": 1627374480000, - "y": 21736.1428571429, + "x": 1627974600000, + "y": 13782, }, Object { - "x": 1627374540000, - "y": 28604.3333333333, + "x": 1627974660000, + "y": 13392.6, }, Object { - "x": 1627374600000, - "y": 20103.5333333333, + "x": 1627974720000, + "y": 6991, }, Object { - "x": 1627374660000, - "y": 3311, + "x": 1627974780000, + "y": 6885.85714285714, }, Object { - "x": 1627374720000, - "y": 7521, + "x": 1627974840000, + "y": 7935, }, Object { - "x": 1627374780000, - "y": 8063, + "x": 1627974900000, + "y": 10828.3333333333, }, Object { - "x": 1627374840000, - "y": 8101.4, + "x": 1627974960000, + "y": 6079, }, Object { - "x": 1627374900000, - "y": 24196.3333333333, + "x": 1627975020000, + "y": 5217, }, Object { - "x": 1627374960000, - "y": 14157, + "x": 1627975080000, + "y": 8477.76923076923, }, Object { - "x": 1627375020000, - "y": 15103, + "x": 1627975140000, + "y": 5937.18181818182, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], "memoryUsage": Array [ Object { - "x": 1627374180000, - "y": 0.824100494384766, + "x": 1627974300000, + "y": 0.786640167236328, }, Object { - "x": 1627374240000, - "y": 0.824317932128906, + "x": 1627974360000, + "y": 0.786666870117188, }, Object { - "x": 1627374300000, - "y": 0.824752807617188, + "x": 1627974420000, + "y": 0.786960601806641, }, Object { - "x": 1627374360000, - "y": 0.825035095214844, + "x": 1627974480000, + "y": 0.787132263183594, }, Object { - "x": 1627374420000, - "y": 0.825420379638672, + "x": 1627974540000, + "y": 0.787441253662109, }, Object { - "x": 1627374480000, - "y": 0.825778961181641, + "x": 1627974600000, + "y": 0.787555694580078, }, Object { - "x": 1627374540000, - "y": 0.823772430419922, + "x": 1627974660000, + "y": 0.788524627685547, }, Object { - "x": 1627374600000, - "y": 0.824184417724609, + "x": 1627974720000, + "y": 0.788822174072266, }, Object { - "x": 1627374660000, - "y": 0.824348449707031, + "x": 1627974780000, + "y": 0.789054870605469, }, Object { - "x": 1627374720000, - "y": 0.824550628662109, + "x": 1627974840000, + "y": 0.78936767578125, }, Object { - "x": 1627374780000, - "y": 0.826988220214844, + "x": 1627974900000, + "y": 0.789985656738281, }, Object { - "x": 1627374840000, - "y": 0.82958984375, + "x": 1627974960000, + "y": 0.790130615234375, }, Object { - "x": 1627374900000, - "y": 0.829998016357422, + "x": 1627975020000, + "y": 0.790508270263672, }, Object { - "x": 1627374960000, - "y": 0.830215454101563, + "x": 1627975080000, + "y": 0.791069030761719, }, Object { - "x": 1627375020000, - "y": 0.830368041992188, + "x": 1627975140000, + "y": 0.791587829589844, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], - "serviceNodeName": "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "serviceNodeName": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", "throughput": Array [ Object { - "x": 1627374180000, - "y": 39, + "x": 1627974300000, + "y": 21, }, Object { - "x": 1627374240000, - "y": 30, + "x": 1627974360000, + "y": 0, }, Object { - "x": 1627374300000, - "y": 28, + "x": 1627974420000, + "y": 24, }, Object { - "x": 1627374360000, - "y": 37, + "x": 1627974480000, + "y": 17, }, Object { - "x": 1627374420000, - "y": 38, + "x": 1627974540000, + "y": 17, }, Object { - "x": 1627374480000, - "y": 34, + "x": 1627974600000, + "y": 19, }, Object { - "x": 1627374540000, - "y": 51, + "x": 1627974660000, + "y": 21, }, Object { - "x": 1627374600000, - "y": 43, + "x": 1627974720000, + "y": 24, }, Object { - "x": 1627374660000, - "y": 9, + "x": 1627974780000, + "y": 22, }, Object { - "x": 1627374720000, - "y": 23, + "x": 1627974840000, + "y": 19, }, Object { - "x": 1627374780000, - "y": 8, + "x": 1627974900000, + "y": 41, }, Object { - "x": 1627374840000, - "y": 28, + "x": 1627974960000, + "y": 11, }, Object { - "x": 1627374900000, - "y": 32, + "x": 1627975020000, + "y": 23, }, Object { - "x": 1627374960000, - "y": 25, + "x": 1627975080000, + "y": 47, }, Object { - "x": 1627375020000, - "y": 8, + "x": 1627975140000, + "y": 36, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ], }, }, "previousPeriod": Object { - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2": Object { + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad": Object { "cpuUsage": Array [ Object { - "x": 1627374180000, - "y": 0.002, - }, - Object { - "x": 1627374240000, + "x": 1627974300000, "y": 0.0015, }, Object { - "x": 1627374300000, + "x": 1627974360000, "y": 0.002, }, Object { - "x": 1627374360000, - "y": 0.002, + "x": 1627974420000, + "y": 0.0025, }, Object { - "x": 1627374420000, + "x": 1627974480000, "y": 0.0015, }, Object { - "x": 1627374480000, + "x": 1627974540000, "y": 0.002, }, Object { - "x": 1627374540000, + "x": 1627974600000, "y": 0.002, }, Object { - "x": 1627374600000, + "x": 1627974660000, "y": 0.002, }, Object { - "x": 1627374660000, + "x": 1627974720000, "y": 0.002, }, Object { - "x": 1627374720000, - "y": 0.0015, + "x": 1627974780000, + "y": 0.002, }, Object { - "x": 1627374780000, - "y": 0.0015, + "x": 1627974840000, + "y": 0.0045, }, Object { - "x": 1627374840000, - "y": 0.0035, + "x": 1627974900000, + "y": 0.0025, }, Object { - "x": 1627374900000, - "y": 0.003, + "x": 1627974960000, + "y": 0.0025, }, Object { - "x": 1627374960000, + "x": 1627975020000, "y": 0.002, }, Object { - "x": 1627375020000, + "x": 1627975080000, "y": 0.002, }, Object { - "x": 1627375080000, + "x": 1627975140000, + "y": 0.0025, + }, + Object { + "x": 1627975200000, "y": null, }, ], "errorRate": Array [ Object { - "x": 1627374180000, - "y": 0.121212121212121, - }, - Object { - "x": 1627374240000, - "y": 0.0714285714285714, + "x": 1627974300000, + "y": 0, }, Object { - "x": 1627374300000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374360000, - "y": 0, + "x": 1627974420000, + "y": 0.0434782608695652, }, Object { - "x": 1627374420000, - "y": 0, + "x": 1627974480000, + "y": 0.0833333333333333, }, Object { - "x": 1627374480000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374540000, + "x": 1627974600000, "y": 0, }, Object { - "x": 1627374600000, - "y": 0, + "x": 1627974660000, + "y": 0.03125, }, Object { - "x": 1627374660000, - "y": 0.0303030303030303, + "x": 1627974720000, + "y": 0.0555555555555556, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974780000, + "y": 0, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374840000, - "y": 0.0625, + "x": 1627974900000, + "y": 0.0232558139534884, }, Object { - "x": 1627374900000, - "y": 0.0476190476190476, + "x": 1627974960000, + "y": 0.032258064516129, }, Object { - "x": 1627374960000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627375020000, - "y": 0, + "x": 1627975080000, + "y": 0.027027027027027, }, Object { - "x": 1627375080000, + "x": 1627975140000, + "y": 0.0571428571428571, + }, + Object { + "x": 1627975200000, "y": null, }, ], "latency": Array [ Object { - "x": 1627374180000, - "y": 12008.6, + "x": 1627974300000, + "y": 11839, }, Object { - "x": 1627374240000, - "y": 10207, + "x": 1627974360000, + "y": 7407, }, Object { - "x": 1627374300000, - "y": 17692.1428571429, + "x": 1627974420000, + "y": 1925569.66666667, }, Object { - "x": 1627374360000, - "y": 13574.3846153846, + "x": 1627974480000, + "y": 9017.18181818182, }, Object { - "x": 1627374420000, - "y": 13247, + "x": 1627974540000, + "y": 63575, }, Object { - "x": 1627374480000, - "y": 10495, + "x": 1627974600000, + "y": 7577.66666666667, }, Object { - "x": 1627374540000, - "y": 25359, + "x": 1627974660000, + "y": 6844.33333333333, }, Object { - "x": 1627374600000, - "y": 15160.6, + "x": 1627974720000, + "y": 503471, }, Object { - "x": 1627374660000, - "y": 17819, + "x": 1627974780000, + "y": 6247.8, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974840000, + "y": 1137247, }, Object { - "x": 1627374780000, - "y": 12047, + "x": 1627974900000, + "y": 27951.6666666667, }, Object { - "x": 1627374840000, - "y": 15913.6666666667, + "x": 1627974960000, + "y": 10248.8461538462, }, Object { - "x": 1627374900000, - "y": 13746.2, + "x": 1627975020000, + "y": 13529, }, Object { - "x": 1627374960000, - "y": 9519, + "x": 1627975080000, + "y": 6691247.8, }, Object { - "x": 1627375020000, - "y": 34824.6, + "x": 1627975140000, + "y": 12098.6923076923, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], "memoryUsage": Array [ Object { - "x": 1627374180000, - "y": 0.825572967529297, + "x": 1627974300000, + "y": 0.780715942382813, }, Object { - "x": 1627374240000, - "y": 0.825843811035156, + "x": 1627974360000, + "y": 0.780921936035156, }, Object { - "x": 1627374300000, - "y": 0.826179504394531, + "x": 1627974420000, + "y": 0.781166076660156, }, Object { - "x": 1627374360000, - "y": 0.82659912109375, + "x": 1627974480000, + "y": 0.781524658203125, }, Object { - "x": 1627374420000, - "y": 0.826702117919922, + "x": 1627974540000, + "y": 0.781723022460938, }, Object { - "x": 1627374480000, - "y": 0.826923370361328, + "x": 1627974600000, + "y": 0.782463073730469, }, Object { - "x": 1627374540000, - "y": 0.827106475830078, + "x": 1627974660000, + "y": 0.782634735107422, }, Object { - "x": 1627374600000, - "y": 0.827262878417969, + "x": 1627974720000, + "y": 0.782939910888672, }, Object { - "x": 1627374660000, - "y": 0.827518463134766, + "x": 1627974780000, + "y": 0.783458709716797, }, Object { - "x": 1627374720000, - "y": 0.827735900878906, + "x": 1627974840000, + "y": 0.783935546875, }, Object { - "x": 1627374780000, - "y": 0.827884674072266, + "x": 1627974900000, + "y": 0.784690856933594, }, Object { - "x": 1627374840000, - "y": 0.828010559082031, + "x": 1627974960000, + "y": 0.785182952880859, }, Object { - "x": 1627374900000, - "y": 0.823200225830078, + "x": 1627975020000, + "y": 0.785446166992188, }, Object { - "x": 1627374960000, - "y": 0.823371887207031, + "x": 1627975080000, + "y": 0.786224365234375, }, Object { - "x": 1627375020000, - "y": 0.823692321777344, + "x": 1627975140000, + "y": 0.786415100097656, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], - "serviceNodeName": "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "serviceNodeName": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", "throughput": Array [ Object { - "x": 1627374180000, - "y": 33, + "x": 1627974300000, + "y": 15, }, Object { - "x": 1627374240000, - "y": 14, + "x": 1627974360000, + "y": 13, }, Object { - "x": 1627374300000, - "y": 42, + "x": 1627974420000, + "y": 23, }, Object { - "x": 1627374360000, - "y": 43, + "x": 1627974480000, + "y": 24, }, Object { - "x": 1627374420000, - "y": 4, + "x": 1627974540000, + "y": 10, }, Object { - "x": 1627374480000, - "y": 19, + "x": 1627974600000, + "y": 18, }, Object { - "x": 1627374540000, - "y": 22, + "x": 1627974660000, + "y": 32, }, Object { - "x": 1627374600000, - "y": 20, + "x": 1627974720000, + "y": 36, }, Object { - "x": 1627374660000, - "y": 33, + "x": 1627974780000, + "y": 36, }, Object { - "x": 1627374720000, - "y": 0, + "x": 1627974840000, + "y": 22, }, Object { - "x": 1627374780000, - "y": 23, + "x": 1627974900000, + "y": 43, }, Object { - "x": 1627374840000, - "y": 16, + "x": 1627974960000, + "y": 31, }, Object { - "x": 1627374900000, - "y": 21, + "x": 1627975020000, + "y": 35, }, Object { - "x": 1627374960000, - "y": 19, + "x": 1627975080000, + "y": 37, }, Object { - "x": 1627375020000, - "y": 30, + "x": 1627975140000, + "y": 35, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ], @@ -678,635 +678,635 @@ Object { exports[`APM API tests basic apm_8.0.0 Service overview instances detailed statistics when data is loaded fetching data without comparison returns the right data 3`] = ` Object { "currentPeriod": Object { - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2": Object { + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad": Object { "cpuUsage": Array [ Object { - "x": 1627373280000, - "y": 0.002, - }, - Object { - "x": 1627373340000, + "x": 1627973400000, "y": 0.0015, }, Object { - "x": 1627373400000, + "x": 1627973460000, "y": 0.002, }, Object { - "x": 1627373460000, - "y": 0.002, + "x": 1627973520000, + "y": 0.0025, }, Object { - "x": 1627373520000, + "x": 1627973580000, "y": 0.0015, }, Object { - "x": 1627373580000, + "x": 1627973640000, "y": 0.002, }, Object { - "x": 1627373640000, + "x": 1627973700000, "y": 0.002, }, Object { - "x": 1627373700000, + "x": 1627973760000, "y": 0.002, }, Object { - "x": 1627373760000, + "x": 1627973820000, "y": 0.002, }, Object { - "x": 1627373820000, - "y": 0.0015, + "x": 1627973880000, + "y": 0.002, }, Object { - "x": 1627373880000, - "y": 0.0015, + "x": 1627973940000, + "y": 0.0045, }, Object { - "x": 1627373940000, - "y": 0.0035, + "x": 1627974000000, + "y": 0.0025, }, Object { - "x": 1627374000000, - "y": 0.003, + "x": 1627974060000, + "y": 0.0025, }, Object { - "x": 1627374060000, + "x": 1627974120000, "y": 0.002, }, Object { - "x": 1627374120000, + "x": 1627974180000, "y": 0.002, }, Object { - "x": 1627374180000, - "y": 0.002, + "x": 1627974240000, + "y": 0.0025, }, Object { - "x": 1627374240000, + "x": 1627974300000, "y": 0.0015, }, Object { - "x": 1627374300000, - "y": 0.002, + "x": 1627974360000, + "y": 0.001, }, Object { - "x": 1627374360000, - "y": 0.002, + "x": 1627974420000, + "y": 0.0025, }, Object { - "x": 1627374420000, - "y": 0.0025, + "x": 1627974480000, + "y": 0.0015, }, Object { - "x": 1627374480000, - "y": 0.002, + "x": 1627974540000, + "y": 0.0015, }, Object { - "x": 1627374540000, - "y": 0.007, + "x": 1627974600000, + "y": 0.0015, }, Object { - "x": 1627374600000, - "y": 0.002, + "x": 1627974660000, + "y": 0.0015, }, Object { - "x": 1627374660000, + "x": 1627974720000, "y": 0.002, }, Object { - "x": 1627374720000, + "x": 1627974780000, + "y": 0.0015, + }, + Object { + "x": 1627974840000, "y": 0.002, }, Object { - "x": 1627374780000, - "y": 0.0035, + "x": 1627974900000, + "y": 0.0025, }, Object { - "x": 1627374840000, - "y": 0.002, + "x": 1627974960000, + "y": 0.001, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0.002, }, Object { - "x": 1627374960000, - "y": 0.0015, + "x": 1627975080000, + "y": 0.002, }, Object { - "x": 1627375020000, - "y": 0.0015, + "x": 1627975140000, + "y": 0.0025, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], "errorRate": Array [ Object { - "x": 1627373280000, - "y": 0.121212121212121, - }, - Object { - "x": 1627373340000, - "y": 0.0714285714285714, + "x": 1627973400000, + "y": 0, }, Object { - "x": 1627373400000, + "x": 1627973460000, "y": 0, }, Object { - "x": 1627373460000, - "y": 0, + "x": 1627973520000, + "y": 0.0434782608695652, }, Object { - "x": 1627373520000, - "y": 0, + "x": 1627973580000, + "y": 0.0833333333333333, }, Object { - "x": 1627373580000, + "x": 1627973640000, "y": 0, }, Object { - "x": 1627373640000, + "x": 1627973700000, "y": 0, }, Object { - "x": 1627373700000, - "y": 0, + "x": 1627973760000, + "y": 0.03125, }, Object { - "x": 1627373760000, - "y": 0.0303030303030303, + "x": 1627973820000, + "y": 0.0555555555555556, }, Object { - "x": 1627373820000, - "y": null, + "x": 1627973880000, + "y": 0, }, Object { - "x": 1627373880000, + "x": 1627973940000, "y": 0, }, Object { - "x": 1627373940000, - "y": 0.0625, + "x": 1627974000000, + "y": 0.0232558139534884, }, Object { - "x": 1627374000000, - "y": 0.0476190476190476, + "x": 1627974060000, + "y": 0.032258064516129, }, Object { - "x": 1627374060000, + "x": 1627974120000, "y": 0, }, Object { - "x": 1627374120000, - "y": 0, + "x": 1627974180000, + "y": 0.027027027027027, }, Object { - "x": 1627374180000, - "y": 0, + "x": 1627974240000, + "y": 0.0571428571428571, }, Object { - "x": 1627374240000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374300000, - "y": 0.0714285714285714, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374360000, + "x": 1627974420000, "y": 0, }, Object { - "x": 1627374420000, - "y": 0.0263157894736842, + "x": 1627974480000, + "y": 0, }, Object { - "x": 1627374480000, - "y": 0.0294117647058824, + "x": 1627974540000, + "y": 0, }, Object { - "x": 1627374540000, - "y": 0, + "x": 1627974600000, + "y": 0.0526315789473684, }, Object { - "x": 1627374600000, - "y": 0.0465116279069767, + "x": 1627974660000, + "y": 0.142857142857143, }, Object { - "x": 1627374660000, + "x": 1627974720000, + "y": 0.0416666666666667, + }, + Object { + "x": 1627974780000, "y": 0, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374780000, - "y": 0.125, + "x": 1627974900000, + "y": 0.024390243902439, }, Object { - "x": 1627374840000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374960000, + "x": 1627975080000, "y": 0, }, Object { - "x": 1627375020000, - "y": 0, + "x": 1627975140000, + "y": 0.0555555555555556, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], "latency": Array [ Object { - "x": 1627373280000, - "y": 12008.6, + "x": 1627973400000, + "y": 11839, }, Object { - "x": 1627373340000, - "y": 10207, + "x": 1627973460000, + "y": 7407, }, Object { - "x": 1627373400000, - "y": 17692.1428571429, + "x": 1627973520000, + "y": 1925569.66666667, }, Object { - "x": 1627373460000, - "y": 13574.3846153846, + "x": 1627973580000, + "y": 9017.18181818182, }, Object { - "x": 1627373520000, - "y": 13247, + "x": 1627973640000, + "y": 63575, }, Object { - "x": 1627373580000, - "y": 10495, + "x": 1627973700000, + "y": 7577.66666666667, }, Object { - "x": 1627373640000, - "y": 25359, + "x": 1627973760000, + "y": 6844.33333333333, }, Object { - "x": 1627373700000, - "y": 15160.6, + "x": 1627973820000, + "y": 503471, }, Object { - "x": 1627373760000, - "y": 17819, + "x": 1627973880000, + "y": 6247.8, }, Object { - "x": 1627373820000, - "y": null, + "x": 1627973940000, + "y": 1137247, }, Object { - "x": 1627373880000, - "y": 12047, + "x": 1627974000000, + "y": 27951.6666666667, }, Object { - "x": 1627373940000, - "y": 15913.6666666667, + "x": 1627974060000, + "y": 10248.8461538462, }, Object { - "x": 1627374000000, - "y": 13746.2, + "x": 1627974120000, + "y": 13529, }, Object { - "x": 1627374060000, - "y": 9519, + "x": 1627974180000, + "y": 6691247.8, }, Object { - "x": 1627374120000, - "y": 34824.6, + "x": 1627974240000, + "y": 12098.6923076923, }, Object { - "x": 1627374180000, - "y": 9821.54545454545, + "x": 1627974300000, + "y": 34887.8888888889, }, Object { - "x": 1627374240000, - "y": 15175, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374300000, - "y": 11944.1428571429, + "x": 1627974420000, + "y": 4983, }, Object { - "x": 1627374360000, - "y": 10557.2222222222, + "x": 1627974480000, + "y": 41285.4, }, Object { - "x": 1627374420000, - "y": 25429.1538461538, + "x": 1627974540000, + "y": 13820.3333333333, }, Object { - "x": 1627374480000, - "y": 21736.1428571429, + "x": 1627974600000, + "y": 13782, }, Object { - "x": 1627374540000, - "y": 28604.3333333333, + "x": 1627974660000, + "y": 13392.6, }, Object { - "x": 1627374600000, - "y": 20103.5333333333, + "x": 1627974720000, + "y": 6991, }, Object { - "x": 1627374660000, - "y": 3311, + "x": 1627974780000, + "y": 6885.85714285714, }, Object { - "x": 1627374720000, - "y": 7521, + "x": 1627974840000, + "y": 7935, }, Object { - "x": 1627374780000, - "y": 8063, + "x": 1627974900000, + "y": 10828.3333333333, }, Object { - "x": 1627374840000, - "y": 8101.4, + "x": 1627974960000, + "y": 6079, }, Object { - "x": 1627374900000, - "y": 24196.3333333333, + "x": 1627975020000, + "y": 5217, }, Object { - "x": 1627374960000, - "y": 14157, + "x": 1627975080000, + "y": 8477.76923076923, }, Object { - "x": 1627375020000, - "y": 15103, + "x": 1627975140000, + "y": 5937.18181818182, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], "memoryUsage": Array [ Object { - "x": 1627373280000, - "y": 0.825572967529297, + "x": 1627973400000, + "y": 0.780715942382813, }, Object { - "x": 1627373340000, - "y": 0.825843811035156, + "x": 1627973460000, + "y": 0.780921936035156, }, Object { - "x": 1627373400000, - "y": 0.826179504394531, + "x": 1627973520000, + "y": 0.781166076660156, }, Object { - "x": 1627373460000, - "y": 0.82659912109375, + "x": 1627973580000, + "y": 0.781524658203125, }, Object { - "x": 1627373520000, - "y": 0.826702117919922, + "x": 1627973640000, + "y": 0.781723022460938, }, Object { - "x": 1627373580000, - "y": 0.826923370361328, + "x": 1627973700000, + "y": 0.782463073730469, }, Object { - "x": 1627373640000, - "y": 0.827106475830078, + "x": 1627973760000, + "y": 0.782634735107422, }, Object { - "x": 1627373700000, - "y": 0.827262878417969, + "x": 1627973820000, + "y": 0.782939910888672, }, Object { - "x": 1627373760000, - "y": 0.827518463134766, + "x": 1627973880000, + "y": 0.783458709716797, }, Object { - "x": 1627373820000, - "y": 0.827735900878906, + "x": 1627973940000, + "y": 0.783935546875, }, Object { - "x": 1627373880000, - "y": 0.827884674072266, + "x": 1627974000000, + "y": 0.784690856933594, }, Object { - "x": 1627373940000, - "y": 0.828010559082031, + "x": 1627974060000, + "y": 0.785182952880859, }, Object { - "x": 1627374000000, - "y": 0.823200225830078, + "x": 1627974120000, + "y": 0.785446166992188, }, Object { - "x": 1627374060000, - "y": 0.823371887207031, + "x": 1627974180000, + "y": 0.786224365234375, }, Object { - "x": 1627374120000, - "y": 0.823692321777344, + "x": 1627974240000, + "y": 0.786415100097656, }, Object { - "x": 1627374180000, - "y": 0.824100494384766, + "x": 1627974300000, + "y": 0.786640167236328, }, Object { - "x": 1627374240000, - "y": 0.824317932128906, + "x": 1627974360000, + "y": 0.786666870117188, }, Object { - "x": 1627374300000, - "y": 0.824752807617188, + "x": 1627974420000, + "y": 0.786960601806641, }, Object { - "x": 1627374360000, - "y": 0.825035095214844, + "x": 1627974480000, + "y": 0.787132263183594, }, Object { - "x": 1627374420000, - "y": 0.825420379638672, + "x": 1627974540000, + "y": 0.787441253662109, }, Object { - "x": 1627374480000, - "y": 0.825778961181641, + "x": 1627974600000, + "y": 0.787555694580078, }, Object { - "x": 1627374540000, - "y": 0.823772430419922, + "x": 1627974660000, + "y": 0.788524627685547, }, Object { - "x": 1627374600000, - "y": 0.824184417724609, + "x": 1627974720000, + "y": 0.788822174072266, }, Object { - "x": 1627374660000, - "y": 0.824348449707031, + "x": 1627974780000, + "y": 0.789054870605469, }, Object { - "x": 1627374720000, - "y": 0.824550628662109, + "x": 1627974840000, + "y": 0.78936767578125, }, Object { - "x": 1627374780000, - "y": 0.826988220214844, + "x": 1627974900000, + "y": 0.789985656738281, }, Object { - "x": 1627374840000, - "y": 0.82958984375, + "x": 1627974960000, + "y": 0.790130615234375, }, Object { - "x": 1627374900000, - "y": 0.829998016357422, + "x": 1627975020000, + "y": 0.790508270263672, }, Object { - "x": 1627374960000, - "y": 0.830215454101563, + "x": 1627975080000, + "y": 0.791069030761719, }, Object { - "x": 1627375020000, - "y": 0.830368041992188, + "x": 1627975140000, + "y": 0.791587829589844, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ], - "serviceNodeName": "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "serviceNodeName": "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", "throughput": Array [ Object { - "x": 1627373280000, - "y": 33, + "x": 1627973400000, + "y": 15, }, Object { - "x": 1627373340000, - "y": 14, + "x": 1627973460000, + "y": 13, }, Object { - "x": 1627373400000, - "y": 42, + "x": 1627973520000, + "y": 23, }, Object { - "x": 1627373460000, - "y": 43, + "x": 1627973580000, + "y": 24, }, Object { - "x": 1627373520000, - "y": 4, + "x": 1627973640000, + "y": 10, }, Object { - "x": 1627373580000, - "y": 19, + "x": 1627973700000, + "y": 18, }, Object { - "x": 1627373640000, - "y": 22, + "x": 1627973760000, + "y": 32, }, Object { - "x": 1627373700000, - "y": 20, + "x": 1627973820000, + "y": 36, }, Object { - "x": 1627373760000, - "y": 33, + "x": 1627973880000, + "y": 36, }, Object { - "x": 1627373820000, - "y": 0, + "x": 1627973940000, + "y": 22, }, Object { - "x": 1627373880000, - "y": 23, + "x": 1627974000000, + "y": 43, }, Object { - "x": 1627373940000, - "y": 16, + "x": 1627974060000, + "y": 31, }, Object { - "x": 1627374000000, - "y": 21, + "x": 1627974120000, + "y": 35, }, Object { - "x": 1627374060000, - "y": 19, + "x": 1627974180000, + "y": 37, }, Object { - "x": 1627374120000, - "y": 30, + "x": 1627974240000, + "y": 35, }, Object { - "x": 1627374180000, - "y": 39, + "x": 1627974300000, + "y": 21, }, Object { - "x": 1627374240000, - "y": 30, + "x": 1627974360000, + "y": 0, }, Object { - "x": 1627374300000, - "y": 28, + "x": 1627974420000, + "y": 24, }, Object { - "x": 1627374360000, - "y": 37, + "x": 1627974480000, + "y": 17, }, Object { - "x": 1627374420000, - "y": 38, + "x": 1627974540000, + "y": 17, }, Object { - "x": 1627374480000, - "y": 34, + "x": 1627974600000, + "y": 19, }, Object { - "x": 1627374540000, - "y": 51, + "x": 1627974660000, + "y": 21, }, Object { - "x": 1627374600000, - "y": 43, + "x": 1627974720000, + "y": 24, }, Object { - "x": 1627374660000, - "y": 9, + "x": 1627974780000, + "y": 22, }, Object { - "x": 1627374720000, - "y": 23, + "x": 1627974840000, + "y": 19, }, Object { - "x": 1627374780000, - "y": 8, + "x": 1627974900000, + "y": 41, }, Object { - "x": 1627374840000, - "y": 28, + "x": 1627974960000, + "y": 11, }, Object { - "x": 1627374900000, - "y": 32, + "x": 1627975020000, + "y": 23, }, Object { - "x": 1627374960000, - "y": 25, + "x": 1627975080000, + "y": 47, }, Object { - "x": 1627375020000, - "y": 8, + "x": 1627975140000, + "y": 36, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ], diff --git a/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts b/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts index 2ea0410419080..4f10ee6ff6bd8 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/dependencies/index.ts @@ -344,11 +344,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(firstItem.location).toMatchInline(` Object { - "backendName": "postgresql", - "id": "d4e2a4d33829d41c096c26f8037921cfc7e566b2", - "spanSubtype": "postgresql", - "spanType": "db", - "type": "backend", + "agentName": "dotnet", + "environment": "production", + "id": "5948c153c2d8989f92a9c75ef45bb845f53e200d", + "serviceName": "opbeans-dotnet", + "type": "service", } `); @@ -361,14 +361,14 @@ export default function ApiTest({ getService }: FtrProviderContext) { ).toMatchInline(` Object { "errorRate": Object { - "value": 0.00308832612723904, + "value": 0.163636363636364, }, "impact": 100, "latency": Object { - "value": 30177.8418777023, + "value": 1117085.74545455, }, "throughput": Object { - "value": 53.9666666666667, + "value": 1.83333333333333, }, } `); @@ -379,7 +379,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(names.sort()).toMatchInline(` Array [ "elasticsearch", - "opbeans-python", + "opbeans-dotnet", "postgresql", "redis", ] @@ -395,7 +395,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(serviceNames.sort()).toMatchInline(` Array [ - "opbeans-python", + "opbeans-dotnet", ] `); }); @@ -412,19 +412,19 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(latencyValues).toMatchInline(` Array [ Object { - "latency": 10125.412371134, + "latency": 9496.32291666667, "name": "elasticsearch", }, Object { - "latency": 42984.2941176471, - "name": "opbeans-python", + "latency": 1117085.74545455, + "name": "opbeans-dotnet", }, Object { - "latency": 30177.8418777023, + "latency": 27826.9968314322, "name": "postgresql", }, Object { - "latency": 1341.11624072547, + "latency": 1468.27242524917, "name": "redis", }, ] @@ -444,19 +444,19 @@ export default function ApiTest({ getService }: FtrProviderContext) { Array [ Object { "name": "elasticsearch", - "throughput": 3.23333333333333, + "throughput": 3.2, }, Object { - "name": "opbeans-python", - "throughput": 1.7, + "name": "opbeans-dotnet", + "throughput": 1.83333333333333, }, Object { "name": "postgresql", - "throughput": 53.9666666666667, + "throughput": 52.6, }, Object { "name": "redis", - "throughput": 40.4333333333333, + "throughput": 40.1333333333333, }, ] `); @@ -477,27 +477,27 @@ export default function ApiTest({ getService }: FtrProviderContext) { Array [ Object { "impact": 0, - "latency": 10125.412371134, + "latency": 9496.32291666667, "name": "elasticsearch", - "throughput": 3.23333333333333, + "throughput": 3.2, }, Object { - "impact": 2.52744598670713, - "latency": 42984.2941176471, - "name": "opbeans-python", - "throughput": 1.7, + "impact": 100, + "latency": 1117085.74545455, + "name": "opbeans-dotnet", + "throughput": 1.83333333333333, }, Object { - "impact": 100, - "latency": 30177.8418777023, + "impact": 71.0403531954737, + "latency": 27826.9968314322, "name": "postgresql", - "throughput": 53.9666666666667, + "throughput": 52.6, }, Object { - "impact": 1.34642037334926, - "latency": 1341.11624072547, + "impact": 1.41447268043525, + "latency": 1468.27242524917, "name": "redis", - "throughput": 40.4333333333333, + "throughput": 40.1333333333333, }, ] `); diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.ts b/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.ts index a7de1676ea39b..e5a2e1c11bfc6 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/instances_detailed_statistics.ts @@ -106,7 +106,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(Object.keys(response.body.currentPeriod)).toMatchInline(` Array [ - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", ] `); @@ -173,12 +173,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(Object.keys(response.body.currentPeriod)).toMatchInline(` Array [ - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", ] `); expectSnapshot(Object.keys(response.body.previousPeriod)).toMatchInline(` Array [ - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", ] `); diff --git a/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts b/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts index bfe2842d1ad93..371e4d1910798 100644 --- a/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/service_overview/instances_main_statistics.ts @@ -97,7 +97,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(serviceNodeNames).toMatchInline(` Array [ - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", ] `); @@ -113,11 +113,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(values).toMatchInline(` Object { - "cpuUsage": 0.0022, - "errorRate": 0.0194300518134715, - "latency": 17660.3103448276, - "memoryUsage": 0.826234181722005, - "throughput": 25.7333333333333, + "cpuUsage": 0.002, + "errorRate": 0.0252659574468085, + "latency": 411589.785714286, + "memoryUsage": 0.786029688517253, + "throughput": 25.0666666666667, } `); }); @@ -162,7 +162,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(serviceNodeNames).toMatchInline(` Array [ - "399a87146c0036592f6ee78553324b10c00757e024143913c97993384751e15e", + "b4c600993a0b233120cd333b8c4a7e35e73ee8f18f95b5854b8d7f6442531466", ] `); @@ -172,10 +172,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(values).toMatchInline(` Object { - "cpuUsage": 0.00108333333333333, - "errorRate": 0.000779423226812159, - "latency": 44571.2584615385, - "throughput": 42.7666666666667, + "cpuUsage": 0.001, + "errorRate": 0.000907441016333938, + "latency": 40989.5802047782, + "throughput": 36.7333333333333, } `); @@ -243,7 +243,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(serviceNodeNames).toMatchInline(` Array [ - "6dc7ea7824d0887cdfa0cb876bca5b27346c8b7cd196a9b1a6fe91968b99fbc2", + "31651f3c624b81c55dd4633df0b5b9f9ab06b151121b0404ae796632cd1f87ad", ] `); @@ -259,11 +259,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(values).toMatchInline(` Object { - "cpuUsage": 0.00203333333333333, - "errorRate": 0.023598820058997, - "latency": 16843.0833333333, - "memoryUsage": 0.82624028523763, - "throughput": 22.6, + "cpuUsage": 0.00223333333333333, + "errorRate": 0.0268292682926829, + "latency": 739013.634146341, + "memoryUsage": 0.783296203613281, + "throughput": 27.3333333333333, } `); }); diff --git a/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_detailed_statistics.snap b/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_detailed_statistics.snap index f406927fa7128..0c341d6106e98 100644 --- a/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_detailed_statistics.snap +++ b/x-pack/test/apm_api_integration/tests/services/__snapshots__/error_groups_detailed_statistics.snap @@ -2,130 +2,130 @@ exports[`APM API tests basic apm_8.0.0 Error groups detailed statistics when data is loaded returns the correct data 1`] = ` Object { - "groupId": "237562dfa8b8ab4eb94f22c87e42112b", + "groupId": "1f716bc1e7234ff5119ac615d1b90b6e", "timeseries": Array [ Object { - "x": 1627373280000, + "x": 1627973400000, "y": 0, }, Object { - "x": 1627373340000, + "x": 1627973460000, "y": 0, }, Object { - "x": 1627373400000, + "x": 1627973520000, "y": 0, }, Object { - "x": 1627373460000, + "x": 1627973580000, "y": 0, }, Object { - "x": 1627373520000, + "x": 1627973640000, "y": 0, }, Object { - "x": 1627373580000, + "x": 1627973700000, "y": 0, }, Object { - "x": 1627373640000, + "x": 1627973760000, "y": 0, }, Object { - "x": 1627373700000, + "x": 1627973820000, "y": 0, }, Object { - "x": 1627373760000, + "x": 1627973880000, "y": 0, }, Object { - "x": 1627373820000, + "x": 1627973940000, "y": 0, }, Object { - "x": 1627373880000, + "x": 1627974000000, "y": 0, }, Object { - "x": 1627373940000, + "x": 1627974060000, "y": 0, }, Object { - "x": 1627374000000, + "x": 1627974120000, "y": 0, }, Object { - "x": 1627374060000, + "x": 1627974180000, "y": 0, }, Object { - "x": 1627374120000, + "x": 1627974240000, "y": 0, }, Object { - "x": 1627374180000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374240000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374300000, - "y": 1, + "x": 1627974420000, + "y": 0, }, Object { - "x": 1627374360000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374420000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374480000, - "y": 0, + "x": 1627974600000, + "y": 1, }, Object { - "x": 1627374540000, + "x": 1627974660000, "y": 0, }, Object { - "x": 1627374600000, + "x": 1627974720000, "y": 0, }, Object { - "x": 1627374660000, + "x": 1627974780000, "y": 0, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374780000, + "x": 1627974900000, "y": 0, }, Object { - "x": 1627374840000, - "y": 1, + "x": 1627974960000, + "y": 0, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374960000, - "y": 1, + "x": 1627975080000, + "y": 0, }, Object { - "x": 1627375020000, + "x": 1627975140000, "y": 0, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ], @@ -134,70 +134,70 @@ Object { exports[`APM API tests basic apm_8.0.0 Error groups detailed statistics when data is loaded with previous data returns the correct data returns correct timeseries 1`] = ` Object { - "groupId": "237562dfa8b8ab4eb94f22c87e42112b", + "groupId": "1f716bc1e7234ff5119ac615d1b90b6e", "timeseries": Array [ Object { - "x": 1627374180000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374240000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374300000, - "y": 1, + "x": 1627974420000, + "y": 0, }, Object { - "x": 1627374360000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374420000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374480000, - "y": 0, + "x": 1627974600000, + "y": 1, }, Object { - "x": 1627374540000, + "x": 1627974660000, "y": 0, }, Object { - "x": 1627374600000, + "x": 1627974720000, "y": 0, }, Object { - "x": 1627374660000, + "x": 1627974780000, "y": 0, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374780000, + "x": 1627974900000, "y": 0, }, Object { - "x": 1627374840000, - "y": 1, + "x": 1627974960000, + "y": 0, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374960000, - "y": 1, + "x": 1627975080000, + "y": 0, }, Object { - "x": 1627375020000, + "x": 1627975140000, "y": 0, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ], diff --git a/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap b/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap index 1ceafc24afbd7..a52084ffef43b 100644 --- a/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap +++ b/x-pack/test/apm_api_integration/tests/services/__snapshots__/throughput.snap @@ -3,127 +3,127 @@ exports[`APM API tests basic apm_8.0.0 Throughput when data is loaded has the correct throughput 1`] = ` Array [ Object { - "x": 1627373280000, - "y": 10, - }, - Object { - "x": 1627373340000, + "x": 1627973400000, "y": 4, }, Object { - "x": 1627373400000, - "y": 11, + "x": 1627973460000, + "y": 2, }, Object { - "x": 1627373460000, - "y": 13, + "x": 1627973520000, + "y": 3, }, Object { - "x": 1627373520000, - "y": 1, + "x": 1627973580000, + "y": 8, }, Object { - "x": 1627373580000, - "y": 5, + "x": 1627973640000, + "y": 4, }, Object { - "x": 1627373640000, + "x": 1627973700000, "y": 4, }, Object { - "x": 1627373700000, - "y": 5, + "x": 1627973760000, + "y": 6, }, Object { - "x": 1627373760000, + "x": 1627973820000, "y": 10, }, Object { - "x": 1627373820000, - "y": 0, + "x": 1627973880000, + "y": 8, }, Object { - "x": 1627373880000, - "y": 5, + "x": 1627973940000, + "y": 9, }, Object { - "x": 1627373940000, - "y": 3, + "x": 1627974000000, + "y": 10, }, Object { - "x": 1627374000000, - "y": 4, + "x": 1627974060000, + "y": 11, }, Object { - "x": 1627374060000, - "y": 4, + "x": 1627974120000, + "y": 7, }, Object { - "x": 1627374120000, - "y": 8, + "x": 1627974180000, + "y": 10, }, Object { - "x": 1627374180000, - "y": 10, + "x": 1627974240000, + "y": 12, }, Object { - "x": 1627374240000, - "y": 11, + "x": 1627974300000, + "y": 6, }, Object { - "x": 1627374300000, - "y": 7, + "x": 1627974360000, + "y": 0, }, Object { - "x": 1627374360000, - "y": 9, + "x": 1627974420000, + "y": 4, }, Object { - "x": 1627374420000, - "y": 11, + "x": 1627974480000, + "y": 3, }, Object { - "x": 1627374480000, + "x": 1627974540000, "y": 5, }, Object { - "x": 1627374540000, - "y": 17, + "x": 1627974600000, + "y": 5, }, Object { - "x": 1627374600000, - "y": 14, + "x": 1627974660000, + "y": 5, }, Object { - "x": 1627374660000, - "y": 1, + "x": 1627974720000, + "y": 4, }, Object { - "x": 1627374720000, - "y": 5, + "x": 1627974780000, + "y": 7, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": 2, }, Object { - "x": 1627374840000, - "y": 4, + "x": 1627974900000, + "y": 14, }, Object { - "x": 1627374900000, - "y": 10, + "x": 1627974960000, + "y": 3, }, Object { - "x": 1627374960000, - "y": 8, + "x": 1627975020000, + "y": 6, }, Object { - "x": 1627375020000, - "y": 2, + "x": 1627975080000, + "y": 12, }, Object { - "x": 1627375080000, + "x": 1627975140000, + "y": 8, + }, + Object { + "x": 1627975200000, "y": 0, }, ] @@ -133,133 +133,133 @@ exports[`APM API tests basic apm_8.0.0 Throughput when data is loaded with time Object { "currentPeriod": Array [ Object { - "x": 1627374180000, - "y": 10, + "x": 1627974300000, + "y": 6, }, Object { - "x": 1627374240000, - "y": 11, + "x": 1627974360000, + "y": 0, }, Object { - "x": 1627374300000, - "y": 7, + "x": 1627974420000, + "y": 4, }, Object { - "x": 1627374360000, - "y": 9, + "x": 1627974480000, + "y": 3, }, Object { - "x": 1627374420000, - "y": 11, + "x": 1627974540000, + "y": 5, }, Object { - "x": 1627374480000, + "x": 1627974600000, "y": 5, }, Object { - "x": 1627374540000, - "y": 17, + "x": 1627974660000, + "y": 5, }, Object { - "x": 1627374600000, - "y": 14, + "x": 1627974720000, + "y": 4, }, Object { - "x": 1627374660000, - "y": 1, + "x": 1627974780000, + "y": 7, }, Object { - "x": 1627374720000, - "y": 5, + "x": 1627974840000, + "y": 2, }, Object { - "x": 1627374780000, - "y": 2, + "x": 1627974900000, + "y": 14, }, Object { - "x": 1627374840000, - "y": 4, + "x": 1627974960000, + "y": 3, }, Object { - "x": 1627374900000, - "y": 10, + "x": 1627975020000, + "y": 6, }, Object { - "x": 1627374960000, - "y": 8, + "x": 1627975080000, + "y": 12, }, Object { - "x": 1627375020000, - "y": 2, + "x": 1627975140000, + "y": 8, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ], "previousPeriod": Array [ Object { - "x": 1627374180000, - "y": 10, - }, - Object { - "x": 1627374240000, + "x": 1627974300000, "y": 4, }, Object { - "x": 1627374300000, - "y": 11, + "x": 1627974360000, + "y": 2, }, Object { - "x": 1627374360000, - "y": 13, + "x": 1627974420000, + "y": 3, }, Object { - "x": 1627374420000, - "y": 1, + "x": 1627974480000, + "y": 8, }, Object { - "x": 1627374480000, - "y": 5, + "x": 1627974540000, + "y": 4, }, Object { - "x": 1627374540000, + "x": 1627974600000, "y": 4, }, Object { - "x": 1627374600000, - "y": 5, + "x": 1627974660000, + "y": 6, }, Object { - "x": 1627374660000, + "x": 1627974720000, "y": 10, }, Object { - "x": 1627374720000, - "y": 0, + "x": 1627974780000, + "y": 8, }, Object { - "x": 1627374780000, - "y": 5, + "x": 1627974840000, + "y": 9, }, Object { - "x": 1627374840000, - "y": 3, + "x": 1627974900000, + "y": 10, }, Object { - "x": 1627374900000, - "y": 4, + "x": 1627974960000, + "y": 11, }, Object { - "x": 1627374960000, - "y": 4, + "x": 1627975020000, + "y": 7, }, Object { - "x": 1627375020000, - "y": 8, + "x": 1627975080000, + "y": 10, + }, + Object { + "x": 1627975140000, + "y": 12, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ], diff --git a/x-pack/test/apm_api_integration/tests/services/error_groups_main_statistics.ts b/x-pack/test/apm_api_integration/tests/services/error_groups_main_statistics.ts index c07aa997d71a6..3b91cb947c7f7 100644 --- a/x-pack/test/apm_api_integration/tests/services/error_groups_main_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/services/error_groups_main_statistics.ts @@ -76,9 +76,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { "Response status 404", "No converter found for return value of type: class com.sun.proxy.$Proxy162", "Response status 404", - "Connection reset by peer", + "Broken pipe", + "java.io.IOException: Connection reset by peer", "Request method 'POST' not supported", - "java.io.IOException: Broken pipe", + "java.io.IOException: Connection reset by peer", + "null", ] `); @@ -90,11 +92,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(occurences).toMatchInline(` Array [ + 17, 12, - 11, + 4, + 4, 3, 2, - 2, + 1, 1, ] `); @@ -104,9 +108,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(firstItem).toMatchInline(` Object { "group_id": "d16d39e7fa133b8943cea035430a7b4e", - "last_seen": 1627374613628, + "last_seen": 1627975146078, "name": "Response status 404", - "occurrences": 12, + "occurrences": 17, } `); }); diff --git a/x-pack/test/apm_api_integration/tests/services/service_details.ts b/x-pack/test/apm_api_integration/tests/services/service_details.ts index 1e2ee3cc757b6..1f4b4a2c9909b 100644 --- a/x-pack/test/apm_api_integration/tests/services/service_details.ts +++ b/x-pack/test/apm_api_integration/tests/services/service_details.ts @@ -69,7 +69,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }, "service": Object { "agent": Object { - "ephemeral_id": "1f810e6f-e78a-4f49-9773-2142b9af9943", + "ephemeral_id": "2745d454-f57f-4473-a09b-fe6bef295860", "name": "java", "version": "1.25.1-SNAPSHOT.UNKNOWN", }, @@ -78,7 +78,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { "version": "11.0.11", }, "versions": Array [ - "2021-07-27 03:47:01", + "2021-08-03 04:26:27", ], }, } @@ -124,7 +124,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { "version": "3.9.6", }, "versions": Array [ - "2021-07-27 03:46:59", + "2021-08-03 04:26:25", ], }, } diff --git a/x-pack/test/apm_api_integration/tests/services/throughput.ts b/x-pack/test/apm_api_integration/tests/services/throughput.ts index b7432d19b9b46..c9c7d43762e7e 100644 --- a/x-pack/test/apm_api_integration/tests/services/throughput.ts +++ b/x-pack/test/apm_api_integration/tests/services/throughput.ts @@ -68,13 +68,13 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('has the correct start date', () => { expectSnapshot( new Date(first(throughputResponse.currentPeriod)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-07-27T08:08:00.000Z"`); + ).toMatchInline(`"2021-08-03T06:50:00.000Z"`); }); it('has the correct end date', () => { expectSnapshot( new Date(last(throughputResponse.currentPeriod)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-07-27T08:38:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); }); it('has the correct number of buckets', () => { @@ -122,21 +122,21 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('has the correct start date', () => { expectSnapshot( new Date(first(throughputResponse.currentPeriod)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-07-27T08:23:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); expectSnapshot( new Date(first(throughputResponse.previousPeriod)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-07-27T08:23:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); }); it('has the correct end date', () => { expectSnapshot( new Date(last(throughputResponse.currentPeriod)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-07-27T08:38:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); expectSnapshot( new Date(last(throughputResponse.previousPeriod)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-07-27T08:38:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); }); it('has the correct number of buckets', () => { diff --git a/x-pack/test/apm_api_integration/tests/services/top_services.ts b/x-pack/test/apm_api_integration/tests/services/top_services.ts index 7ea62ccd7d700..d99304cb8c47f 100644 --- a/x-pack/test/apm_api_integration/tests/services/top_services.ts +++ b/x-pack/test/apm_api_integration/tests/services/top_services.ts @@ -72,8 +72,6 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(sortedItems.map((item) => item.serviceName)).toMatchInline(` Array [ "auditbeat", - "kibana", - "kibana-frontend", "opbeans-dotnet", "opbeans-go", "opbeans-java", @@ -92,49 +90,81 @@ export default function ApiTest({ getService }: FtrProviderContext) { Array [ Object {}, Object { - "latency": 658101.291021672, - "throughput": 75.3666666666667, - "transactionErrorRate": 0, + "latency": Object { + "value": 520294.126436782, + }, + "transactionErrorRate": Object { + "value": 0.0316091954022989, + }, + "throughput": Object { + "value": 11.6, + }, }, Object { - "latency": 3588095, - "throughput": 0.133333333333333, - "transactionErrorRate": null, + "latency": Object { + "value": 74805.1452830189, + }, + "transactionErrorRate": Object { + "value": 0.00566037735849057, + }, + "throughput": Object { + "value": 17.6666666666667, + }, }, Object { - "latency": 586249.027027027, - "throughput": 9.86666666666667, - "transactionErrorRate": 0.00337837837837838, + "latency": Object { + "value": 411589.785714286, + }, + "transactionErrorRate": Object { + "value": 0.0848214285714286, + }, + "throughput": Object { + "value": 7.46666666666667, + }, }, Object { - "latency": 218838.954459203, - "throughput": 17.5666666666667, - "transactionErrorRate": 0.0113851992409867, + "latency": Object { + "value": 53906.6603773585, + }, + "transactionErrorRate": Object { + "value": 0, + }, + "throughput": Object { + "value": 7.06666666666667, + }, }, Object { - "latency": 17660.3103448276, - "throughput": 7.73333333333333, - "transactionErrorRate": 0.0646551724137931, + "latency": Object { + "value": 420634.9, + }, + "transactionErrorRate": Object { + "value": 0.025, + }, + "throughput": Object { + "value": 5.33333333333333, + }, }, Object { - "latency": 22281.4255319149, - "throughput": 6.26666666666667, - "transactionErrorRate": 0.00531914893617021, + "latency": Object { + "value": 40989.5802047782, + }, + "transactionErrorRate": Object { + "value": 0.00341296928327645, + }, + "throughput": Object { + "value": 9.76666666666667, + }, }, Object { - "latency": 243948.538461538, - "throughput": 5.2, - "transactionErrorRate": 0.032051282051282, - }, - Object { - "latency": 44571.2584615385, - "throughput": 10.8333333333333, - "transactionErrorRate": 0.00307692307692308, - }, - Object { - "latency": 1381526.7037037, - "throughput": 1.8, - "transactionErrorRate": null, + "latency": Object { + "value": 1040880.77777778, + }, + "transactionErrorRate": Object { + "value": null, + }, + "throughput": Object { + "value": 2.4, + }, }, ] `); @@ -143,12 +173,6 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('returns environments', () => { expectSnapshot(sortedItems.map((item) => item.environments ?? [])).toMatchInline(` Array [ - Array [ - "production", - ], - Array [ - "production", - ], Array [ "production", ], @@ -281,12 +305,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { "healthy", "healthy", "healthy", - undefined, "healthy", - undefined, "healthy", "healthy", - undefined, + "healthy", ] `); }); diff --git a/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts b/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts index 34a789ad78ef0..166c95b5f6de7 100644 --- a/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts +++ b/x-pack/test/apm_api_integration/tests/settings/agent_configuration.ts @@ -392,8 +392,6 @@ export default function agentConfigurationTests({ getService }: FtrProviderConte "serviceNames": Array [ "ALL_OPTION_VALUE", "auditbeat", - "kibana", - "kibana-frontend", "opbeans-dotnet", "opbeans-go", "opbeans-java", diff --git a/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap b/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap index 9f35d078fe19d..604348355f38c 100644 --- a/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap +++ b/x-pack/test/apm_api_integration/tests/traces/__snapshots__/top_traces.snap @@ -3,7 +3,7 @@ exports[`APM API tests basic apm_8.0.0 Top traces when data is loaded returns the correct buckets 1`] = ` Array [ Object { - "averageResponseTime": 1663, + "averageResponseTime": 1639, "impact": 0, "key": Object { "service.name": "opbeans-java", @@ -15,8 +15,8 @@ Array [ "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 1841.66666666667, - "impact": 0.00245766214004374, + "averageResponseTime": 3279, + "impact": 0.00144735571024101, "key": Object { "service.name": "opbeans-node", "transaction.name": "POST /api/orders", @@ -24,371 +24,359 @@ Array [ "serviceName": "opbeans-node", "transactionName": "POST /api/orders", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 3023, - "impact": 0.00278921107193467, + "averageResponseTime": 6175, + "impact": 0.00400317408637392, "key": Object { - "service.name": "kibana", - "transaction.name": "GET /translations/?.json", + "service.name": "opbeans-node", + "transaction.name": "GET /api/products/:id", }, - "serviceName": "kibana", - "transactionName": "GET /translations/?.json", + "serviceName": "opbeans-node", + "transactionName": "GET /api/products/:id", "transactionType": "request", - "transactionsPerMinute": 0.0666666666666667, + "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 4447, - "impact": 0.00460159371689701, + "averageResponseTime": 3495, + "impact": 0.00472243927164613, "key": Object { - "service.name": "kibana", - "transaction.name": "GET /ui/#", + "service.name": "opbeans-dotnet", + "transaction.name": "POST Orders/Post", }, - "serviceName": "kibana", - "transactionName": "GET /ui/#", + "serviceName": "opbeans-dotnet", + "transactionName": "POST Orders/Post", "transactionType": "request", "transactionsPerMinute": 0.0666666666666667, }, Object { - "averageResponseTime": 11007, - "impact": 0.00594624418347195, + "averageResponseTime": 7039, + "impact": 0.00476568343615943, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/orders/:id", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.product", }, - "serviceName": "opbeans-node", - "transactionName": "GET /api/orders/:id", + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.product", "transactionType": "request", "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 4292.33333333333, - "impact": 0.00713625666453922, + "averageResponseTime": 6303, + "impact": 0.00967875004525193, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/products/:id", + "service.name": "opbeans-ruby", + "transaction.name": "Api::OrdersController#create", }, - "serviceName": "opbeans-node", - "transactionName": "GET /api/products/:id", + "serviceName": "opbeans-ruby", + "transactionName": "Api::OrdersController#create", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.0666666666666667, }, Object { - "averageResponseTime": 15807, - "impact": 0.00900082167498151, + "averageResponseTime": 7209.66666666667, + "impact": 0.0176418540534865, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "POST /api", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#products", }, - "serviceName": "opbeans-node", - "transactionName": "POST /api", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#products", "transactionType": "request", - "transactionsPerMinute": 0.0333333333333333, + "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 7135, - "impact": 0.0125632226744545, + "averageResponseTime": 4511, + "impact": 0.0224401912465233, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/products", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#orders", }, - "serviceName": "opbeans-node", - "transactionName": "GET /api/products", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#orders", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 2803, - "impact": 0.0132116840210896, + "averageResponseTime": 7607, + "impact": 0.0254072704525173, "key": Object { - "service.name": "kibana", - "transaction.name": "GET /#", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.order", }, - "serviceName": "kibana", - "transactionName": "GET /#", + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.order", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 5675.8, - "impact": 0.0170012692214936, + "averageResponseTime": 10143, + "impact": 0.025408152986487, "key": Object { "service.name": "opbeans-node", - "transaction.name": "GET /api/customers/:id", + "transaction.name": "GET /api/types", }, "serviceName": "opbeans-node", - "transactionName": "GET /api/customers/:id", + "transactionName": "GET /api/types", "transactionType": "request", - "transactionsPerMinute": 0.166666666666667, + "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 3316.33333333333, - "impact": 0.017935460837647, + "averageResponseTime": 6105.66666666667, + "impact": 0.0308842762682221, "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Products/Get", + "service.name": "opbeans-ruby", + "transaction.name": "Api::TypesController#index", }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Products/Get", + "serviceName": "opbeans-ruby", + "transactionName": "Api::TypesController#index", "transactionType": "request", - "transactionsPerMinute": 0.3, + "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 11391, - "impact": 0.02068839880187, + "averageResponseTime": 6116.33333333333, + "impact": 0.0309407584422802, "key": Object { - "service.name": "opbeans-go", - "transaction.name": "POST /api/orders", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#customerWhoBought", }, - "serviceName": "opbeans-go", - "transactionName": "POST /api/orders", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#customerWhoBought", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 8389.4, - "impact": 0.025635541597494, + "averageResponseTime": 12543, + "impact": 0.0317623975680329, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/products/top", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#customers", }, - "serviceName": "opbeans-node", - "transactionName": "GET /api/products/top", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#customers", "transactionType": "request", - "transactionsPerMinute": 0.166666666666667, + "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 7017.66666666667, - "impact": 0.0257367244769003, + "averageResponseTime": 5551, + "impact": 0.0328461492827744, "key": Object { "service.name": "opbeans-node", - "transaction.name": "GET /api/orders", + "transaction.name": "GET /api/orders/:id", }, "serviceName": "opbeans-node", - "transactionName": "GET /api/orders", + "transactionName": "GET /api/orders/:id", "transactionType": "request", - "transactionsPerMinute": 0.2, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 9023, - "impact": 0.0276515627418903, + "averageResponseTime": 13183, + "impact": 0.0334568627897785, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/types/:id", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#stats", }, - "serviceName": "opbeans-node", - "transactionName": "GET /api/types/:id", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#stats", "transactionType": "request", - "transactionsPerMinute": 0.166666666666667, + "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 8169.66666666667, - "impact": 0.030135316064674, + "averageResponseTime": 8050.2, + "impact": 0.0340764016364792, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.order", + "service.name": "opbeans-go", + "transaction.name": "POST /api/orders", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.order", + "serviceName": "opbeans-go", + "transactionName": "POST /api/orders", "transactionType": "request", - "transactionsPerMinute": 0.2, + "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 12351, - "impact": 0.0303809550046163, + "averageResponseTime": 10079, + "impact": 0.0341337663445071, "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#products", + "service.name": "opbeans-ruby", + "transaction.name": "Api::OrdersController#show", }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#products", + "serviceName": "opbeans-ruby", + "transactionName": "Api::OrdersController#show", "transactionType": "request", "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 4125.66666666667, - "impact": 0.0304471375169323, + "averageResponseTime": 8463, + "impact": 0.0358979517498557, "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Products/Get {id}", + "service.name": "opbeans-node", + "transaction.name": "GET /api/products/:id/customers", }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Products/Get {id}", + "serviceName": "opbeans-node", + "transactionName": "GET /api/products/:id/customers", "transactionType": "request", - "transactionsPerMinute": 0.4, + "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 17385.6666666667, - "impact": 0.0321328824700591, + "averageResponseTime": 10799, + "impact": 0.0366754641771254, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.products", + "service.name": "opbeans-ruby", + "transaction.name": "Api::ProductsController#show", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.products", + "serviceName": "opbeans-ruby", + "transactionName": "Api::ProductsController#show", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 10161.6666666667, - "impact": 0.0377412140185328, + "averageResponseTime": 7428.33333333333, + "impact": 0.0378880658514371, "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/types", + "service.name": "opbeans-ruby", + "transaction.name": "Api::TypesController#show", }, - "serviceName": "opbeans-node", - "transactionName": "GET /api/types", + "serviceName": "opbeans-ruby", + "transactionName": "Api::TypesController#show", "transactionType": "request", "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 8691, - "impact": 0.0431872711377701, + "averageResponseTime": 3105.13333333333, + "impact": 0.039659311528543, "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::TypesController#show", + "service.name": "opbeans-java", + "transaction.name": "ResourceHttpRequestHandler", }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::TypesController#show", + "serviceName": "opbeans-java", + "transactionName": "ResourceHttpRequestHandler", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.5, }, Object { - "averageResponseTime": 8269.22222222222, - "impact": 0.0463023038087991, + "averageResponseTime": 6883.57142857143, + "impact": 0.0410784261517549, "key": Object { "service.name": "opbeans-java", - "transaction.name": "APIRestController#topProducts", + "transaction.name": "APIRestController#order", }, "serviceName": "opbeans-java", - "transactionName": "APIRestController#topProducts", + "transactionName": "APIRestController#order", "transactionType": "request", - "transactionsPerMinute": 0.3, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 4663, - "impact": 0.0464200323162844, + "averageResponseTime": 3505, + "impact": 0.0480460318422139, "key": Object { "service.name": "opbeans-dotnet", - "transaction.name": "GET Types/Get {id}", + "transaction.name": "GET Products/Get", }, "serviceName": "opbeans-dotnet", - "transactionName": "GET Types/Get {id}", + "transactionName": "GET Products/Get", "transactionType": "request", "transactionsPerMinute": 0.533333333333333, }, Object { - "averageResponseTime": 19159, - "impact": 0.0477105913064472, + "averageResponseTime": 5621.4, + "impact": 0.0481642913941483, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.product_type", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#topProducts", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.product_type", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#topProducts", "transactionType": "request", - "transactionsPerMinute": 0.133333333333333, + "transactionsPerMinute": 0.333333333333333, }, Object { - "averageResponseTime": 11066.4285714286, - "impact": 0.0482381422940433, + "averageResponseTime": 8428.71428571429, + "impact": 0.0506239135675883, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.product_types", + "service.name": "opbeans-node", + "transaction.name": "GET /api/orders", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.product_types", + "serviceName": "opbeans-node", + "transactionName": "GET /api/orders", "transactionType": "request", "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 4344.77777777778, - "impact": 0.0487096926942951, + "averageResponseTime": 8520.14285714286, + "impact": 0.0511887353081702, "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Customers/Get {id}", + "service.name": "opbeans-node", + "transaction.name": "GET /api/customers/:id", }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Customers/Get {id}", + "serviceName": "opbeans-node", + "transactionName": "GET /api/customers/:id", "transactionType": "request", - "transactionsPerMinute": 0.6, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 8807.88888888889, - "impact": 0.0493874270752238, + "averageResponseTime": 6683.44444444444, + "impact": 0.0516388276326964, "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#orders", + "service.name": "opbeans-node", + "transaction.name": "GET /api/products/top", }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#orders", + "serviceName": "opbeans-node", + "transactionName": "GET /api/products/top", "transactionType": "request", "transactionsPerMinute": 0.3, }, Object { - "averageResponseTime": 27092.3333333333, - "impact": 0.0506639859185505, + "averageResponseTime": 3482.78947368421, + "impact": 0.0569534471979838, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.product", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Types/Get", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.product", + "serviceName": "opbeans-dotnet", + "transactionName": "GET Types/Get", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 13780.3333333333, - "impact": 0.0515580862051278, + "averageResponseTime": 16703, + "impact": 0.057517386404596, "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#customer", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.product_type", }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#customer", + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.product_type", "transactionType": "request", - "transactionsPerMinute": 0.2, + "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 4711.88888888889, - "impact": 0.0529148277076066, + "averageResponseTime": 4943, + "impact": 0.0596266425920813, "key": Object { "service.name": "opbeans-dotnet", - "transaction.name": "GET Types/Get", + "transaction.name": "GET Products/Get {id}", }, "serviceName": "opbeans-dotnet", - "transactionName": "GET Types/Get", - "transactionType": "request", - "transactionsPerMinute": 0.6, - }, - Object { - "averageResponseTime": 8536.6, - "impact": 0.0532661041191302, - "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#order", - }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#order", + "transactionName": "GET Products/Get {id}", "transactionType": "request", - "transactionsPerMinute": 0.333333333333333, + "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 11539, - "impact": 0.0576863322974688, + "averageResponseTime": 7892.33333333333, + "impact": 0.0612407972225879, "key": Object { "service.name": "opbeans-node", - "transaction.name": "GET /api/stats", + "transaction.name": "GET /api/types/:id", }, "serviceName": "opbeans-node", - "transactionName": "GET /api/stats", + "transactionName": "GET /api/types/:id", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.3, }, Object { - "averageResponseTime": 6705.28571428571, - "impact": 0.0586803427228309, + "averageResponseTime": 6346.42857142857, + "impact": 0.0769666700279444, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Orders/Get {id}", @@ -399,116 +387,92 @@ Array [ "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 14147.5714285714, - "impact": 0.061963377155893, + "averageResponseTime": 7052.84615384615, + "impact": 0.0794704188998674, "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#product", + "service.name": "opbeans-go", + "transaction.name": "GET /api/products", }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#product", + "serviceName": "opbeans-go", + "transactionName": "GET /api/products", "transactionType": "request", - "transactionsPerMinute": 0.233333333333333, + "transactionsPerMinute": 0.433333333333333, }, Object { - "averageResponseTime": 23499.8, - "impact": 0.0737145913138545, + "averageResponseTime": 10484.3333333333, + "impact": 0.0818285496667966, "key": Object { "service.name": "opbeans-java", - "transaction.name": "APIRestController#stats", + "transaction.name": "APIRestController#product", }, "serviceName": "opbeans-java", - "transactionName": "APIRestController#stats", + "transactionName": "APIRestController#product", "transactionType": "request", - "transactionsPerMinute": 0.166666666666667, + "transactionsPerMinute": 0.3, }, Object { - "averageResponseTime": 7849.66666666667, - "impact": 0.0738711384102944, + "averageResponseTime": 23711, + "impact": 0.0822565786420813, "key": Object { "service.name": "opbeans-node", - "transaction.name": "GET /api/products/:id/customers", + "transaction.name": "GET /api/stats", }, "serviceName": "opbeans-node", - "transactionName": "GET /api/products/:id/customers", - "transactionType": "request", - "transactionsPerMinute": 0.5, - }, - Object { - "averageResponseTime": 24527, - "impact": 0.0769829892297698, - "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.stats", - }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.stats", + "transactionName": "GET /api/stats", "transactionType": "request", - "transactionsPerMinute": 0.166666666666667, + "transactionsPerMinute": 0.133333333333333, }, Object { - "averageResponseTime": 6202.27272727273, - "impact": 0.0857744450725207, + "averageResponseTime": 4491.36363636364, + "impact": 0.0857567083657495, "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/types", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Types/Get {id}", }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/types", + "serviceName": "opbeans-dotnet", + "transactionName": "GET Types/Get {id}", "transactionType": "request", "transactionsPerMinute": 0.733333333333333, }, Object { - "averageResponseTime": 28056.6, - "impact": 0.0882136524735533, + "averageResponseTime": 20715.8, + "impact": 0.089965512867054, "key": Object { "service.name": "opbeans-python", - "transaction.name": "POST opbeans.views.post_order", + "transaction.name": "GET opbeans.views.stats", }, "serviceName": "opbeans-python", - "transactionName": "POST opbeans.views.post_order", + "transactionName": "GET opbeans.views.stats", "transactionType": "request", "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 16429.2222222222, - "impact": 0.0930373394288954, - "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.customer", - }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.customer", - "transactionType": "request", - "transactionsPerMinute": 0.3, - }, - Object { - "averageResponseTime": 21415, - "impact": 0.107964677807716, + "averageResponseTime": 9036.33333333333, + "impact": 0.0942519803576885, "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.orders", + "service.name": "opbeans-node", + "transaction.name": "GET /api/products", }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.orders", + "serviceName": "opbeans-node", + "transactionName": "GET /api/products", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.4, }, Object { - "averageResponseTime": 12255, - "impact": 0.108123770385399, + "averageResponseTime": 7504.06666666667, + "impact": 0.0978924329825326, "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::TypesController#index", + "service.name": "opbeans-java", + "transaction.name": "APIRestController#customer", }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::TypesController#index", + "serviceName": "opbeans-java", + "transactionName": "APIRestController#customer", "transactionType": "request", - "transactionsPerMinute": 0.466666666666667, + "transactionsPerMinute": 0.5, }, Object { - "averageResponseTime": 6930.84615384615, - "impact": 0.11361691890763, + "averageResponseTime": 4250.55555555556, + "impact": 0.0998375378516613, "key": Object { "service.name": "opbeans-go", "transaction.name": "GET /api/types/:id", @@ -516,23 +480,11 @@ Array [ "serviceName": "opbeans-go", "transactionName": "GET /api/types/:id", "transactionType": "request", - "transactionsPerMinute": 0.866666666666667, - }, - Object { - "averageResponseTime": 9878.57894736842, - "impact": 0.118383968905318, - "key": Object { - "service.name": "opbeans-java", - "transaction.name": "APIRestController#customerWhoBought", - }, - "serviceName": "opbeans-java", - "transactionName": "APIRestController#customerWhoBought", - "transactionType": "request", - "transactionsPerMinute": 0.633333333333333, + "transactionsPerMinute": 0.9, }, Object { - "averageResponseTime": 26915.5714285714, - "impact": 0.118839610047801, + "averageResponseTime": 21343, + "impact": 0.11156906191034, "key": Object { "service.name": "opbeans-node", "transaction.name": "GET /api/customers", @@ -540,83 +492,11 @@ Array [ "serviceName": "opbeans-node", "transactionName": "GET /api/customers", "transactionType": "request", - "transactionsPerMinute": 0.233333333333333, - }, - Object { - "averageResponseTime": 23791, - "impact": 0.120060804674094, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::ProductsController#index", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::ProductsController#index", - "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, - }, - Object { - "averageResponseTime": 19154.2, - "impact": 0.120833358231322, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::StatsController#index", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::StatsController#index", - "transactionType": "request", - "transactionsPerMinute": 0.333333333333333, - }, - Object { - "averageResponseTime": 22043.4444444444, - "impact": 0.125191858489519, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::ProductsController#show", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::ProductsController#show", - "transactionType": "request", - "transactionsPerMinute": 0.3, - }, - Object { - "averageResponseTime": 11293.4, - "impact": 0.14267740551748, - "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/orders/:id", - }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/orders/:id", - "transactionType": "request", - "transactionsPerMinute": 0.666666666666667, - }, - Object { - "averageResponseTime": 27255.8888888889, - "impact": 0.15504526250654, - "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.customers", - }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.customers", - "transactionType": "request", - "transactionsPerMinute": 0.3, - }, - Object { - "averageResponseTime": 14720.4117647059, - "impact": 0.158191477322794, - "key": Object { - "service.name": "opbeans-java", - "transaction.name": "ResourceHttpRequestHandler", - }, - "serviceName": "opbeans-java", - "transactionName": "ResourceHttpRequestHandler", - "transactionType": "request", - "transactionsPerMinute": 0.566666666666667, + "transactionsPerMinute": 0.2, }, Object { - "averageResponseTime": 31295, - "impact": 0.158263387167907, + "averageResponseTime": 16655, + "impact": 0.116142352941114, "key": Object { "service.name": "opbeans-ruby", "transaction.name": "Api::ProductsController#top", @@ -627,524 +507,356 @@ Array [ "transactionsPerMinute": 0.266666666666667, }, Object { - "averageResponseTime": 18362.7333333333, - "impact": 0.174224190931355, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::CustomersController#show", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::CustomersController#show", - "transactionType": "request", - "transactionsPerMinute": 0.5, - }, - Object { - "averageResponseTime": 28754.2, - "impact": 0.181924908061513, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::OrdersController#index", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::OrdersController#index", - "transactionType": "request", - "transactionsPerMinute": 0.333333333333333, - }, - Object { - "averageResponseTime": 20176.0666666667, - "impact": 0.191533463383243, - "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Api::OrdersController#show", - }, - "serviceName": "opbeans-ruby", - "transactionName": "Api::OrdersController#show", - "transactionType": "request", - "transactionsPerMinute": 0.5, - }, - Object { - "averageResponseTime": 10190.8709677419, - "impact": 0.19998191562851, - "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/customers/:id", - }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/customers/:id", - "transactionType": "request", - "transactionsPerMinute": 1.03333333333333, - }, - Object { - "averageResponseTime": 10022.7714285714, - "impact": 0.222178512066812, + "averageResponseTime": 5749, + "impact": 0.12032203382142, "key": Object { "service.name": "opbeans-go", - "transaction.name": "GET /api/products", - }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/products", - "transactionType": "request", - "transactionsPerMinute": 1.16666666666667, - }, - Object { - "averageResponseTime": 17653.1538461538, - "impact": 0.291024234133263, - "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/customers", + "transaction.name": "GET /api/types", }, "serviceName": "opbeans-go", - "transactionName": "GET /api/customers", + "transactionName": "GET /api/types", "transactionType": "request", - "transactionsPerMinute": 0.866666666666667, + "transactionsPerMinute": 0.8, }, Object { - "averageResponseTime": 17307.6896551724, - "impact": 0.31835061164637, + "averageResponseTime": 9951, + "impact": 0.121502864272824, "key": Object { "service.name": "opbeans-ruby", - "transaction.name": "Api::CustomersController#index", + "transaction.name": "Api::StatsController#index", }, "serviceName": "opbeans-ruby", - "transactionName": "Api::CustomersController#index", - "transactionType": "request", - "transactionsPerMinute": 0.966666666666667, - }, - Object { - "averageResponseTime": 67469.2222222222, - "impact": 0.385360405366361, - "key": Object { - "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.top_products", - }, - "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.top_products", - "transactionType": "request", - "transactionsPerMinute": 0.3, - }, - Object { - "averageResponseTime": 36009.6666666667, - "impact": 0.480166854259089, - "key": Object { - "service.name": "opbeans-java", - "transaction.name": "DispatcherServlet#doGet", - }, - "serviceName": "opbeans-java", - "transactionName": "DispatcherServlet#doGet", - "transactionType": "request", - "transactionsPerMinute": 0.7, - }, - Object { - "averageResponseTime": 46288.7777777778, - "impact": 0.529164186333834, - "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Customers/Get", - }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Customers/Get", - "transactionType": "request", - "transactionsPerMinute": 0.6, - }, - Object { - "averageResponseTime": 26866.8918918919, - "impact": 0.631541532813331, - "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/products/:id/customers", - }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/products/:id/customers", - "transactionType": "request", - "transactionsPerMinute": 1.23333333333333, - }, - Object { - "averageResponseTime": 323583, - "impact": 0.822616173202537, - "key": Object { - "service.name": "kibana", - "transaction.name": "GET /bootstrap.js", - }, - "serviceName": "kibana", - "transactionName": "GET /bootstrap.js", - "transactionType": "request", - "transactionsPerMinute": 0.133333333333333, - }, - Object { - "averageResponseTime": 108756.333333333, - "impact": 0.829453335821032, - "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Stats/Get", - }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Stats/Get", - "transactionType": "request", - "transactionsPerMinute": 0.4, - }, - Object { - "averageResponseTime": 25740.5384615385, - "impact": 0.850728468049396, - "key": Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api", - }, - "serviceName": "opbeans-node", - "transactionName": "GET /api", + "transactionName": "Api::StatsController#index", "transactionType": "request", - "transactionsPerMinute": 1.73333333333333, + "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 41030.8888888889, - "impact": 0.938931938597978, + "averageResponseTime": 14040.6, + "impact": 0.122466591367692, "key": Object { "service.name": "opbeans-go", - "transaction.name": "GET /api/stats", + "transaction.name": "GET /api/customers", }, "serviceName": "opbeans-go", - "transactionName": "GET /api/stats", + "transactionName": "GET /api/customers", "transactionType": "request", - "transactionsPerMinute": 1.2, + "transactionsPerMinute": 0.333333333333333, }, Object { - "averageResponseTime": 71788.7142857143, - "impact": 0.958310050930052, - "key": Object { - "service.name": "opbeans-dotnet", - "transaction.name": "GET Products/Customerwhobought {id}", + "averageResponseTime": 20963.5714285714, + "impact": 0.128060974201361, + "key": Object { + "service.name": "opbeans-ruby", + "transaction.name": "Api::OrdersController#index", }, - "serviceName": "opbeans-dotnet", - "transactionName": "GET Products/Customerwhobought {id}", + "serviceName": "opbeans-ruby", + "transactionName": "Api::OrdersController#index", "transactionType": "request", - "transactionsPerMinute": 0.7, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 109507.571428571, - "impact": 0.974564857777058, + "averageResponseTime": 22874.4285714286, + "impact": 0.139865748579522, "key": Object { "service.name": "opbeans-python", - "transaction.name": "GET opbeans.views.product_customers", + "transaction.name": "GET opbeans.views.customer", }, "serviceName": "opbeans-python", - "transactionName": "GET opbeans.views.product_customers", + "transactionName": "GET opbeans.views.customer", "transactionType": "request", - "transactionsPerMinute": 0.466666666666667, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 33396.3333333333, - "impact": 1.27408781741014, + "averageResponseTime": 32203.8, + "impact": 0.140658264084276, "key": Object { "service.name": "opbeans-python", - "transaction.name": "opbeans.tasks.sync_orders", + "transaction.name": "GET opbeans.views.customers", }, "serviceName": "opbeans-python", - "transactionName": "opbeans.tasks.sync_orders", - "transactionType": "celery", - "transactionsPerMinute": 2, + "transactionName": "GET opbeans.views.customers", + "transactionType": "request", + "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 40130.6226415094, - "impact": 1.3524523665845, + "averageResponseTime": 4482.11111111111, + "impact": 0.140955678032051, "key": Object { "service.name": "opbeans-go", - "transaction.name": "GET /api/products/:id", + "transaction.name": "GET /api/customers/:id", }, "serviceName": "opbeans-go", - "transactionName": "GET /api/products/:id", + "transactionName": "GET /api/customers/:id", "transactionType": "request", - "transactionsPerMinute": 1.76666666666667, - }, - Object { - "averageResponseTime": 1105919, - "impact": 1.40648975152024, - "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "GET /api/ml/datafeeds/_stats", - }, - "serviceName": "kibana-frontend", - "transactionName": "GET /api/ml/datafeeds/_stats", - "transactionType": "http-request", - "transactionsPerMinute": 0.0666666666666667, + "transactionsPerMinute": 1.2, }, Object { - "averageResponseTime": 1105919, - "impact": 1.40648975152024, + "averageResponseTime": 12582.3846153846, + "impact": 0.142910490774846, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "GET /api/ml/calendars", + "service.name": "opbeans-ruby", + "transaction.name": "Api::ProductsController#index", }, - "serviceName": "kibana-frontend", - "transactionName": "GET /api/ml/calendars", - "transactionType": "http-request", - "transactionsPerMinute": 0.0666666666666667, + "serviceName": "opbeans-ruby", + "transactionName": "Api::ProductsController#index", + "transactionType": "request", + "transactionsPerMinute": 0.433333333333333, }, Object { - "averageResponseTime": 1155071, - "impact": 1.46904749854636, + "averageResponseTime": 10009.9473684211, + "impact": 0.166401779979233, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "POST /api/ml/results/anomaly_search", + "service.name": "opbeans-ruby", + "transaction.name": "Api::CustomersController#show", }, - "serviceName": "kibana-frontend", - "transactionName": "POST /api/ml/results/anomaly_search", - "transactionType": "http-request", - "transactionsPerMinute": 0.0666666666666667, + "serviceName": "opbeans-ruby", + "transactionName": "Api::CustomersController#show", + "transactionType": "request", + "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 1343487, - "impact": 1.7088521954798, + "averageResponseTime": 27825.2857142857, + "impact": 0.170450845832029, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "/app/space_selector", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.product_types", }, - "serviceName": "kibana-frontend", - "transactionName": "/app/space_selector", - "transactionType": "route-change", - "transactionsPerMinute": 0.0666666666666667, + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.product_types", + "transactionType": "request", + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 1474559, - "impact": 1.87567285421611, + "averageResponseTime": 20562.2, + "impact": 0.180021926732983, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "POST /api/core/capabilities", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.orders", }, - "serviceName": "kibana-frontend", - "transactionName": "POST /api/core/capabilities", - "transactionType": "http-request", - "transactionsPerMinute": 0.0666666666666667, + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.orders", + "transactionType": "request", + "transactionsPerMinute": 0.333333333333333, }, Object { - "averageResponseTime": 240087.615384615, - "impact": 1.98514191143839, + "averageResponseTime": 7106.76470588235, + "impact": 0.21180020991247, "key": Object { "service.name": "opbeans-dotnet", - "transaction.name": "GET Products/Top", + "transaction.name": "GET Customers/Get {id}", }, "serviceName": "opbeans-dotnet", - "transactionName": "GET Products/Top", + "transactionName": "GET Customers/Get {id}", "transactionType": "request", - "transactionsPerMinute": 0.433333333333333, + "transactionsPerMinute": 1.13333333333333, }, Object { - "averageResponseTime": 1949695, - "impact": 2.48039774213523, + "averageResponseTime": 8612.51724137931, + "impact": 0.218977858687708, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "/app/ml", + "service.name": "opbeans-go", + "transaction.name": "GET /api/orders/:id", }, - "serviceName": "kibana-frontend", - "transactionName": "/app/ml", - "transactionType": "route-change", - "transactionsPerMinute": 0.0666666666666667, + "serviceName": "opbeans-go", + "transactionName": "GET /api/orders/:id", + "transactionType": "request", + "transactionsPerMinute": 0.966666666666667, }, Object { - "averageResponseTime": 3309567, - "impact": 4.21116207652443, + "averageResponseTime": 11295, + "impact": 0.277663720068132, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "/spaces/space_selector", + "service.name": "opbeans-ruby", + "transaction.name": "Api::CustomersController#index", }, - "serviceName": "kibana-frontend", - "transactionName": "/spaces/space_selector", - "transactionType": "page-load", - "transactionsPerMinute": 0.0666666666666667, + "serviceName": "opbeans-ruby", + "transactionName": "Api::CustomersController#index", + "transactionType": "request", + "transactionsPerMinute": 0.933333333333333, }, Object { - "averageResponseTime": 281667.266666667, - "impact": 5.37628229651714, + "averageResponseTime": 65035.8, + "impact": 0.285535040543522, "key": Object { - "service.name": "kibana", - "transaction.name": "search_sessions_cleanup", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.product_customers", }, - "serviceName": "kibana", - "transactionName": "search_sessions_cleanup", - "transactionType": "taskManager run", - "transactionsPerMinute": 1, + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.product_customers", + "transactionType": "request", + "transactionsPerMinute": 0.166666666666667, }, Object { - "averageResponseTime": 1425407, - "impact": 5.44146188922347, + "averageResponseTime": 30999.4705882353, + "impact": 0.463640986028375, "key": Object { - "service.name": "kibana", - "transaction.name": "GET /api/fleet/agent_policies", + "service.name": "opbeans-go", + "transaction.name": "GET /api/stats", }, - "serviceName": "kibana", - "transactionName": "GET /api/fleet/agent_policies", + "serviceName": "opbeans-go", + "transactionName": "GET /api/stats", "transactionType": "request", - "transactionsPerMinute": 0.2, + "transactionsPerMinute": 0.566666666666667, }, Object { - "averageResponseTime": 883096.6, - "impact": 5.61870629364955, + "averageResponseTime": 20197.4, + "impact": 0.622424732781511, "key": Object { - "service.name": "opbeans-rum", - "transaction.name": "/customers", + "service.name": "opbeans-go", + "transaction.name": "GET /api/products/:id/customers", }, - "serviceName": "opbeans-rum", - "transactionName": "/customers", - "transactionType": "page-load", - "transactionsPerMinute": 0.333333333333333, + "serviceName": "opbeans-go", + "transactionName": "GET /api/products/:id/customers", + "transactionType": "request", + "transactionsPerMinute": 1.16666666666667, }, Object { - "averageResponseTime": 389119, - "impact": 5.9419124107668, + "averageResponseTime": 64681.6666666667, + "impact": 0.68355874339377, "key": Object { - "service.name": "kibana", - "transaction.name": "endpoint:user-artifact-packager", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.top_products", }, - "serviceName": "kibana", - "transactionName": "endpoint:user-artifact-packager", - "transactionType": "taskManager run", - "transactionsPerMinute": 0.8, + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.top_products", + "transactionType": "request", + "transactionsPerMinute": 0.4, }, Object { - "averageResponseTime": 90976.5384615385, - "impact": 6.01999759337476, + "averageResponseTime": 41416.1428571429, + "impact": 0.766127739061111, "key": Object { - "service.name": "opbeans-ruby", - "transaction.name": "Rack", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Customers/Get", }, - "serviceName": "opbeans-ruby", - "transactionName": "Rack", + "serviceName": "opbeans-dotnet", + "transactionName": "GET Customers/Get", "transactionType": "request", - "transactionsPerMinute": 3.46666666666667, + "transactionsPerMinute": 0.7, }, Object { - "averageResponseTime": 2555903, - "impact": 6.50494486140806, + "averageResponseTime": 19429, + "impact": 0.821597646656097, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "/app/ml/*?{query}", + "service.name": "opbeans-go", + "transaction.name": "GET /api/products/:id", }, - "serviceName": "kibana-frontend", - "transactionName": "/app/ml/*?{query}", - "transactionType": "route-change", - "transactionsPerMinute": 0.133333333333333, + "serviceName": "opbeans-go", + "transactionName": "GET /api/products/:id", + "transactionType": "request", + "transactionsPerMinute": 1.6, }, Object { - "averageResponseTime": 2801663, - "impact": 7.13052233166922, + "averageResponseTime": 62390.652173913, + "impact": 1.26497653527507, "key": Object { - "service.name": "kibana", - "transaction.name": "POST /api/fleet/setup", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Products/Customerwhobought {id}", }, - "serviceName": "kibana", - "transactionName": "POST /api/fleet/setup", + "serviceName": "opbeans-dotnet", + "transactionName": "GET Products/Customerwhobought {id}", "transactionType": "request", - "transactionsPerMinute": 0.133333333333333, + "transactionsPerMinute": 0.766666666666667, }, Object { - "averageResponseTime": 3022847, - "impact": 7.69354205490426, + "averageResponseTime": 33266.2, + "impact": 1.76006661931225, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "/app/home", + "service.name": "opbeans-python", + "transaction.name": "opbeans.tasks.sync_orders", }, - "serviceName": "kibana-frontend", - "transactionName": "/app/home", - "transactionType": "route-change", - "transactionsPerMinute": 0.133333333333333, + "serviceName": "opbeans-python", + "transactionName": "opbeans.tasks.sync_orders", + "transactionType": "celery", + "transactionsPerMinute": 2, }, Object { - "averageResponseTime": 758271, - "impact": 7.71960014638808, + "averageResponseTime": 38491.4444444444, + "impact": 1.83293391905112, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "POST /internal/bsearch", + "service.name": "opbeans-node", + "transaction.name": "GET /api", }, - "serviceName": "kibana-frontend", - "transactionName": "POST /internal/bsearch", - "transactionType": "http-request", - "transactionsPerMinute": 0.533333333333333, + "serviceName": "opbeans-node", + "transactionName": "GET /api", + "transactionType": "request", + "transactionsPerMinute": 1.8, }, Object { - "averageResponseTime": 700221.608695652, - "impact": 10.2477472984187, + "averageResponseTime": 118488.6, + "impact": 2.08995781717084, "key": Object { - "service.name": "opbeans-go", - "transaction.name": "GET /api/orders", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Stats/Get", }, - "serviceName": "opbeans-go", - "transactionName": "GET /api/orders", + "serviceName": "opbeans-dotnet", + "transactionName": "GET Stats/Get", "transactionType": "request", - "transactionsPerMinute": 0.766666666666667, + "transactionsPerMinute": 0.666666666666667, }, Object { - "averageResponseTime": 1617099.8, - "impact": 10.2896847382662, + "averageResponseTime": 250440.142857143, + "impact": 4.64001412901584, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "POST /api/ui_counters/_report", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Products/Top", }, - "serviceName": "kibana-frontend", - "transactionName": "POST /api/ui_counters/_report", - "transactionType": "http-request", - "transactionsPerMinute": 0.333333333333333, + "serviceName": "opbeans-dotnet", + "transactionName": "GET Products/Top", + "transactionType": "request", + "transactionsPerMinute": 0.7, }, Object { - "averageResponseTime": 1181285.4, - "impact": 11.274966072076, + "averageResponseTime": 312096.523809524, + "impact": 5.782704992387, "key": Object { - "service.name": "opbeans-rum", - "transaction.name": "/products", + "service.name": "opbeans-java", + "transaction.name": "DispatcherServlet#doGet", }, - "serviceName": "opbeans-rum", - "transactionName": "/products", - "transactionType": "page-load", - "transactionsPerMinute": 0.5, + "serviceName": "opbeans-java", + "transactionName": "DispatcherServlet#doGet", + "transactionType": "request", + "transactionsPerMinute": 0.7, }, Object { - "averageResponseTime": 110265.729411765, - "impact": 11.9278139192629, + "averageResponseTime": 91519.7032967033, + "impact": 7.34855500859826, "key": Object { - "service.name": "kibana", - "transaction.name": "GET /login", + "service.name": "opbeans-ruby", + "transaction.name": "Rack", }, - "serviceName": "kibana", - "transactionName": "GET /login", + "serviceName": "opbeans-ruby", + "transactionName": "Rack", "transactionType": "request", - "transactionsPerMinute": 5.66666666666667, + "transactionsPerMinute": 3.03333333333333, }, Object { - "averageResponseTime": 1282528.88235294, - "impact": 13.8737178737119, + "averageResponseTime": 648269.769230769, + "impact": 7.43611473386403, "key": Object { "service.name": "opbeans-rum", - "transaction.name": "/dashboard", + "transaction.name": "/customers", }, "serviceName": "opbeans-rum", - "transactionName": "/dashboard", + "transactionName": "/customers", "transactionType": "page-load", - "transactionsPerMinute": 0.566666666666667, - }, - Object { - "averageResponseTime": 2090324.33333333, - "impact": 15.9615858625601, - "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "GET /api/saved_objects_tagging/tags", - }, - "serviceName": "kibana-frontend", - "transactionName": "GET /api/saved_objects_tagging/tags", - "transactionType": "http-request", - "transactionsPerMinute": 0.4, + "transactionsPerMinute": 0.433333333333333, }, Object { - "averageResponseTime": 3178495, - "impact": 16.1805405226327, + "averageResponseTime": 1398919.72727273, + "impact": 13.5790895084132, "key": Object { - "service.name": "kibana", - "transaction.name": "POST /api/fleet/agents/setup", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.products", }, - "serviceName": "kibana", - "transactionName": "POST /api/fleet/agents/setup", + "serviceName": "opbeans-python", + "transactionName": "GET opbeans.views.products", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.366666666666667, }, Object { - "averageResponseTime": 2187433.66666667, - "impact": 16.7031558220988, + "averageResponseTime": 1199907.57142857, + "impact": 14.8239822181408, "key": Object { "service.name": "opbeans-rum", "transaction.name": "/orders", @@ -1152,47 +864,47 @@ Array [ "serviceName": "opbeans-rum", "transactionName": "/orders", "transactionType": "page-load", - "transactionsPerMinute": 0.4, + "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 1838079, - "impact": 18.7141241862279, + "averageResponseTime": 955876.052631579, + "impact": 16.026822184214, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "GET /api/uptime/monitor/status", + "service.name": "opbeans-rum", + "transaction.name": "/products", }, - "serviceName": "kibana-frontend", - "transactionName": "GET /api/uptime/monitor/status", - "transactionType": "http-request", - "transactionsPerMinute": 0.533333333333333, + "serviceName": "opbeans-rum", + "transactionName": "/products", + "transactionType": "page-load", + "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 1981439, - "impact": 20.1738049501706, + "averageResponseTime": 965009.526315789, + "impact": 16.1799735991728, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "POST /api/ml/jobs/jobs_summary", + "service.name": "opbeans-go", + "transaction.name": "GET /api/orders", }, - "serviceName": "kibana-frontend", - "transactionName": "POST /api/ml/jobs/jobs_summary", - "transactionType": "http-request", - "transactionsPerMinute": 0.533333333333333, + "serviceName": "opbeans-go", + "transactionName": "GET /api/orders", + "transactionType": "request", + "transactionsPerMinute": 0.633333333333333, }, Object { - "averageResponseTime": 4153343, - "impact": 21.1434551200379, + "averageResponseTime": 1213675.30769231, + "impact": 27.8474053933734, "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "Click - div", + "service.name": "opbeans-rum", + "transaction.name": "/dashboard", }, - "serviceName": "kibana-frontend", - "transactionName": "Click - div", - "transactionType": "user-interaction", - "transactionsPerMinute": 0.266666666666667, + "serviceName": "opbeans-rum", + "transactionName": "/dashboard", + "transactionType": "page-load", + "transactionsPerMinute": 0.866666666666667, }, Object { - "averageResponseTime": 969496.6, - "impact": 24.6772958199653, + "averageResponseTime": 924019.363636364, + "impact": 35.8796065162284, "key": Object { "service.name": "opbeans-node", "transaction.name": "Update shipping status", @@ -1200,35 +912,23 @@ Array [ "serviceName": "opbeans-node", "transactionName": "Update shipping status", "transactionType": "Worker", - "transactionsPerMinute": 1.33333333333333, + "transactionsPerMinute": 1.46666666666667, }, Object { - "averageResponseTime": 1012115.8372093, - "impact": 27.6944019184681, + "averageResponseTime": 1060469.15384615, + "impact": 36.498655556576, "key": Object { "service.name": "opbeans-node", - "transaction.name": "Process completed order", + "transaction.name": "Process payment", }, "serviceName": "opbeans-node", - "transactionName": "Process completed order", + "transactionName": "Process payment", "transactionType": "Worker", - "transactionsPerMinute": 1.43333333333333, - }, - Object { - "averageResponseTime": 277193.418604651, - "impact": 30.339339568146, - "key": Object { - "service.name": "kibana", - "transaction.name": "search_sessions_monitor", - }, - "serviceName": "kibana", - "transactionName": "search_sessions_monitor", - "transactionType": "taskManager run", - "transactionsPerMinute": 5.73333333333333, + "transactionsPerMinute": 1.3, }, Object { - "averageResponseTime": 133020.771587744, - "impact": 30.388460356061, + "averageResponseTime": 118686.822222222, + "impact": 37.7068083771466, "key": Object { "service.name": "opbeans-python", "transaction.name": "opbeans.tasks.update_stats", @@ -1236,35 +936,23 @@ Array [ "serviceName": "opbeans-python", "transactionName": "opbeans.tasks.update_stats", "transactionType": "celery", - "transactionsPerMinute": 11.9666666666667, + "transactionsPerMinute": 12, }, Object { - "averageResponseTime": 1084963.57142857, - "impact": 33.8304333651907, + "averageResponseTime": 1039228.27659574, + "impact": 43.1048035741496, "key": Object { "service.name": "opbeans-node", - "transaction.name": "Process payment", + "transaction.name": "Process completed order", }, "serviceName": "opbeans-node", - "transactionName": "Process payment", + "transactionName": "Process completed order", "transactionType": "Worker", - "transactionsPerMinute": 1.63333333333333, - }, - Object { - "averageResponseTime": 341426.2, - "impact": 34.7627012338947, - "key": Object { - "service.name": "kibana", - "transaction.name": "GET /", - }, - "serviceName": "kibana", - "transactionName": "GET /", - "transactionType": "request", - "transactionsPerMinute": 5.33333333333333, + "transactionsPerMinute": 1.56666666666667, }, Object { - "averageResponseTime": 2019880.51351351, - "impact": 47.5584453470763, + "averageResponseTime": 1949922.55555556, + "impact": 61.9499776921889, "key": Object { "service.name": "opbeans-python", "transaction.name": "opbeans.tasks.sync_customers", @@ -1272,23 +960,11 @@ Array [ "serviceName": "opbeans-python", "transactionName": "opbeans.tasks.sync_customers", "transactionType": "celery", - "transactionsPerMinute": 1.23333333333333, - }, - Object { - "averageResponseTime": 286405.072992701, - "impact": 49.9380954870978, - "key": Object { - "service.name": "kibana", - "transaction.name": "reports:monitor", - }, - "serviceName": "kibana", - "transactionName": "reports:monitor", - "transactionType": "taskManager run", - "transactionsPerMinute": 9.13333333333333, + "transactionsPerMinute": 1.2, }, Object { - "averageResponseTime": 6253645.76923077, - "impact": 51.734190233957, + "averageResponseTime": 5963775, + "impact": 100, "key": Object { "service.name": "opbeans-dotnet", "transaction.name": "GET Orders/Get", @@ -1296,43 +972,7 @@ Array [ "serviceName": "opbeans-dotnet", "transactionName": "GET Orders/Get", "transactionType": "request", - "transactionsPerMinute": 0.433333333333333, - }, - Object { - "averageResponseTime": 6548917.85714286, - "impact": 58.344458200013, - "key": Object { - "service.name": "kibana-frontend", - "transaction.name": "GET /api/uptime/filters", - }, - "serviceName": "kibana-frontend", - "transactionName": "GET /api/uptime/filters", - "transactionType": "http-request", - "transactionsPerMinute": 0.466666666666667, - }, - Object { - "averageResponseTime": 172637.267148014, - "impact": 60.8620638778463, - "key": Object { - "service.name": "kibana", - "transaction.name": "taskManager", - }, - "serviceName": "kibana", - "transactionName": "taskManager", - "transactionType": "taskManager markTaskAsRunning", - "transactionsPerMinute": 18.4666666666667, - }, - Object { - "averageResponseTime": 131831.268456376, - "impact": 100, - "key": Object { - "service.name": "kibana", - "transaction.name": "markAvailableTasksAsClaimed", - }, - "serviceName": "kibana", - "transactionName": "markAvailableTasksAsClaimed", - "transactionType": "taskManager markAvailableTasksAsClaimed", - "transactionsPerMinute": 39.7333333333333, + "transactionsPerMinute": 0.633333333333333, }, ] `; diff --git a/x-pack/test/apm_api_integration/tests/traces/top_traces.ts b/x-pack/test/apm_api_integration/tests/traces/top_traces.ts index debdfe461e6fb..bc511a6a482f2 100644 --- a/x-pack/test/apm_api_integration/tests/traces/top_traces.ts +++ b/x-pack/test/apm_api_integration/tests/traces/top_traces.ts @@ -45,7 +45,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); it('returns the correct number of buckets', async () => { - expectSnapshot(response.body.items.length).toMatchInline(`111`); + expectSnapshot(response.body.items.length).toMatchInline(`81`); }); it('returns the correct buckets', async () => { @@ -60,7 +60,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(firstItem).toMatchInline(` Object { - "averageResponseTime": 1663, + "averageResponseTime": 1639, "impact": 0, "key": Object { "service.name": "opbeans-java", @@ -75,16 +75,16 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(lastItem).toMatchInline(` Object { - "averageResponseTime": 131831.268456376, + "averageResponseTime": 5963775, "impact": 100, "key": Object { - "service.name": "kibana", - "transaction.name": "markAvailableTasksAsClaimed", + "service.name": "opbeans-dotnet", + "transaction.name": "GET Orders/Get", }, - "serviceName": "kibana", - "transactionName": "markAvailableTasksAsClaimed", - "transactionType": "taskManager markAvailableTasksAsClaimed", - "transactionsPerMinute": 39.7333333333333, + "serviceName": "opbeans-dotnet", + "transactionName": "GET Orders/Get", + "transactionType": "request", + "transactionsPerMinute": 0.633333333333333, } `); @@ -99,16 +99,16 @@ export default function ApiTest({ getService }: FtrProviderContext) { "transaction.name": "POST /api/orders", }, Object { - "service.name": "kibana", - "transaction.name": "GET /translations/?.json", + "service.name": "opbeans-node", + "transaction.name": "GET /api/products/:id", }, Object { - "service.name": "kibana", - "transaction.name": "GET /ui/#", + "service.name": "opbeans-dotnet", + "transaction.name": "POST Orders/Post", }, Object { - "service.name": "opbeans-node", - "transaction.name": "GET /api/orders/:id", + "service.name": "opbeans-python", + "transaction.name": "GET opbeans.views.product", }, ] `); diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/breakdown.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/breakdown.snap index f49aed8361446..8e26064f6314d 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/breakdown.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/breakdown.snap @@ -7,252 +7,252 @@ Object { "color": "#54b399", "data": Array [ Object { - "x": 1627373280000, + "x": 1627973400000, "y": null, }, Object { - "x": 1627373310000, - "y": 0.0714285714285714, + "x": 1627973430000, + "y": 0.125, }, Object { - "x": 1627373340000, - "y": 0.651162790697674, + "x": 1627973460000, + "y": null, }, Object { - "x": 1627373370000, - "y": 0.176470588235294, + "x": 1627973490000, + "y": 0.0833333333333333, }, Object { - "x": 1627373400000, - "y": 0.4375, + "x": 1627973520000, + "y": 0.628571428571429, }, Object { - "x": 1627373430000, - "y": 0.117224880382775, + "x": 1627973550000, + "y": 0.733333333333333, }, Object { - "x": 1627373460000, - "y": null, + "x": 1627973580000, + "y": 0.490909090909091, }, Object { - "x": 1627373490000, - "y": 0.211267605633803, + "x": 1627973610000, + "y": 0.135593220338983, }, Object { - "x": 1627373520000, - "y": 0.172413793103448, + "x": 1627973640000, + "y": 0.692307692307692, }, Object { - "x": 1627373550000, - "y": 0.0731707317073171, + "x": 1627973670000, + "y": 0.097165991902834, }, Object { - "x": 1627373580000, - "y": 0.357142857142857, + "x": 1627973700000, + "y": 0.303030303030303, }, Object { - "x": 1627373610000, - "y": 0.426470588235294, + "x": 1627973730000, + "y": 0.153846153846154, }, Object { - "x": 1627373640000, - "y": 0.567164179104478, + "x": 1627973760000, + "y": 0.078125, }, Object { - "x": 1627373670000, - "y": 0.253731343283582, + "x": 1627973790000, + "y": 0.0857142857142857, }, Object { - "x": 1627373700000, - "y": 0.45, + "x": 1627973820000, + "y": 0.155172413793103, }, Object { - "x": 1627373730000, - "y": 0.272727272727273, + "x": 1627973850000, + "y": 0.8, }, Object { - "x": 1627373760000, - "y": 0.508771929824561, + "x": 1627973880000, + "y": 0.28125, }, Object { - "x": 1627373790000, - "y": 0.0909090909090909, + "x": 1627973910000, + "y": 0.142857142857143, }, Object { - "x": 1627373820000, - "y": 0.30952380952381, + "x": 1627973940000, + "y": 0.0810810810810811, }, Object { - "x": 1627373850000, - "y": 0.53448275862069, + "x": 1627973970000, + "y": 0.473684210526316, }, Object { - "x": 1627373880000, - "y": 0.16017316017316, + "x": 1627974000000, + "y": 0.633333333333333, }, Object { - "x": 1627373910000, - "y": 0.355371900826446, + "x": 1627974030000, + "y": 0.111111111111111, }, Object { - "x": 1627373940000, - "y": 0.25, + "x": 1627974060000, + "y": 0.467741935483871, }, Object { - "x": 1627373970000, - "y": 0.733333333333333, + "x": 1627974090000, + "y": 0.129496402877698, }, Object { - "x": 1627374000000, - "y": 0.125, + "x": 1627974120000, + "y": null, }, Object { - "x": 1627374030000, - "y": 0.428571428571429, + "x": 1627974150000, + "y": 0.30188679245283, }, Object { - "x": 1627374060000, - "y": 0.333333333333333, + "x": 1627974180000, + "y": 0.464285714285714, }, Object { - "x": 1627374090000, - "y": 0.8, + "x": 1627974210000, + "y": 0.123674911660777, }, Object { - "x": 1627374120000, - "y": 0.678571428571429, + "x": 1627974240000, + "y": 0.384615384615385, }, Object { - "x": 1627374150000, - "y": 0.565217391304348, + "x": 1627974270000, + "y": 0.3, }, Object { - "x": 1627374180000, - "y": 0.7, + "x": 1627974300000, + "y": 0.222222222222222, }, Object { - "x": 1627374210000, - "y": 0.245614035087719, + "x": 1627974330000, + "y": 0.00248447204968944, }, Object { - "x": 1627374240000, - "y": 0.195652173913043, + "x": 1627974360000, + "y": 0.0645161290322581, }, Object { - "x": 1627374270000, - "y": null, + "x": 1627974390000, + "y": 0.569444444444444, }, Object { - "x": 1627374300000, - "y": 0.0327868852459016, + "x": 1627974420000, + "y": 0.425, }, Object { - "x": 1627374330000, - "y": 0.235294117647059, + "x": 1627974450000, + "y": null, }, Object { - "x": 1627374360000, - "y": 0.5, + "x": 1627974480000, + "y": 0.143646408839779, }, Object { - "x": 1627374390000, - "y": 0.357142857142857, + "x": 1627974510000, + "y": 0.298850574712644, }, Object { - "x": 1627374420000, - "y": 0.0909090909090909, + "x": 1627974540000, + "y": 0.111111111111111, }, Object { - "x": 1627374450000, - "y": 0.411214953271028, + "x": 1627974570000, + "y": 0.267857142857143, }, Object { - "x": 1627374480000, - "y": 0.163461538461538, + "x": 1627974600000, + "y": 0.4, }, Object { - "x": 1627374510000, - "y": null, + "x": 1627974630000, + "y": 0.185185185185185, }, Object { - "x": 1627374540000, - "y": 0.769230769230769, + "x": 1627974660000, + "y": 0.0973451327433628, }, Object { - "x": 1627374570000, - "y": 0.0666666666666667, + "x": 1627974690000, + "y": null, }, Object { - "x": 1627374600000, - "y": 0.333333333333333, + "x": 1627974720000, + "y": 0.480769230769231, }, Object { - "x": 1627374630000, - "y": 0.0413223140495868, + "x": 1627974750000, + "y": 0.383458646616541, }, Object { - "x": 1627374660000, - "y": 0.109090909090909, + "x": 1627974780000, + "y": 0.153061224489796, }, Object { - "x": 1627374690000, - "y": 0.223404255319149, + "x": 1627974810000, + "y": null, }, Object { - "x": 1627374720000, - "y": 0.0136054421768707, + "x": 1627974840000, + "y": 0.739130434782609, }, Object { - "x": 1627374750000, - "y": 0.266304347826087, + "x": 1627974870000, + "y": 0.260869565217391, }, Object { - "x": 1627374780000, - "y": 0.15, + "x": 1627974900000, + "y": 0.605633802816901, }, Object { - "x": 1627374810000, - "y": 0.111111111111111, + "x": 1627974930000, + "y": 0.326923076923077, }, Object { - "x": 1627374840000, - "y": null, + "x": 1627974960000, + "y": 0.103448275862069, }, Object { - "x": 1627374870000, - "y": 0.117647058823529, + "x": 1627974990000, + "y": null, }, Object { - "x": 1627374900000, - "y": 0.489130434782609, + "x": 1627975020000, + "y": 0.16, }, Object { - "x": 1627374930000, - "y": 0.128813559322034, + "x": 1627975050000, + "y": 0.114285714285714, }, Object { - "x": 1627374960000, - "y": 0.272727272727273, + "x": 1627975080000, + "y": 0.238636363636364, }, Object { - "x": 1627374990000, - "y": 0.217391304347826, + "x": 1627975110000, + "y": 0.684210526315789, }, Object { - "x": 1627375020000, - "y": 0.424657534246575, + "x": 1627975140000, + "y": 0.368421052631579, }, Object { - "x": 1627375050000, - "y": 0.666666666666667, + "x": 1627975170000, + "y": 0.44, }, Object { - "x": 1627375080000, - "y": 0.2, + "x": 1627975200000, + "y": 0.235294117647059, }, ], "hideLegend": false, - "legendValue": "23%", + "legendValue": "9.7%", "title": "app", "type": "areaStacked", }, @@ -260,252 +260,252 @@ Object { "color": "#6092c0", "data": Array [ Object { - "x": 1627373280000, + "x": 1627973400000, "y": null, }, Object { - "x": 1627373310000, - "y": 0.928571428571429, + "x": 1627973430000, + "y": 0.790322580645161, }, Object { - "x": 1627373340000, - "y": 0.13953488372093, + "x": 1627973460000, + "y": null, }, Object { - "x": 1627373370000, - "y": 0.623529411764706, + "x": 1627973490000, + "y": 0.876543209876543, }, Object { - "x": 1627373400000, - "y": 0.2625, + "x": 1627973520000, + "y": 0.114285714285714, }, Object { - "x": 1627373430000, - "y": 0.815789473684211, + "x": 1627973550000, + "y": 0, }, Object { - "x": 1627373460000, - "y": null, + "x": 1627973580000, + "y": 0.309090909090909, }, Object { - "x": 1627373490000, - "y": 0.704225352112676, + "x": 1627973610000, + "y": 0.864406779661017, }, Object { - "x": 1627373520000, - "y": 0.827586206896552, + "x": 1627973640000, + "y": 0, }, Object { - "x": 1627373550000, - "y": 0.926829268292683, + "x": 1627973670000, + "y": 0.862348178137652, }, Object { - "x": 1627373580000, - "y": 0.535714285714286, + "x": 1627973700000, + "y": 0.636363636363636, }, Object { - "x": 1627373610000, - "y": 0.382352941176471, + "x": 1627973730000, + "y": 0.846153846153846, }, Object { - "x": 1627373640000, - "y": 0.17910447761194, + "x": 1627973760000, + "y": 0.875, }, Object { - "x": 1627373670000, - "y": 0.686567164179104, + "x": 1627973790000, + "y": 0.914285714285714, }, Object { - "x": 1627373700000, - "y": 0, + "x": 1627973820000, + "y": 0.844827586206897, }, Object { - "x": 1627373730000, - "y": 0.666666666666667, + "x": 1627973850000, + "y": 0, }, Object { - "x": 1627373760000, - "y": 0.0701754385964912, + "x": 1627973880000, + "y": 0.65625, }, Object { - "x": 1627373790000, - "y": 0.909090909090909, + "x": 1627973910000, + "y": 0.857142857142857, }, Object { - "x": 1627373820000, - "y": 0.285714285714286, + "x": 1627973940000, + "y": 0.918918918918919, }, Object { - "x": 1627373850000, - "y": 0.293103448275862, + "x": 1627973970000, + "y": 0, }, Object { - "x": 1627373880000, - "y": 0.770562770562771, + "x": 1627974000000, + "y": 0.05, }, Object { - "x": 1627373910000, - "y": 0.363636363636364, + "x": 1627974030000, + "y": 0.872222222222222, }, Object { - "x": 1627373940000, - "y": 0.642857142857143, + "x": 1627974060000, + "y": 0.290322580645161, }, Object { - "x": 1627373970000, - "y": 0, + "x": 1627974090000, + "y": 0.848920863309353, }, Object { - "x": 1627374000000, - "y": 0.875, + "x": 1627974120000, + "y": null, }, Object { - "x": 1627374030000, - "y": 0, + "x": 1627974150000, + "y": 0.613207547169811, }, Object { - "x": 1627374060000, - "y": 0.53030303030303, + "x": 1627974180000, + "y": 0.339285714285714, }, Object { - "x": 1627374090000, - "y": 0, + "x": 1627974210000, + "y": 0.787985865724382, }, Object { - "x": 1627374120000, - "y": 0, + "x": 1627974240000, + "y": 0.557692307692308, }, Object { - "x": 1627374150000, - "y": 0.130434782608696, + "x": 1627974270000, + "y": 0.62, }, Object { - "x": 1627374180000, - "y": 0, + "x": 1627974300000, + "y": 0.685990338164251, }, Object { - "x": 1627374210000, - "y": 0.666666666666667, + "x": 1627974330000, + "y": 0.995807453416149, }, Object { - "x": 1627374240000, - "y": 0.804347826086957, + "x": 1627974360000, + "y": 0.935483870967742, }, Object { - "x": 1627374270000, - "y": null, + "x": 1627974390000, + "y": 0.125, }, Object { - "x": 1627374300000, - "y": 0.967213114754098, + "x": 1627974420000, + "y": 0.375, }, Object { - "x": 1627374330000, - "y": 0.764705882352941, + "x": 1627974450000, + "y": null, }, Object { - "x": 1627374360000, - "y": 0, + "x": 1627974480000, + "y": 0.831491712707182, }, Object { - "x": 1627374390000, - "y": 0.5, + "x": 1627974510000, + "y": 0.505747126436782, }, Object { - "x": 1627374420000, - "y": 0.909090909090909, + "x": 1627974540000, + "y": 0.888888888888889, }, Object { - "x": 1627374450000, - "y": 0.233644859813084, + "x": 1627974570000, + "y": 0.625, }, Object { - "x": 1627374480000, - "y": 0.778846153846154, + "x": 1627974600000, + "y": 0.4, }, Object { - "x": 1627374510000, - "y": null, + "x": 1627974630000, + "y": 0.71957671957672, }, Object { - "x": 1627374540000, - "y": 0, + "x": 1627974660000, + "y": 0.867256637168142, }, Object { - "x": 1627374570000, - "y": 0.933333333333333, + "x": 1627974690000, + "y": null, }, Object { - "x": 1627374600000, - "y": 0.566666666666667, + "x": 1627974720000, + "y": 0.288461538461538, }, Object { - "x": 1627374630000, - "y": 0.958677685950413, + "x": 1627974750000, + "y": 0.406015037593985, }, Object { - "x": 1627374660000, - "y": 0.831818181818182, + "x": 1627974780000, + "y": 0.775510204081633, }, Object { - "x": 1627374690000, - "y": 0.712765957446808, + "x": 1627974810000, + "y": null, }, Object { - "x": 1627374720000, - "y": 0.986394557823129, + "x": 1627974840000, + "y": 0, }, Object { - "x": 1627374750000, - "y": 0.679347826086957, + "x": 1627974870000, + "y": 0.623188405797101, }, Object { - "x": 1627374780000, - "y": 0.683333333333333, + "x": 1627974900000, + "y": 0, }, Object { - "x": 1627374810000, - "y": 0.888888888888889, + "x": 1627974930000, + "y": 0.423076923076923, }, Object { - "x": 1627374840000, - "y": null, + "x": 1627974960000, + "y": 0.896551724137931, }, Object { - "x": 1627374870000, - "y": 0.882352941176471, + "x": 1627974990000, + "y": null, }, Object { - "x": 1627374900000, - "y": 0.293478260869565, + "x": 1627975020000, + "y": 0.84, }, Object { - "x": 1627374930000, - "y": 0.857627118644068, + "x": 1627975050000, + "y": 0.885714285714286, }, Object { - "x": 1627374960000, - "y": 0.659090909090909, + "x": 1627975080000, + "y": 0.681818181818182, }, Object { - "x": 1627374990000, - "y": 0.717391304347826, + "x": 1627975110000, + "y": 0, }, Object { - "x": 1627375020000, - "y": 0.342465753424658, + "x": 1627975140000, + "y": 0.456140350877193, }, Object { - "x": 1627375050000, - "y": 0, + "x": 1627975170000, + "y": 0.4, }, Object { - "x": 1627375080000, - "y": 0.8, + "x": 1627975200000, + "y": 0.541176470588235, }, ], "hideLegend": false, - "legendValue": "67%", + "legendValue": "86%", "title": "http", "type": "areaStacked", }, @@ -513,252 +513,252 @@ Object { "color": "#d36086", "data": Array [ Object { - "x": 1627373280000, + "x": 1627973400000, "y": null, }, Object { - "x": 1627373310000, - "y": 0, + "x": 1627973430000, + "y": 0.0806451612903226, }, Object { - "x": 1627373340000, - "y": 0.209302325581395, + "x": 1627973460000, + "y": null, }, Object { - "x": 1627373370000, - "y": 0.2, + "x": 1627973490000, + "y": 0.0277777777777778, }, Object { - "x": 1627373400000, - "y": 0.275, + "x": 1627973520000, + "y": 0.171428571428571, }, Object { - "x": 1627373430000, - "y": 0.0598086124401914, + "x": 1627973550000, + "y": 0.266666666666667, }, Object { - "x": 1627373460000, - "y": null, + "x": 1627973580000, + "y": 0.181818181818182, }, Object { - "x": 1627373490000, - "y": 0.0633802816901408, + "x": 1627973610000, + "y": 0, }, Object { - "x": 1627373520000, - "y": 0, + "x": 1627973640000, + "y": 0.307692307692308, }, Object { - "x": 1627373550000, - "y": 0, + "x": 1627973670000, + "y": 0.0364372469635627, }, Object { - "x": 1627373580000, - "y": 0.107142857142857, + "x": 1627973700000, + "y": 0.0454545454545455, }, Object { - "x": 1627373610000, - "y": 0.161764705882353, + "x": 1627973730000, + "y": 0, }, Object { - "x": 1627373640000, - "y": 0.253731343283582, + "x": 1627973760000, + "y": 0.0416666666666667, }, Object { - "x": 1627373670000, - "y": 0.0298507462686567, + "x": 1627973790000, + "y": 0, }, Object { - "x": 1627373700000, - "y": 0.55, + "x": 1627973820000, + "y": 0, }, Object { - "x": 1627373730000, - "y": 0.0303030303030303, + "x": 1627973850000, + "y": 0.2, }, Object { - "x": 1627373760000, - "y": 0.333333333333333, + "x": 1627973880000, + "y": 0.0625, }, Object { - "x": 1627373790000, + "x": 1627973910000, "y": 0, }, Object { - "x": 1627373820000, - "y": 0.404761904761905, + "x": 1627973940000, + "y": 0, }, Object { - "x": 1627373850000, - "y": 0.137931034482759, + "x": 1627973970000, + "y": 0.526315789473684, }, Object { - "x": 1627373880000, - "y": 0.0562770562770563, + "x": 1627974000000, + "y": 0.3, }, Object { - "x": 1627373910000, - "y": 0.256198347107438, + "x": 1627974030000, + "y": 0.0166666666666667, }, Object { - "x": 1627373940000, - "y": 0.0357142857142857, + "x": 1627974060000, + "y": 0.129032258064516, }, Object { - "x": 1627373970000, - "y": 0.2, + "x": 1627974090000, + "y": 0.0143884892086331, }, Object { - "x": 1627374000000, - "y": 0, + "x": 1627974120000, + "y": null, }, Object { - "x": 1627374030000, - "y": 0.571428571428571, + "x": 1627974150000, + "y": 0.0471698113207547, }, Object { - "x": 1627374060000, - "y": 0.121212121212121, + "x": 1627974180000, + "y": 0.160714285714286, }, Object { - "x": 1627374090000, - "y": 0.2, + "x": 1627974210000, + "y": 0.0565371024734982, }, Object { - "x": 1627374120000, - "y": 0.25, + "x": 1627974240000, + "y": 0.0384615384615385, }, Object { - "x": 1627374150000, - "y": 0.217391304347826, + "x": 1627974270000, + "y": 0.08, }, Object { - "x": 1627374180000, - "y": 0.3, + "x": 1627974300000, + "y": 0.0579710144927536, }, Object { - "x": 1627374210000, - "y": 0.087719298245614, + "x": 1627974330000, + "y": 0.00108695652173913, }, Object { - "x": 1627374240000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374270000, - "y": null, + "x": 1627974390000, + "y": 0.263888888888889, }, Object { - "x": 1627374300000, - "y": 0, + "x": 1627974420000, + "y": 0.1, }, Object { - "x": 1627374330000, - "y": 0, + "x": 1627974450000, + "y": null, }, Object { - "x": 1627374360000, - "y": 0.5, + "x": 1627974480000, + "y": 0.0193370165745856, }, Object { - "x": 1627374390000, - "y": 0.142857142857143, + "x": 1627974510000, + "y": 0.183908045977011, }, Object { - "x": 1627374420000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374450000, - "y": 0.280373831775701, + "x": 1627974570000, + "y": 0.0357142857142857, }, Object { - "x": 1627374480000, - "y": 0.0576923076923077, + "x": 1627974600000, + "y": 0.2, }, Object { - "x": 1627374510000, - "y": null, + "x": 1627974630000, + "y": 0.0793650793650794, }, Object { - "x": 1627374540000, - "y": 0.230769230769231, + "x": 1627974660000, + "y": 0.0265486725663717, }, Object { - "x": 1627374570000, - "y": 0, + "x": 1627974690000, + "y": null, }, Object { - "x": 1627374600000, - "y": 0.1, + "x": 1627974720000, + "y": 0.192307692307692, }, Object { - "x": 1627374630000, - "y": 0, + "x": 1627974750000, + "y": 0.150375939849624, }, Object { - "x": 1627374660000, - "y": 0.0590909090909091, + "x": 1627974780000, + "y": 0.0561224489795918, }, Object { - "x": 1627374690000, - "y": 0.0638297872340425, + "x": 1627974810000, + "y": null, }, Object { - "x": 1627374720000, - "y": 0, + "x": 1627974840000, + "y": 0.217391304347826, + }, + Object { + "x": 1627974870000, + "y": 0.115942028985507, }, Object { - "x": 1627374750000, - "y": 0.0543478260869565, + "x": 1627974900000, + "y": 0.380281690140845, }, Object { - "x": 1627374780000, - "y": 0.166666666666667, + "x": 1627974930000, + "y": 0.25, }, Object { - "x": 1627374810000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374840000, + "x": 1627974990000, "y": null, }, Object { - "x": 1627374870000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374900000, - "y": 0.206521739130435, - }, - Object { - "x": 1627374930000, - "y": 0.0135593220338983, + "x": 1627975050000, + "y": 0, }, Object { - "x": 1627374960000, - "y": 0.0681818181818182, + "x": 1627975080000, + "y": 0.0738636363636364, }, Object { - "x": 1627374990000, - "y": 0.0652173913043478, + "x": 1627975110000, + "y": 0.157894736842105, }, Object { - "x": 1627375020000, - "y": 0.219178082191781, + "x": 1627975140000, + "y": 0.175438596491228, }, Object { - "x": 1627375050000, - "y": 0.30952380952381, + "x": 1627975170000, + "y": 0.14, }, Object { - "x": 1627375080000, - "y": 0, + "x": 1627975200000, + "y": 0.211764705882353, }, ], "hideLegend": false, - "legendValue": "9.8%", + "legendValue": "3.5%", "title": "postgresql", "type": "areaStacked", }, @@ -766,252 +766,252 @@ Object { "color": "#9170b8", "data": Array [ Object { - "x": 1627373280000, + "x": 1627973400000, "y": null, }, Object { - "x": 1627373310000, - "y": 0, + "x": 1627973430000, + "y": 0.00403225806451613, }, Object { - "x": 1627373340000, - "y": 0, + "x": 1627973460000, + "y": null, }, Object { - "x": 1627373370000, - "y": 0, + "x": 1627973490000, + "y": 0.0123456790123457, }, Object { - "x": 1627373400000, - "y": 0.025, + "x": 1627973520000, + "y": 0.0857142857142857, }, Object { - "x": 1627373430000, - "y": 0.00717703349282297, + "x": 1627973550000, + "y": 0, }, Object { - "x": 1627373460000, - "y": null, + "x": 1627973580000, + "y": 0.0181818181818182, }, Object { - "x": 1627373490000, - "y": 0.0211267605633803, + "x": 1627973610000, + "y": 0, }, Object { - "x": 1627373520000, + "x": 1627973640000, "y": 0, }, Object { - "x": 1627373550000, - "y": 0, + "x": 1627973670000, + "y": 0.00404858299595142, + }, + Object { + "x": 1627973700000, + "y": 0.0151515151515152, }, Object { - "x": 1627373580000, + "x": 1627973730000, "y": 0, }, Object { - "x": 1627373610000, - "y": 0.0294117647058824, + "x": 1627973760000, + "y": 0.00520833333333333, }, Object { - "x": 1627373640000, + "x": 1627973790000, "y": 0, }, Object { - "x": 1627373670000, - "y": 0.0298507462686567, + "x": 1627973820000, + "y": 0, }, Object { - "x": 1627373700000, + "x": 1627973850000, "y": 0, }, Object { - "x": 1627373730000, - "y": 0.0303030303030303, + "x": 1627973880000, + "y": 0, }, Object { - "x": 1627373760000, - "y": 0.087719298245614, + "x": 1627973910000, + "y": 0, }, Object { - "x": 1627373790000, + "x": 1627973940000, "y": 0, }, Object { - "x": 1627373820000, + "x": 1627973970000, "y": 0, }, Object { - "x": 1627373850000, - "y": 0.0344827586206897, + "x": 1627974000000, + "y": 0.0166666666666667, }, Object { - "x": 1627373880000, - "y": 0.012987012987013, + "x": 1627974030000, + "y": 0, }, Object { - "x": 1627373910000, - "y": 0.0247933884297521, + "x": 1627974060000, + "y": 0.112903225806452, }, Object { - "x": 1627373940000, - "y": 0.0714285714285714, + "x": 1627974090000, + "y": 0.00719424460431655, }, Object { - "x": 1627373970000, - "y": 0.0666666666666667, + "x": 1627974120000, + "y": null, }, Object { - "x": 1627374000000, - "y": 0, + "x": 1627974150000, + "y": 0.0377358490566038, }, Object { - "x": 1627374030000, - "y": 0, + "x": 1627974180000, + "y": 0.0357142857142857, }, Object { - "x": 1627374060000, - "y": 0.0151515151515152, + "x": 1627974210000, + "y": 0.0318021201413428, + }, + Object { + "x": 1627974240000, + "y": 0.0192307692307692, }, Object { - "x": 1627374090000, + "x": 1627974270000, "y": 0, }, Object { - "x": 1627374120000, - "y": 0.0714285714285714, + "x": 1627974300000, + "y": 0.0338164251207729, }, Object { - "x": 1627374150000, - "y": 0.0869565217391304, + "x": 1627974330000, + "y": 0.00062111801242236, }, Object { - "x": 1627374180000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374210000, - "y": 0, + "x": 1627974390000, + "y": 0.0416666666666667, }, Object { - "x": 1627374240000, - "y": 0, + "x": 1627974420000, + "y": 0.1, }, Object { - "x": 1627374270000, + "x": 1627974450000, "y": null, }, Object { - "x": 1627374300000, - "y": 0, + "x": 1627974480000, + "y": 0.00552486187845304, }, Object { - "x": 1627374330000, - "y": 0, + "x": 1627974510000, + "y": 0.0114942528735632, }, Object { - "x": 1627374360000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374390000, - "y": 0, + "x": 1627974570000, + "y": 0.0714285714285714, }, Object { - "x": 1627374420000, + "x": 1627974600000, "y": 0, }, Object { - "x": 1627374450000, - "y": 0.0747663551401869, + "x": 1627974630000, + "y": 0.0158730158730159, }, Object { - "x": 1627374480000, - "y": 0, + "x": 1627974660000, + "y": 0.00884955752212389, }, Object { - "x": 1627374510000, + "x": 1627974690000, "y": null, }, Object { - "x": 1627374540000, - "y": 0, + "x": 1627974720000, + "y": 0.0384615384615385, }, Object { - "x": 1627374570000, - "y": 0, + "x": 1627974750000, + "y": 0.0601503759398496, }, Object { - "x": 1627374600000, - "y": 0, + "x": 1627974780000, + "y": 0.0153061224489796, }, Object { - "x": 1627374630000, - "y": 0, - }, - Object { - "x": 1627374660000, - "y": 0, + "x": 1627974810000, + "y": null, }, Object { - "x": 1627374690000, - "y": 0, + "x": 1627974840000, + "y": 0.0434782608695652, }, Object { - "x": 1627374720000, + "x": 1627974870000, "y": 0, }, Object { - "x": 1627374750000, - "y": 0, + "x": 1627974900000, + "y": 0.0140845070422535, }, Object { - "x": 1627374780000, + "x": 1627974930000, "y": 0, }, Object { - "x": 1627374810000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374840000, + "x": 1627974990000, "y": null, }, Object { - "x": 1627374870000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374900000, - "y": 0.0108695652173913, - }, - Object { - "x": 1627374930000, + "x": 1627975050000, "y": 0, }, Object { - "x": 1627374960000, - "y": 0, + "x": 1627975080000, + "y": 0.00568181818181818, }, Object { - "x": 1627374990000, - "y": 0, + "x": 1627975110000, + "y": 0.157894736842105, }, Object { - "x": 1627375020000, - "y": 0.0136986301369863, + "x": 1627975140000, + "y": 0, }, Object { - "x": 1627375050000, - "y": 0.0238095238095238, + "x": 1627975170000, + "y": 0.02, }, Object { - "x": 1627375080000, - "y": 0, + "x": 1627975200000, + "y": 0.0117647058823529, }, ], "hideLegend": false, - "legendValue": "1.0%", + "legendValue": "0.8%", "title": "redis", "type": "areaStacked", }, @@ -1022,247 +1022,247 @@ Object { exports[`APM API tests basic apm_8.0.0 when data is loaded returns the transaction breakdown for a transaction group 9`] = ` Array [ Object { - "x": 1627373280000, + "x": 1627973400000, "y": null, }, Object { - "x": 1627373310000, + "x": 1627973430000, "y": 1, }, Object { - "x": 1627373340000, - "y": 1, + "x": 1627973460000, + "y": null, }, Object { - "x": 1627373370000, + "x": 1627973490000, "y": 1, }, Object { - "x": 1627373400000, + "x": 1627973520000, "y": 1, }, Object { - "x": 1627373430000, - "y": 1, + "x": 1627973550000, + "y": null, }, Object { - "x": 1627373460000, - "y": null, + "x": 1627973580000, + "y": 1, }, Object { - "x": 1627373490000, + "x": 1627973610000, "y": 1, }, Object { - "x": 1627373520000, + "x": 1627973640000, + "y": null, + }, + Object { + "x": 1627973670000, "y": 1, }, Object { - "x": 1627373550000, + "x": 1627973700000, "y": 1, }, Object { - "x": 1627373580000, + "x": 1627973730000, "y": 1, }, Object { - "x": 1627373610000, + "x": 1627973760000, "y": 1, }, Object { - "x": 1627373640000, + "x": 1627973790000, "y": 1, }, Object { - "x": 1627373670000, + "x": 1627973820000, "y": 1, }, Object { - "x": 1627373700000, + "x": 1627973850000, "y": null, }, Object { - "x": 1627373730000, + "x": 1627973880000, "y": 1, }, Object { - "x": 1627373760000, + "x": 1627973910000, "y": 1, }, Object { - "x": 1627373790000, + "x": 1627973940000, "y": 1, }, Object { - "x": 1627373820000, - "y": 1, + "x": 1627973970000, + "y": null, }, Object { - "x": 1627373850000, + "x": 1627974000000, "y": 1, }, Object { - "x": 1627373880000, + "x": 1627974030000, "y": 1, }, Object { - "x": 1627373910000, + "x": 1627974060000, "y": 1, }, Object { - "x": 1627373940000, + "x": 1627974090000, "y": 1, }, Object { - "x": 1627373970000, + "x": 1627974120000, "y": null, }, Object { - "x": 1627374000000, + "x": 1627974150000, "y": 1, }, Object { - "x": 1627374030000, - "y": null, + "x": 1627974180000, + "y": 1, }, Object { - "x": 1627374060000, + "x": 1627974210000, "y": 1, }, Object { - "x": 1627374090000, - "y": null, + "x": 1627974240000, + "y": 1, }, Object { - "x": 1627374120000, - "y": null, + "x": 1627974270000, + "y": 1, }, Object { - "x": 1627374150000, + "x": 1627974300000, "y": 1, }, Object { - "x": 1627374180000, - "y": null, + "x": 1627974330000, + "y": 1, }, Object { - "x": 1627374210000, + "x": 1627974360000, "y": 1, }, Object { - "x": 1627374240000, + "x": 1627974390000, "y": 1, }, Object { - "x": 1627374270000, - "y": null, + "x": 1627974420000, + "y": 1, }, Object { - "x": 1627374300000, - "y": 1, + "x": 1627974450000, + "y": null, }, Object { - "x": 1627374330000, + "x": 1627974480000, "y": 1, }, Object { - "x": 1627374360000, - "y": null, + "x": 1627974510000, + "y": 1, }, Object { - "x": 1627374390000, + "x": 1627974540000, "y": 1, }, Object { - "x": 1627374420000, + "x": 1627974570000, "y": 1, }, Object { - "x": 1627374450000, + "x": 1627974600000, "y": 1, }, Object { - "x": 1627374480000, + "x": 1627974630000, "y": 1, }, Object { - "x": 1627374510000, - "y": null, + "x": 1627974660000, + "y": 1, }, Object { - "x": 1627374540000, + "x": 1627974690000, "y": null, }, Object { - "x": 1627374570000, + "x": 1627974720000, "y": 1, }, Object { - "x": 1627374600000, + "x": 1627974750000, "y": 1, }, Object { - "x": 1627374630000, + "x": 1627974780000, "y": 1, }, Object { - "x": 1627374660000, - "y": 1, + "x": 1627974810000, + "y": null, }, Object { - "x": 1627374690000, - "y": 1, + "x": 1627974840000, + "y": null, }, Object { - "x": 1627374720000, + "x": 1627974870000, "y": 1, }, Object { - "x": 1627374750000, - "y": 1, + "x": 1627974900000, + "y": null, }, Object { - "x": 1627374780000, + "x": 1627974930000, "y": 1, }, Object { - "x": 1627374810000, + "x": 1627974960000, "y": 1, }, Object { - "x": 1627374840000, + "x": 1627974990000, "y": null, }, Object { - "x": 1627374870000, + "x": 1627975020000, "y": 1, }, Object { - "x": 1627374900000, + "x": 1627975050000, "y": 1, }, Object { - "x": 1627374930000, + "x": 1627975080000, "y": 1, }, Object { - "x": 1627374960000, - "y": 1, + "x": 1627975110000, + "y": null, }, Object { - "x": 1627374990000, + "x": 1627975140000, "y": 1, }, Object { - "x": 1627375020000, + "x": 1627975170000, "y": 1, }, Object { - "x": 1627375050000, - "y": null, - }, - Object { - "x": 1627375080000, + "x": 1627975200000, "y": 1, }, ] diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap index 11c53edd5c83e..c4dfaf346d015 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.snap @@ -3,127 +3,127 @@ exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate has the correct error rate 1`] = ` Array [ Object { - "x": 1627373280000, - "y": 0.4, + "x": 1627973400000, + "y": 0, }, Object { - "x": 1627373340000, - "y": 0.25, + "x": 1627973460000, + "y": 0, }, Object { - "x": 1627373400000, - "y": 0, + "x": 1627973520000, + "y": 0.333333333333333, }, Object { - "x": 1627373460000, - "y": 0, + "x": 1627973580000, + "y": 0.181818181818182, }, Object { - "x": 1627373520000, + "x": 1627973640000, "y": 0, }, Object { - "x": 1627373580000, + "x": 1627973700000, "y": 0, }, Object { - "x": 1627373640000, + "x": 1627973760000, + "y": 0.166666666666667, + }, + Object { + "x": 1627973820000, + "y": 0.181818181818182, + }, + Object { + "x": 1627973880000, "y": 0, }, Object { - "x": 1627373700000, + "x": 1627973940000, "y": 0, }, Object { - "x": 1627373760000, + "x": 1627974000000, "y": 0.0833333333333333, }, Object { - "x": 1627373820000, - "y": null, + "x": 1627974060000, + "y": 0.0769230769230769, }, Object { - "x": 1627373880000, + "x": 1627974120000, "y": 0, }, Object { - "x": 1627373940000, - "y": 0.333333333333333, + "x": 1627974180000, + "y": 0.1, }, Object { - "x": 1627374000000, - "y": 0.2, + "x": 1627974240000, + "y": 0.153846153846154, }, Object { - "x": 1627374060000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374120000, - "y": 0, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374180000, + "x": 1627974420000, "y": 0, }, Object { - "x": 1627374240000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374300000, - "y": 0.285714285714286, - }, - Object { - "x": 1627374360000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374420000, - "y": 0.0769230769230769, - }, - Object { - "x": 1627374480000, - "y": 0.142857142857143, + "x": 1627974600000, + "y": 0.125, }, Object { - "x": 1627374540000, - "y": 0, + "x": 1627974660000, + "y": 0.6, }, Object { - "x": 1627374600000, - "y": 0.133333333333333, + "x": 1627974720000, + "y": 0.2, }, Object { - "x": 1627374660000, + "x": 1627974780000, "y": 0, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374780000, - "y": 0.5, + "x": 1627974900000, + "y": 0.0666666666666667, }, Object { - "x": 1627374840000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374960000, + "x": 1627975080000, "y": 0, }, Object { - "x": 1627375020000, - "y": 0, + "x": 1627975140000, + "y": 0.181818181818182, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] @@ -132,67 +132,67 @@ Array [ exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate with comparison data has the correct error rate 1`] = ` Array [ Object { - "x": 1627374180000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374240000, - "y": 0, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374300000, - "y": 0.285714285714286, + "x": 1627974420000, + "y": 0, }, Object { - "x": 1627374360000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374420000, - "y": 0.0769230769230769, + "x": 1627974540000, + "y": 0, }, Object { - "x": 1627374480000, - "y": 0.142857142857143, + "x": 1627974600000, + "y": 0.125, }, Object { - "x": 1627374540000, - "y": 0, + "x": 1627974660000, + "y": 0.6, }, Object { - "x": 1627374600000, - "y": 0.133333333333333, + "x": 1627974720000, + "y": 0.2, }, Object { - "x": 1627374660000, + "x": 1627974780000, "y": 0, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374780000, - "y": 0.5, + "x": 1627974900000, + "y": 0.0666666666666667, }, Object { - "x": 1627374840000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627374960000, + "x": 1627975080000, "y": 0, }, Object { - "x": 1627375020000, - "y": 0, + "x": 1627975140000, + "y": 0.181818181818182, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] @@ -201,67 +201,67 @@ Array [ exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate with comparison data has the correct error rate 2`] = ` Array [ Object { - "x": 1627374180000, - "y": 0.4, - }, - Object { - "x": 1627374240000, - "y": 0.25, + "x": 1627974300000, + "y": 0, }, Object { - "x": 1627374300000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374360000, - "y": 0, + "x": 1627974420000, + "y": 0.333333333333333, }, Object { - "x": 1627374420000, - "y": 0, + "x": 1627974480000, + "y": 0.181818181818182, }, Object { - "x": 1627374480000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374540000, + "x": 1627974600000, "y": 0, }, Object { - "x": 1627374600000, - "y": 0, + "x": 1627974660000, + "y": 0.166666666666667, }, Object { - "x": 1627374660000, - "y": 0.0833333333333333, + "x": 1627974720000, + "y": 0.181818181818182, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974780000, + "y": 0, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374840000, - "y": 0.333333333333333, + "x": 1627974900000, + "y": 0.0833333333333333, }, Object { - "x": 1627374900000, - "y": 0.2, + "x": 1627974960000, + "y": 0.0769230769230769, }, Object { - "x": 1627374960000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627375020000, - "y": 0, + "x": 1627975080000, + "y": 0.1, + }, + Object { + "x": 1627975140000, + "y": 0.153846153846154, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap index 6b03e300db340..ff9e52b57aeaa 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.snap @@ -3,64 +3,64 @@ exports[`APM API tests basic apm_8.0.0 Latency with a basic license when data is loaded time comparison returns some data 1`] = ` Array [ Object { - "x": 1627374180000, - "y": 17647, + "x": 1627974300000, + "y": 22799, }, Object { - "x": 1627374240000, - "y": 15743, + "x": 1627974360000, + "y": 3227391, }, Object { - "x": 1627374300000, - "y": 81311, + "x": 1627974420000, + "y": 15565.2222222222, }, Object { - "x": 1627374360000, - "y": 12303, + "x": 1627974480000, + "y": 54307.5714285714, }, Object { - "x": 1627374420000, - "y": 11344.4545454545, + "x": 1627974540000, + "y": 16655, }, Object { - "x": 1627374480000, - "y": 17843, + "x": 1627974600000, + "y": 9453, }, Object { - "x": 1627374540000, - "y": 35049.6666666667, + "x": 1627974660000, + "y": 31119, }, Object { - "x": 1627374600000, - "y": 19551, + "x": 1627974720000, + "y": 15282.2, }, Object { - "x": 1627374660000, - "y": 34125.5454545455, + "x": 1627974780000, + "y": 18709, }, Object { - "x": 1627374720000, - "y": 34247, + "x": 1627974840000, + "y": 12095, }, Object { - "x": 1627374780000, - "y": 9727, + "x": 1627974900000, + "y": 16291, }, Object { - "x": 1627374840000, - "y": 19711, + "x": 1627974960000, + "y": 13444.3333333333, }, Object { - "x": 1627374900000, - "y": 33738.6363636364, + "x": 1627975020000, + "y": 13241.6666666667, }, Object { - "x": 1627374960000, - "y": 17160.1428571429, + "x": 1627975080000, + "y": 25535, }, Object { - "x": 1627375020000, - "y": 14847, + "x": 1627975140000, + "y": 11024.6, }, ] `; @@ -68,64 +68,64 @@ Array [ exports[`APM API tests basic apm_8.0.0 Latency with a basic license when data is loaded time comparison returns some data 2`] = ` Array [ Object { - "x": 1627374180000, - "y": 11951, + "x": 1627974300000, + "y": 34866.2, }, Object { - "x": 1627374240000, - "y": 13195.8, + "x": 1627974360000, + "y": 104799, }, Object { - "x": 1627374300000, - "y": 33892, + "x": 1627974420000, + "y": 36247, }, Object { - "x": 1627374360000, - "y": 18893.2222222222, + "x": 1627974480000, + "y": 22207, }, Object { - "x": 1627374420000, - "y": 24063, + "x": 1627974540000, + "y": 80191, }, Object { - "x": 1627374480000, - "y": 22984.1428571429, + "x": 1627974600000, + "y": 11520.4545454545, }, Object { - "x": 1627374540000, - "y": 22100.3333333333, + "x": 1627974660000, + "y": 47031.8888888889, }, Object { - "x": 1627374600000, - "y": 11497.6666666667, + "x": 1627974720000, + "y": 30249.6666666667, }, Object { - "x": 1627374660000, - "y": 16639, + "x": 1627974780000, + "y": 14868.3333333333, }, Object { - "x": 1627374720000, - "y": 16719, + "x": 1627974840000, + "y": 17199, }, Object { - "x": 1627374780000, - "y": 18352.7777777778, + "x": 1627974900000, + "y": 19837.2222222222, }, Object { - "x": 1627374840000, - "y": 7635.57142857143, + "x": 1627974960000, + "y": 19397.6666666667, }, Object { - "x": 1627374900000, - "y": 14345.6666666667, + "x": 1627975020000, + "y": 22473.6666666667, }, Object { - "x": 1627374960000, - "y": 10291.5714285714, + "x": 1627975080000, + "y": 11362.2, }, Object { - "x": 1627375020000, - "y": 11847, + "x": 1627975140000, + "y": 26319, }, ] `; @@ -133,14 +133,14 @@ Array [ exports[`APM API tests trial apm_8.0.0 Transaction latency with a trial license when data is loaded with environment selected should return a non-empty anomaly series 1`] = ` Array [ Object { - "x": 1627373700000, - "y": 430148.522515332, - "y0": 0, + "x": 1627974000000, + "y": 85916.7945636914, + "y0": 24329.7607058434, }, Object { - "x": 1627374600000, - "y": 431362.606025631, - "y0": 0, + "x": 1627974900000, + "y": 88154.9755916935, + "y0": 23498.4070709888, }, ] `; diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/top_transaction_groups.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/top_transaction_groups.snap index 5a075ce3eda46..e21c870c7eb52 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/top_transaction_groups.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/top_transaction_groups.snap @@ -3,154 +3,144 @@ exports[`APM API tests basic apm_8.0.0 Top transaction groups when data is loaded returns the correct buckets (when ignoring samples) 1`] = ` Array [ Object { - "averageResponseTime": 1841.66666666667, + "averageResponseTime": 3279, "impact": 0, "key": "POST /api/orders", - "p95": 2600, + "p95": 3264, "serviceName": "opbeans-node", "transactionName": "POST /api/orders", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.0333333333333333, }, Object { - "averageResponseTime": 3015, - "impact": 0.016184662836617, + "averageResponseTime": 2119, + "impact": 0.030253201010799, "key": "GET /*", - "p95": 3952, + "p95": 2296, "serviceName": "opbeans-node", "transactionName": "GET /*", "transactionType": "request", - "transactionsPerMinute": 0.0666666666666667, - }, - Object { - "averageResponseTime": 15807, - "impact": 0.329526145120981, - "key": "POST /api", - "p95": 15744, - "serviceName": "opbeans-node", - "transactionName": "POST /api", - "transactionType": "request", - "transactionsPerMinute": 0.0333333333333333, + "transactionsPerMinute": 0.1, }, Object { - "averageResponseTime": 7135, - "impact": 0.508935536327678, - "key": "GET /api/products", - "p95": 9760, + "averageResponseTime": 5167, + "impact": 0.0693425383792029, + "key": "GET /api/products/:id", + "p95": 6144, "serviceName": "opbeans-node", - "transactionName": "GET /api/products", + "transactionName": "GET /api/products/:id", "transactionType": "request", - "transactionsPerMinute": 0.1, + "transactionsPerMinute": 0.0666666666666667, }, Object { - "averageResponseTime": 11167, - "impact": 0.538708906179593, + "averageResponseTime": 5551, + "impact": 0.349690833515986, "key": "GET /api/orders/:id", - "p95": 11264, + "p95": 11696, "serviceName": "opbeans-node", "transactionName": "GET /api/orders/:id", "transactionType": "request", - "transactionsPerMinute": 0.0666666666666667, + "transactionsPerMinute": 0.233333333333333, }, Object { - "averageResponseTime": 8097.66666666667, - "impact": 1.38005498298527, - "key": "GET /api/products/:id", - "p95": 14640, + "averageResponseTime": 9607, + "impact": 0.723177313441051, + "key": "GET /api/types", + "p95": 18672, "serviceName": "opbeans-node", - "transactionName": "GET /api/products/:id", + "transactionName": "GET /api/types", "transactionType": "request", - "transactionsPerMinute": 0.2, + "transactionsPerMinute": 0.266666666666667, }, Object { - "averageResponseTime": 8836.33333333333, - "impact": 1.5220954298999, - "key": "GET /api/products/top", - "p95": 12144, + "averageResponseTime": 8669.22222222222, + "impact": 0.734647581660545, + "key": "GET /api/products/:id/customers", + "p95": 15920, "serviceName": "opbeans-node", - "transactionName": "GET /api/products/top", + "transactionName": "GET /api/products/:id/customers", "transactionType": "request", - "transactionsPerMinute": 0.2, + "transactionsPerMinute": 0.3, }, Object { - "averageResponseTime": 7675, - "impact": 1.79072878415044, - "key": "GET /api/customers/:id", - "p95": 25200, + "averageResponseTime": 7571, + "impact": 0.860741901273131, + "key": "GET /api/types/:id", + "p95": 13552, "serviceName": "opbeans-node", - "transactionName": "GET /api/customers/:id", + "transactionName": "GET /api/types/:id", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.4, }, Object { - "averageResponseTime": 7919, - "impact": 1.85328811456049, - "key": "GET /api/orders", - "p95": 13216, + "averageResponseTime": 8753.90909090909, + "impact": 0.914220675379615, + "key": "GET /api/customers/:id", + "p95": 11248, "serviceName": "opbeans-node", - "transactionName": "GET /api/orders", + "transactionName": "GET /api/customers/:id", "transactionType": "request", - "transactionsPerMinute": 0.266666666666667, + "transactionsPerMinute": 0.366666666666667, }, Object { - "averageResponseTime": 9546.42857142857, - "impact": 1.9645937265042, - "key": "GET /api/types", - "p95": 15408, + "averageResponseTime": 7807, + "impact": 1.04204487263284, + "key": "GET /api/products/top", + "p95": 14000, "serviceName": "opbeans-node", - "transactionName": "GET /api/types", + "transactionName": "GET /api/products/top", "transactionType": "request", - "transactionsPerMinute": 0.233333333333333, + "transactionsPerMinute": 0.466666666666667, }, Object { - "averageResponseTime": 12204.7142857143, - "impact": 2.56095849098691, - "key": "GET /api/types/:id", - "p95": 29024, + "averageResponseTime": 11913.6666666667, + "impact": 1.37294294450729, + "key": "GET /api/orders", + "p95": 15008, "serviceName": "opbeans-node", - "transactionName": "GET /api/types/:id", + "transactionName": "GET /api/orders", "transactionType": "request", - "transactionsPerMinute": 0.233333333333333, + "transactionsPerMinute": 0.4, }, Object { - "averageResponseTime": 8292.64705882353, - "impact": 4.34101501231637, - "key": "GET /api/products/:id/customers", - "p95": 13360, + "averageResponseTime": 9062.52941176471, + "impact": 1.48203335322037, + "key": "GET /api/products", + "p95": 15728, "serviceName": "opbeans-node", - "transactionName": "GET /api/products/:id/customers", + "transactionName": "GET /api/products", "transactionType": "request", "transactionsPerMinute": 0.566666666666667, }, Object { - "averageResponseTime": 14449, - "impact": 7.23210857633296, + "averageResponseTime": 19858.2, + "impact": 1.91960393665109, "key": "GET /api/stats", - "p95": 20704, + "p95": 33984, "serviceName": "opbeans-node", "transactionName": "GET /api/stats", "transactionType": "request", - "transactionsPerMinute": 0.533333333333333, + "transactionsPerMinute": 0.333333333333333, }, Object { - "averageResponseTime": 26807.8888888889, - "impact": 7.5553851981804, + "averageResponseTime": 22276.8181818182, + "impact": 2.37628180493074, "key": "GET /api/customers", - "p95": 43136, + "p95": 26304, "serviceName": "opbeans-node", "transactionName": "GET /api/customers", "transactionType": "request", - "transactionsPerMinute": 0.3, + "transactionsPerMinute": 0.366666666666667, }, Object { - "averageResponseTime": 33610.3548387097, + "averageResponseTime": 107130.621052632, "impact": 100, "key": "GET /api", - "p95": 98272, + "p95": 151520, "serviceName": "opbeans-node", "transactionName": "GET /api", "transactionType": "request", - "transactionsPerMinute": 3.1, + "transactionsPerMinute": 3.16666666666667, }, ] `; diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_detailed_statistics.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_detailed_statistics.snap index c59c6bf285f2a..0c9bbb378f74c 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_detailed_statistics.snap +++ b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/transactions_groups_detailed_statistics.snap @@ -3,67 +3,67 @@ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct error rate data 1`] = ` Array [ Object { - "x": 1627374180000, - "y": null, - }, - Object { - "x": 1627374240000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374300000, - "y": 0, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374360000, - "y": 0, + "x": 1627974420000, + "y": null, }, Object { - "x": 1627374420000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374480000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374540000, + "x": 1627974600000, "y": 0, }, Object { - "x": 1627374600000, + "x": 1627974660000, "y": 0, }, Object { - "x": 1627374660000, + "x": 1627974720000, "y": null, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974780000, + "y": 0, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": null, }, Object { - "x": 1627374840000, + "x": 1627974900000, "y": 0, }, Object { - "x": 1627374900000, - "y": 0, + "x": 1627974960000, + "y": null, }, Object { - "x": 1627374960000, - "y": 0, + "x": 1627975020000, + "y": null, }, Object { - "x": 1627375020000, + "x": 1627975080000, "y": 0, }, Object { - "x": 1627375080000, + "x": 1627975140000, + "y": null, + }, + Object { + "x": 1627975200000, "y": null, }, ] @@ -72,67 +72,67 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct error rate data 2`] = ` Array [ Object { - "x": 1627374180000, - "y": 0.5, + "x": 1627974300000, + "y": 0, }, Object { - "x": 1627374240000, + "x": 1627974360000, "y": null, }, Object { - "x": 1627374300000, - "y": 0, + "x": 1627974420000, + "y": 1, }, Object { - "x": 1627374360000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374420000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374480000, + "x": 1627974600000, "y": null, }, Object { - "x": 1627374540000, - "y": 0, - }, - Object { - "x": 1627374600000, - "y": 0, + "x": 1627974660000, + "y": null, }, Object { - "x": 1627374660000, - "y": 0, + "x": 1627974720000, + "y": 0.25, }, Object { - "x": 1627374720000, + "x": 1627974780000, "y": null, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374840000, - "y": null, + "x": 1627974900000, + "y": 0, }, Object { - "x": 1627374900000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374960000, + "x": 1627975020000, "y": 0, }, Object { - "x": 1627375020000, - "y": 0, + "x": 1627975080000, + "y": 0.5, + }, + Object { + "x": 1627975140000, + "y": 0.25, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] @@ -141,67 +141,67 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct latency data 1`] = ` Array [ Object { - "x": 1627374180000, - "y": null, + "x": 1627974300000, + "y": 72303, }, Object { - "x": 1627374240000, - "y": 28457.6666666667, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374300000, - "y": 6847, + "x": 1627974420000, + "y": null, }, Object { - "x": 1627374360000, - "y": 10367, + "x": 1627974480000, + "y": 173055, }, Object { - "x": 1627374420000, - "y": 17769.6666666667, + "x": 1627974540000, + "y": 26687, }, Object { - "x": 1627374480000, - "y": 30591, + "x": 1627974600000, + "y": 17867.8, }, Object { - "x": 1627374540000, - "y": 68479, + "x": 1627974660000, + "y": 24319, }, Object { - "x": 1627374600000, - "y": 56788.3333333333, + "x": 1627974720000, + "y": null, }, Object { - "x": 1627374660000, - "y": null, + "x": 1627974780000, + "y": 15743, }, Object { - "x": 1627374720000, + "x": 1627974840000, "y": null, }, Object { - "x": 1627374780000, - "y": null, + "x": 1627974900000, + "y": 31679, }, Object { - "x": 1627374840000, - "y": 8959, + "x": 1627974960000, + "y": null, }, Object { - "x": 1627374900000, - "y": 55999, + "x": 1627975020000, + "y": null, }, Object { - "x": 1627374960000, - "y": 37055, + "x": 1627975080000, + "y": 14391, }, Object { - "x": 1627375020000, - "y": 23935, + "x": 1627975140000, + "y": null, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] @@ -210,67 +210,67 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct latency data 2`] = ` Array [ Object { - "x": 1627374180000, - "y": 16543, + "x": 1627974300000, + "y": 34047, }, Object { - "x": 1627374240000, + "x": 1627974360000, "y": null, }, Object { - "x": 1627374300000, - "y": 33855, + "x": 1627974420000, + "y": 5767167, }, Object { - "x": 1627374360000, - "y": 25167, + "x": 1627974480000, + "y": 10335, }, Object { - "x": 1627374420000, - "y": 13247, + "x": 1627974540000, + "y": 118015, }, Object { - "x": 1627374480000, + "x": 1627974600000, "y": null, }, Object { - "x": 1627374540000, - "y": 50687, + "x": 1627974660000, + "y": null, }, Object { - "x": 1627374600000, - "y": 19007, + "x": 1627974720000, + "y": 1371695, }, Object { - "x": 1627374660000, - "y": 31615, + "x": 1627974780000, + "y": null, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974840000, + "y": 3769087, }, Object { - "x": 1627374780000, - "y": 10879, + "x": 1627974900000, + "y": 19015, }, Object { - "x": 1627374840000, - "y": null, + "x": 1627974960000, + "y": 22356.3333333333, }, Object { - "x": 1627374900000, - "y": 16607, + "x": 1627975020000, + "y": 28447, }, Object { - "x": 1627374960000, - "y": 6687, + "x": 1627975080000, + "y": 33434367, }, Object { - "x": 1627375020000, - "y": 45976.6, + "x": 1627975140000, + "y": 23407, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] @@ -279,67 +279,67 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct throughput data 1`] = ` Array [ Object { - "x": 1627374180000, + "x": 1627974300000, + "y": 2, + }, + Object { + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374240000, - "y": 2, + "x": 1627974420000, + "y": 0, }, Object { - "x": 1627374300000, + "x": 1627974480000, "y": 1, }, Object { - "x": 1627374360000, + "x": 1627974540000, "y": 1, }, Object { - "x": 1627374420000, + "x": 1627974600000, "y": 2, }, Object { - "x": 1627374480000, + "x": 1627974660000, "y": 1, }, Object { - "x": 1627374540000, - "y": 2, + "x": 1627974720000, + "y": 0, }, Object { - "x": 1627374600000, - "y": 2, + "x": 1627974780000, + "y": 1, }, Object { - "x": 1627374660000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374720000, - "y": 0, + "x": 1627974900000, + "y": 2, }, Object { - "x": 1627374780000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374840000, - "y": 1, - }, - Object { - "x": 1627374900000, - "y": 1, + "x": 1627975020000, + "y": 0, }, Object { - "x": 1627374960000, - "y": 2, + "x": 1627975080000, + "y": 4, }, Object { - "x": 1627375020000, - "y": 1, + "x": 1627975140000, + "y": 0, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ] @@ -348,67 +348,67 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns data with previous period returns correct throughput data 2`] = ` Array [ Object { - "x": 1627374180000, - "y": 2, + "x": 1627974300000, + "y": 1, }, Object { - "x": 1627374240000, + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374300000, - "y": 4, + "x": 1627974420000, + "y": 1, }, Object { - "x": 1627374360000, - "y": 4, + "x": 1627974480000, + "y": 2, }, Object { - "x": 1627374420000, - "y": 1, + "x": 1627974540000, + "y": 2, }, Object { - "x": 1627374480000, + "x": 1627974600000, "y": 0, }, Object { - "x": 1627374540000, - "y": 1, + "x": 1627974660000, + "y": 0, }, Object { - "x": 1627374600000, + "x": 1627974720000, "y": 3, }, Object { - "x": 1627374660000, - "y": 2, + "x": 1627974780000, + "y": 0, }, Object { - "x": 1627374720000, - "y": 0, + "x": 1627974840000, + "y": 2, }, Object { - "x": 1627374780000, - "y": 1, + "x": 1627974900000, + "y": 3, }, Object { - "x": 1627374840000, - "y": 0, + "x": 1627974960000, + "y": 2, }, Object { - "x": 1627374900000, + "x": 1627975020000, "y": 1, }, Object { - "x": 1627374960000, - "y": 1, + "x": 1627975080000, + "y": 2, }, Object { - "x": 1627375020000, + "x": 1627975140000, "y": 3, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ] @@ -417,127 +417,127 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 1`] = ` Array [ Object { - "x": 1627373280000, - "y": 16543, + "x": 1627973400000, + "y": 34047, }, Object { - "x": 1627373340000, + "x": 1627973460000, "y": null, }, Object { - "x": 1627373400000, - "y": 33855, + "x": 1627973520000, + "y": 5767167, }, Object { - "x": 1627373460000, - "y": 25167, + "x": 1627973580000, + "y": 10335, }, Object { - "x": 1627373520000, - "y": 13247, + "x": 1627973640000, + "y": 118015, }, Object { - "x": 1627373580000, + "x": 1627973700000, "y": null, }, Object { - "x": 1627373640000, - "y": 50687, - }, - Object { - "x": 1627373700000, - "y": 19007, + "x": 1627973760000, + "y": null, }, Object { - "x": 1627373760000, - "y": 31615, + "x": 1627973820000, + "y": 1371695, }, Object { - "x": 1627373820000, + "x": 1627973880000, "y": null, }, Object { - "x": 1627373880000, - "y": 10879, + "x": 1627973940000, + "y": 3769087, }, Object { - "x": 1627373940000, - "y": null, + "x": 1627974000000, + "y": 19015, }, Object { - "x": 1627374000000, - "y": 16607, + "x": 1627974060000, + "y": 22356.3333333333, }, Object { - "x": 1627374060000, - "y": 6687, + "x": 1627974120000, + "y": 28447, }, Object { - "x": 1627374120000, - "y": 45976.6, + "x": 1627974180000, + "y": 33434367, }, Object { - "x": 1627374180000, - "y": null, + "x": 1627974240000, + "y": 23407, }, Object { - "x": 1627374240000, - "y": 28457.6666666667, + "x": 1627974300000, + "y": 72303, }, Object { - "x": 1627374300000, - "y": 6847, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374360000, - "y": 10367, + "x": 1627974420000, + "y": null, }, Object { - "x": 1627374420000, - "y": 17769.6666666667, + "x": 1627974480000, + "y": 173055, }, Object { - "x": 1627374480000, - "y": 30591, + "x": 1627974540000, + "y": 26687, }, Object { - "x": 1627374540000, - "y": 68479, + "x": 1627974600000, + "y": 17867.8, }, Object { - "x": 1627374600000, - "y": 56788.3333333333, + "x": 1627974660000, + "y": 24319, }, Object { - "x": 1627374660000, + "x": 1627974720000, "y": null, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974780000, + "y": 15743, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": null, }, Object { - "x": 1627374840000, - "y": 8959, + "x": 1627974900000, + "y": 31679, + }, + Object { + "x": 1627974960000, + "y": null, }, Object { - "x": 1627374900000, - "y": 55999, + "x": 1627975020000, + "y": null, }, Object { - "x": 1627374960000, - "y": 37055, + "x": 1627975080000, + "y": 14391, }, Object { - "x": 1627375020000, - "y": 23935, + "x": 1627975140000, + "y": null, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] @@ -546,127 +546,127 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 2`] = ` Array [ Object { - "x": 1627373280000, - "y": 2, + "x": 1627973400000, + "y": 1, }, Object { - "x": 1627373340000, + "x": 1627973460000, "y": 0, }, Object { - "x": 1627373400000, - "y": 4, + "x": 1627973520000, + "y": 1, }, Object { - "x": 1627373460000, - "y": 4, + "x": 1627973580000, + "y": 2, }, Object { - "x": 1627373520000, - "y": 1, + "x": 1627973640000, + "y": 2, }, Object { - "x": 1627373580000, + "x": 1627973700000, "y": 0, }, Object { - "x": 1627373640000, - "y": 1, + "x": 1627973760000, + "y": 0, }, Object { - "x": 1627373700000, + "x": 1627973820000, "y": 3, }, Object { - "x": 1627373760000, - "y": 2, + "x": 1627973880000, + "y": 0, }, Object { - "x": 1627373820000, - "y": 0, + "x": 1627973940000, + "y": 2, }, Object { - "x": 1627373880000, - "y": 1, + "x": 1627974000000, + "y": 3, }, Object { - "x": 1627373940000, - "y": 0, + "x": 1627974060000, + "y": 2, }, Object { - "x": 1627374000000, + "x": 1627974120000, "y": 1, }, Object { - "x": 1627374060000, - "y": 1, + "x": 1627974180000, + "y": 2, }, Object { - "x": 1627374120000, + "x": 1627974240000, "y": 3, }, Object { - "x": 1627374180000, + "x": 1627974300000, + "y": 2, + }, + Object { + "x": 1627974360000, "y": 0, }, Object { - "x": 1627374240000, - "y": 2, + "x": 1627974420000, + "y": 0, }, Object { - "x": 1627374300000, + "x": 1627974480000, "y": 1, }, Object { - "x": 1627374360000, + "x": 1627974540000, "y": 1, }, Object { - "x": 1627374420000, + "x": 1627974600000, "y": 2, }, Object { - "x": 1627374480000, + "x": 1627974660000, "y": 1, }, Object { - "x": 1627374540000, - "y": 2, + "x": 1627974720000, + "y": 0, }, Object { - "x": 1627374600000, - "y": 2, + "x": 1627974780000, + "y": 1, }, Object { - "x": 1627374660000, + "x": 1627974840000, "y": 0, }, Object { - "x": 1627374720000, - "y": 0, + "x": 1627974900000, + "y": 2, }, Object { - "x": 1627374780000, + "x": 1627974960000, "y": 0, }, Object { - "x": 1627374840000, - "y": 1, - }, - Object { - "x": 1627374900000, - "y": 1, + "x": 1627975020000, + "y": 0, }, Object { - "x": 1627374960000, - "y": 2, + "x": 1627975080000, + "y": 4, }, Object { - "x": 1627375020000, - "y": 1, + "x": 1627975140000, + "y": 0, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": 0, }, ] @@ -675,127 +675,127 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data 3`] = ` Array [ Object { - "x": 1627373280000, - "y": 0.5, + "x": 1627973400000, + "y": 0, }, Object { - "x": 1627373340000, + "x": 1627973460000, "y": null, }, Object { - "x": 1627373400000, - "y": 0, + "x": 1627973520000, + "y": 1, }, Object { - "x": 1627373460000, + "x": 1627973580000, "y": 0, }, Object { - "x": 1627373520000, + "x": 1627973640000, "y": 0, }, Object { - "x": 1627373580000, + "x": 1627973700000, "y": null, }, Object { - "x": 1627373640000, - "y": 0, - }, - Object { - "x": 1627373700000, - "y": 0, + "x": 1627973760000, + "y": null, }, Object { - "x": 1627373760000, - "y": 0, + "x": 1627973820000, + "y": 0.25, }, Object { - "x": 1627373820000, + "x": 1627973880000, "y": null, }, Object { - "x": 1627373880000, + "x": 1627973940000, "y": 0, }, Object { - "x": 1627373940000, - "y": null, + "x": 1627974000000, + "y": 0, }, Object { - "x": 1627374000000, + "x": 1627974060000, "y": 0, }, Object { - "x": 1627374060000, + "x": 1627974120000, "y": 0, }, Object { - "x": 1627374120000, - "y": 0, + "x": 1627974180000, + "y": 0.5, }, Object { - "x": 1627374180000, - "y": null, + "x": 1627974240000, + "y": 0.25, }, Object { - "x": 1627374240000, + "x": 1627974300000, "y": 0, }, Object { - "x": 1627374300000, - "y": 0, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374360000, - "y": 0, + "x": 1627974420000, + "y": null, }, Object { - "x": 1627374420000, + "x": 1627974480000, "y": 0, }, Object { - "x": 1627374480000, + "x": 1627974540000, "y": 0, }, Object { - "x": 1627374540000, + "x": 1627974600000, "y": 0, }, Object { - "x": 1627374600000, + "x": 1627974660000, "y": 0, }, Object { - "x": 1627374660000, + "x": 1627974720000, "y": null, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974780000, + "y": 0, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": null, }, Object { - "x": 1627374840000, + "x": 1627974900000, "y": 0, }, Object { - "x": 1627374900000, - "y": 0, + "x": 1627974960000, + "y": null, }, Object { - "x": 1627374960000, - "y": 0, + "x": 1627975020000, + "y": null, }, Object { - "x": 1627375020000, + "x": 1627975080000, "y": 0, }, Object { - "x": 1627375080000, + "x": 1627975140000, + "y": null, + }, + Object { + "x": 1627975200000, "y": null, }, ] @@ -804,127 +804,127 @@ Array [ exports[`APM API tests basic apm_8.0.0 Transaction groups detailed statistics when data is loaded returns the correct data for latency aggregation 99th percentile 1`] = ` Array [ Object { - "x": 1627373280000, - "y": 20351, + "x": 1627973400000, + "y": 34047, }, Object { - "x": 1627373340000, + "x": 1627973460000, "y": null, }, Object { - "x": 1627373400000, - "y": 54271, + "x": 1627973520000, + "y": 5767167, }, Object { - "x": 1627373460000, - "y": 51455, + "x": 1627973580000, + "y": 16127, }, Object { - "x": 1627373520000, - "y": 13247, + "x": 1627973640000, + "y": 214015, }, Object { - "x": 1627373580000, + "x": 1627973700000, "y": null, }, Object { - "x": 1627373640000, - "y": 50687, - }, - Object { - "x": 1627373700000, - "y": 24063, + "x": 1627973760000, + "y": null, }, Object { - "x": 1627373760000, - "y": 35583, + "x": 1627973820000, + "y": 5439487, }, Object { - "x": 1627373820000, + "x": 1627973880000, "y": null, }, Object { - "x": 1627373880000, - "y": 10879, + "x": 1627973940000, + "y": 5668863, }, Object { - "x": 1627373940000, - "y": null, + "x": 1627974000000, + "y": 32255, }, Object { - "x": 1627374000000, - "y": 19199, + "x": 1627974060000, + "y": 28159, }, Object { - "x": 1627374060000, - "y": 6687, + "x": 1627974120000, + "y": 44287, }, Object { - "x": 1627374120000, - "y": 54783, + "x": 1627974180000, + "y": 66846719, }, Object { - "x": 1627374180000, - "y": null, + "x": 1627974240000, + "y": 42751, }, Object { - "x": 1627374240000, - "y": 32767, + "x": 1627974300000, + "y": 140287, }, Object { - "x": 1627374300000, - "y": 6847, + "x": 1627974360000, + "y": null, }, Object { - "x": 1627374360000, - "y": 10367, + "x": 1627974420000, + "y": null, }, Object { - "x": 1627374420000, - "y": 31999, + "x": 1627974480000, + "y": 173055, }, Object { - "x": 1627374480000, - "y": 34303, + "x": 1627974540000, + "y": 28927, }, Object { - "x": 1627374540000, - "y": 194559, + "x": 1627974600000, + "y": 39679, }, Object { - "x": 1627374600000, - "y": 91135, + "x": 1627974660000, + "y": 24319, }, Object { - "x": 1627374660000, + "x": 1627974720000, "y": null, }, Object { - "x": 1627374720000, - "y": null, + "x": 1627974780000, + "y": 15743, }, Object { - "x": 1627374780000, + "x": 1627974840000, "y": null, }, Object { - "x": 1627374840000, - "y": 8959, + "x": 1627974900000, + "y": 33791, }, Object { - "x": 1627374900000, - "y": 182271, + "x": 1627974960000, + "y": null, }, Object { - "x": 1627374960000, - "y": 51455, + "x": 1627975020000, + "y": null, }, Object { - "x": 1627375020000, - "y": 23935, + "x": 1627975080000, + "y": 23167, + }, + Object { + "x": 1627975140000, + "y": null, }, Object { - "x": 1627375080000, + "x": 1627975200000, "y": null, }, ] diff --git a/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts b/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts index 1de8c0c331b89..bc04f597c364d 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/breakdown.ts @@ -69,23 +69,23 @@ export default function ApiTest({ getService }: FtrProviderContext) { ).toMatchInline(` Array [ Object { - "x": "2021-07-27T08:08:00.000Z", + "x": "2021-08-03T06:50:00.000Z", "y": null, }, Object { - "x": "2021-07-27T08:08:30.000Z", + "x": "2021-08-03T06:50:30.000Z", "y": 1, }, Object { - "x": "2021-07-27T08:09:00.000Z", - "y": 1, + "x": "2021-08-03T06:51:00.000Z", + "y": null, }, Object { - "x": "2021-07-27T08:09:30.000Z", + "x": "2021-08-03T06:51:30.000Z", "y": 1, }, Object { - "x": "2021-07-27T08:10:00.000Z", + "x": "2021-08-03T06:52:00.000Z", "y": 1, }, ] diff --git a/x-pack/test/apm_api_integration/tests/transactions/distribution.ts b/x-pack/test/apm_api_integration/tests/transactions/distribution.ts index 2c1a79889fad5..36af3c477b2fd 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/distribution.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/distribution.ts @@ -64,11 +64,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); it('returns the correct number of buckets', () => { - expectSnapshot(response.body.buckets.length).toMatchInline(`12`); + expectSnapshot(response.body.buckets.length).toMatchInline(`26`); }); it('returns the correct bucket size', () => { - expectSnapshot(response.body.bucketSize).toMatchInline(`5000`); + expectSnapshot(response.body.bucketSize).toMatchInline(`1000`); }); it('returns the correct buckets', () => { @@ -76,22 +76,14 @@ export default function ApiTest({ getService }: FtrProviderContext) { (bucket: any) => !isEmpty(bucket.samples) ); - expectSnapshot(bucketWithSamples.count).toMatchInline(`3`); + expectSnapshot(bucketWithSamples.count).toMatchInline(`1`); expectSnapshot(bucketWithSamples.samples.sort((sample: any) => sample.traceId)) .toMatchInline(` Array [ Object { - "traceId": "e48afea3046e0e8c17c72bf8bfac1607", - "transactionId": "ed4e7a5c044aff66", - }, - Object { - "traceId": "0733f58b70d8a3fd983a15459e4a5fcf", - "transactionId": "564511c803125e00", - }, - Object { - "traceId": "c1bc7fcf4e999c03107c129c131fb55c", - "transactionId": "82c81c2c6c483da3", + "traceId": "6d85d8f1bc4bbbfdb19cdba59d2fc164", + "transactionId": "d0a16f0f52f25d6b", }, ] `); diff --git a/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts b/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts index 6d7abeeb1a996..23819fc05a257 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/error_rate.ts @@ -101,7 +101,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { new Date( first(errorRateResponse.currentPeriod.transactionErrorRate)?.x ?? NaN ).toISOString() - ).toMatchInline(`"2021-07-27T08:08:00.000Z"`); + ).toMatchInline(`"2021-08-03T06:50:00.000Z"`); }); it('has the correct end date', () => { @@ -109,7 +109,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { new Date( last(errorRateResponse.currentPeriod.transactionErrorRate)?.x ?? NaN ).toISOString() - ).toMatchInline(`"2021-07-27T08:38:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); }); it('has the correct number of buckets', () => { @@ -120,7 +120,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('has the correct calculation for average', () => { expectSnapshot(errorRateResponse.currentPeriod.average).toMatchInline( - `0.0646551724137931` + `0.0848214285714286` ); }); @@ -172,12 +172,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { new Date( first(errorRateResponse.currentPeriod.transactionErrorRate)?.x ?? NaN ).toISOString() - ).toMatchInline(`"2021-07-27T08:23:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); expectSnapshot( new Date( first(errorRateResponse.previousPeriod.transactionErrorRate)?.x ?? NaN ).toISOString() - ).toMatchInline(`"2021-07-27T08:23:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); }); it('has the correct end date', () => { @@ -185,12 +185,12 @@ export default function ApiTest({ getService }: FtrProviderContext) { new Date( last(errorRateResponse.currentPeriod.transactionErrorRate)?.x ?? NaN ).toISOString() - ).toMatchInline(`"2021-07-27T08:38:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); expectSnapshot( new Date( last(errorRateResponse.previousPeriod.transactionErrorRate)?.x ?? NaN ).toISOString() - ).toMatchInline(`"2021-07-27T08:38:00.000Z"`); + ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); }); it('has the correct number of buckets', () => { @@ -204,10 +204,10 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('has the correct calculation for average', () => { expectSnapshot(errorRateResponse.currentPeriod.average).toMatchInline( - `0.0514705882352941` + `0.0792079207920792` ); expectSnapshot(errorRateResponse.previousPeriod.average).toMatchInline( - `0.0833333333333333` + `0.0894308943089431` ); }); diff --git a/x-pack/test/apm_api_integration/tests/transactions/latency.ts b/x-pack/test/apm_api_integration/tests/transactions/latency.ts index 12a84ef711ea9..9ba20fb987aca 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/latency.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/latency.ts @@ -160,7 +160,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(latencyChartReturn.currentPeriod.overallAvgDuration).not.to.be(null); expectSnapshot(latencyChartReturn.currentPeriod.overallAvgDuration).toMatchInline( - `22281.4255319149` + `53906.6603773585` ); expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(31); @@ -293,7 +293,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(latencyChartReturn).to.have.property('anomalyTimeseries'); expect(latencyChartReturn.anomalyTimeseries).to.have.property('jobId'); expectSnapshot(latencyChartReturn.anomalyTimeseries?.jobId).toMatchInline( - `"apm-production-802c-high_mean_transaction_duration"` + `"apm-production-6117-high_mean_transaction_duration"` ); }); diff --git a/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts b/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts index 2125a61ac4ba2..4bcd846316bd3 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/top_transaction_groups.ts @@ -61,7 +61,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); it('returns the correct number of buckets', () => { - expectSnapshot(response.body.items.length).toMatchInline(`15`); + expectSnapshot(response.body.items.length).toMatchInline(`14`); }); it('returns the correct buckets (when ignoring samples)', async () => { diff --git a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_detailed_statistics.ts b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_detailed_statistics.ts index 24bee86b3a4b4..bf0b4d3118904 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_detailed_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_detailed_statistics.ts @@ -104,7 +104,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(removeEmptyCoordinates(errorRate).length).to.be.greaterThan(0); expectSnapshot(errorRate).toMatch(); - expectSnapshot(roundNumber(impact)).toMatchInline(`"45.25"`); + expectSnapshot(roundNumber(impact)).toMatchInline(`"98.49"`); }); it('returns the correct data for latency aggregation 99th percentile', async () => { @@ -280,8 +280,8 @@ export default function ApiTest({ getService }: FtrProviderContext) { const currentPeriodFirstItem = currentPeriodItems[0]; const previousPeriodFirstItem = previousPeriodItems[0]; - expectSnapshot(roundNumber(currentPeriodFirstItem.impact)).toMatchInline(`"41.24"`); - expectSnapshot(roundNumber(previousPeriodFirstItem.impact)).toMatchInline(`"51.40"`); + expectSnapshot(roundNumber(currentPeriodFirstItem.impact)).toMatchInline(`"59.04"`); + expectSnapshot(roundNumber(previousPeriodFirstItem.impact)).toMatchInline(`"99.05"`); }); }); } diff --git a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts index c52c7efc14f62..19cdcd5f0671a 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/transactions_groups_main_statistics.ts @@ -72,15 +72,15 @@ export default function ApiTest({ getService }: FtrProviderContext) { ).toMatchInline(` Array [ "DispatcherServlet#doGet", - "APIRestController#topProducts", - "APIRestController#customerWhoBought", "ResourceHttpRequestHandler", - "APIRestController#orders", + "APIRestController#topProducts", "APIRestController#customer", - "APIRestController#products", - "APIRestController#product", "APIRestController#order", "APIRestController#stats", + "APIRestController#customerWhoBought", + "APIRestController#product", + "APIRestController#orders", + "APIRestController#products", "APIRestController#customers", "DispatcherServlet#doPost", ] @@ -91,18 +91,18 @@ export default function ApiTest({ getService }: FtrProviderContext) { ); expectSnapshot(impacts).toMatchInline(` Array [ - 45.2518944682114, - 7.66727553895448, - 6.67159361826343, - 6.77808118340561, - 4.02770970947908, - 5.4534910738867, - 4.13361150758861, - 4.84592862623963, - 2.34043217891668, - 7.66153990342654, - 5.09839421730785, - 0.0700479743199733, + 98.4867713293593, + 0.0910992862692518, + 0.217172932411727, + 0.197499651612207, + 0.117088451625813, + 0.203168003440319, + 0.0956764857936742, + 0.353287132108131, + 0.043688393280619, + 0.0754467823979389, + 0.115710953190738, + 0.00339059851027124, ] `); @@ -113,11 +113,11 @@ export default function ApiTest({ getService }: FtrProviderContext) { expectSnapshot(pick(firstItem, 'name', 'latency', 'throughput', 'errorRate', 'impact')) .toMatchInline(` Object { - "errorRate": 0.0181818181818182, - "impact": 45.2518944682114, - "latency": 33710.1272727273, + "errorRate": 0.08, + "impact": 98.4867713293593, + "latency": 1816019.48, "name": "DispatcherServlet#doGet", - "throughput": 1.83333333333333, + "throughput": 1.66666666666667, } `); }); @@ -140,7 +140,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { const transctionsGroupsPrimaryStatistics = response.body as TransactionsGroupsPrimaryStatistics; const firstItem = transctionsGroupsPrimaryStatistics.transactionGroups[0]; - expectSnapshot(firstItem.latency).toMatchInline(`193944.6`); + expectSnapshot(firstItem.latency).toMatchInline(`66846719`); }); } ); diff --git a/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts b/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts index 68a78dd842c4b..073d08c5b1d8d 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts +++ b/x-pack/test/fleet_api_integration/apis/epm/final_pipeline.ts @@ -91,6 +91,26 @@ export default function (providerContext: FtrProviderContext) { ); }); + it('all docs should contain event.ingested without sub-seconds', async () => { + const res = await es.index({ + index: 'logs-log.log-test', + body: { + '@timestamp': '2020-01-01T09:09:00', + message: 'hello', + }, + }); + + const { body: doc } = await es.get({ + id: res.body._id, + index: res.body._index, + }); + // @ts-expect-error + const ingestTimestamp = doc._source.event.ingested; + + // 2021-06-30T12:06:28Z + expect(ingestTimestamp).to.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/); + }); + it('For a doc written without api key should write the correct api key status', async () => { const res = await es.index({ index: 'logs-log.log-test', diff --git a/x-pack/test/functional/apps/canvas/custom_elements.ts b/x-pack/test/functional/apps/canvas/custom_elements.ts index 026cfbb2f037c..bf9317373b909 100644 --- a/x-pack/test/functional/apps/canvas/custom_elements.ts +++ b/x-pack/test/functional/apps/canvas/custom_elements.ts @@ -18,13 +18,14 @@ export default function canvasCustomElementTest({ const retry = getService('retry'); const PageObjects = getPageObjects(['canvas', 'common']); const find = getService('find'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default'; describe('custom elements', function () { this.tags('skipFirefox'); before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/canvas/default'); + await kibanaServer.importExport.load(archive); // open canvas home await PageObjects.common.navigateToApp('canvas'); // load test workpad @@ -33,6 +34,10 @@ export default function canvasCustomElementTest({ }); }); + after(async () => { + await kibanaServer.importExport.unload(archive); + }); + it('creates a custom element from an element when prompted', async () => { // find the first workpad element (a markdown element) and click it to select it await testSubjects.click('canvasWorkpadPage > canvasWorkpadPageElementContent', 20000); diff --git a/x-pack/test/functional/apps/canvas/expression.ts b/x-pack/test/functional/apps/canvas/expression.ts index 3e2c20d4dc7da..ecde3a24be423 100644 --- a/x-pack/test/functional/apps/canvas/expression.ts +++ b/x-pack/test/functional/apps/canvas/expression.ts @@ -14,20 +14,26 @@ export default function canvasExpressionTest({ getService, getPageObjects }: Ftr const retry = getService('retry'); const PageObjects = getPageObjects(['canvas', 'common']); const find = getService('find'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default'; describe('expression editor', function () { // there is an issue with FF not properly clicking on workpad elements this.tags('skipFirefox'); before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/canvas/default'); + await kibanaServer.importExport.load(archive); + // load test workpad await PageObjects.common.navigateToApp('canvas', { hash: '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1', }); }); + after(async () => { + await kibanaServer.importExport.unload(archive); + }); + it('updates when element is changed via side bar', async () => { // wait for all our elements to load up await retry.try(async () => { diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts index cc6d1b8720462..3b5e30e994b71 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_security.ts @@ -9,22 +9,20 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); const security = getService('security'); const PageObjects = getPageObjects(['common', 'canvas', 'error', 'security', 'spaceSelector']); const appsMenu = getService('appsMenu'); const globalNav = getService('globalNav'); const testSubjects = getService('testSubjects'); + const kibanaServer = getService('kibanaServer'); + const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default'; describe('security feature controls', function () { this.tags(['skipFirefox']); - before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/canvas/default'); - }); - after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/canvas/default'); - }); + before(async () => await kibanaServer.importExport.load(archive)); + + after(async () => await kibanaServer.importExport.unload(archive)); describe('global canvas all privileges', () => { before(async () => { diff --git a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts index 3e6c7b9b3080a..a47ebeac3861a 100644 --- a/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts +++ b/x-pack/test/functional/apps/canvas/feature_controls/canvas_spaces.ts @@ -14,18 +14,29 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'canvas', 'security', 'spaceSelector']); const appsMenu = getService('appsMenu'); const testSubjects = getService('testSubjects'); + const kibanaServer = getService('kibanaServer'); + const soInfo = getService('savedObjectInfo'); + const log = getService('log'); describe('spaces feature controls', function () { this.tags(['skipFirefox']); + before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); }); + after(async () => { + await kibanaServer.savedObjects.clean({ types: ['canvas-workpad'] }); + await soInfo.logSoTypes(log); + }); + describe('space with no features disabled', () => { + const canvasDefaultArchive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default'; + before(async () => { // we need to load the following in every situation as deleting // a space deletes all of the associated saved objects - await esArchiver.load('x-pack/test/functional/es_archives/canvas/default'); + await kibanaServer.importExport.load(canvasDefaultArchive); await spacesService.create({ id: 'custom_space', @@ -36,7 +47,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { after(async () => { await spacesService.delete('custom_space'); - await esArchiver.unload('x-pack/test/functional/es_archives/canvas/default'); + await kibanaServer.importExport.unload(canvasDefaultArchive); }); it('shows canvas navlink', async () => { @@ -81,10 +92,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); describe('space with Canvas disabled', () => { + const spaceWithCanvasDisabledArchive = + 'x-pack/test/functional/fixtures/kbn_archiver/spaces/disabled_features'; + before(async () => { // we need to load the following in every situation as deleting // a space deletes all of the associated saved objects - await esArchiver.load('x-pack/test/functional/es_archives/spaces/disabled_features'); + await kibanaServer.importExport.load(spaceWithCanvasDisabledArchive); await spacesService.create({ id: 'custom_space', name: 'custom_space', @@ -94,7 +108,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { after(async () => { await spacesService.delete('custom_space'); - await esArchiver.unload('x-pack/test/functional/es_archives/spaces/disabled_features'); + await kibanaServer.importExport.unload(spaceWithCanvasDisabledArchive); }); it(`doesn't show canvas navlink`, async () => { diff --git a/x-pack/test/functional/apps/canvas/filters.ts b/x-pack/test/functional/apps/canvas/filters.ts index 5a82aaa24d64b..e5b97fa2350f1 100644 --- a/x-pack/test/functional/apps/canvas/filters.ts +++ b/x-pack/test/functional/apps/canvas/filters.ts @@ -14,20 +14,24 @@ export default function canvasFiltersTest({ getService, getPageObjects }: FtrPro const retry = getService('retry'); const PageObjects = getPageObjects(['canvas', 'common']); const find = getService('find'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/filter'; describe('filters', function () { // there is an issue with FF not properly clicking on workpad elements this.tags('skipFirefox'); before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/canvas/filter'); + await kibanaServer.importExport.load(archive); // load test workpad await PageObjects.common.navigateToApp('canvas', { hash: '/workpad/workpad-b5618217-56d2-47fa-b756-1be2306cda68/page/1', }); }); + after(async () => { + await kibanaServer.importExport.unload(archive); + }); it('filter updates when dropdown is changed', async () => { // wait for all our elements to load up await retry.try(async () => { diff --git a/x-pack/test/functional/apps/canvas/lens.ts b/x-pack/test/functional/apps/canvas/lens.ts index 67ba40a99684e..7c8eca0228c2f 100644 --- a/x-pack/test/functional/apps/canvas/lens.ts +++ b/x-pack/test/functional/apps/canvas/lens.ts @@ -10,10 +10,16 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function canvasLensTest({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['canvas', 'common', 'header', 'lens']); const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const archives = { + es: 'x-pack/test/functional/es_archives/canvas/logstash_lens', + kbn: 'x-pack/test/functional/fixtures/kbn_archiver/canvas/lens', + }; describe('lens in canvas', function () { before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/canvas/lens'); + await esArchiver.load(archives.es); + await kibanaServer.importExport.load(archives.kbn); // open canvas home await PageObjects.common.navigateToApp('canvas'); // load test workpad @@ -23,7 +29,8 @@ export default function canvasLensTest({ getService, getPageObjects }: FtrProvid }); after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/canvas/lens'); + await esArchiver.unload(archives.es); + await kibanaServer.importExport.unload(archives.kbn); }); it('renders lens visualization', async () => { diff --git a/x-pack/test/functional/apps/canvas/reports.ts b/x-pack/test/functional/apps/canvas/reports.ts index 2c5a027df21aa..32dd89e025855 100644 --- a/x-pack/test/functional/apps/canvas/reports.ts +++ b/x-pack/test/functional/apps/canvas/reports.ts @@ -11,11 +11,12 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const es = getService('es'); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); const browser = getService('browser'); const log = getService('log'); const security = getService('security'); const PageObjects = getPageObjects(['reporting', 'common', 'canvas']); + const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/reports'; describe('Canvas PDF Report Generation', () => { before('initialize tests', async () => { @@ -31,11 +32,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ], }); await security.testUser.setRoles(['kibana_admin', 'test_reporting_user']); - await esArchiver.load('x-pack/test/functional/es_archives/canvas/reports'); + await kibanaServer.importExport.load(archive); await browser.setWindowSize(1600, 850); }); after('clean up archives', async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/canvas/reports'); + await kibanaServer.importExport.unload(archive); await es.deleteByQuery({ index: '.reporting-*', refresh: true, diff --git a/x-pack/test/functional/apps/canvas/smoke_test.js b/x-pack/test/functional/apps/canvas/smoke_test.js index cb29840c4b2aa..d2ec930579c92 100644 --- a/x-pack/test/functional/apps/canvas/smoke_test.js +++ b/x-pack/test/functional/apps/canvas/smoke_test.js @@ -12,7 +12,8 @@ export default function canvasSmokeTest({ getService, getPageObjects }) { const browser = getService('browser'); const retry = getService('retry'); const PageObjects = getPageObjects(['common']); - const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const archive = 'x-pack/test/functional/fixtures/kbn_archiver/canvas/default'; describe('smoke test', function () { this.tags('includeFirefox'); @@ -20,10 +21,14 @@ export default function canvasSmokeTest({ getService, getPageObjects }) { const testWorkpadId = 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31'; before(async () => { - await esArchiver.load('x-pack/test/functional/es_archives/canvas/default'); + await kibanaServer.importExport.load(archive); await PageObjects.common.navigateToApp('canvas'); }); + after(async () => { + await kibanaServer.importExport.unload(archive); + }); + it('loads workpad list', async () => { await retry.try(async () => { const workpadRows = await testSubjects.findAll(workpadListSelector); diff --git a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts index 6c3e5b8f01102..83ad18ed369ae 100644 --- a/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts +++ b/x-pack/test/functional/apps/discover/feature_controls/discover_security.ts @@ -25,6 +25,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const appsMenu = getService('appsMenu'); const queryBar = getService('queryBar'); const savedQueryManagementComponent = getService('savedQueryManagementComponent'); + const kibanaServer = getService('kibanaServer'); async function setDiscoverTimeRange() { await PageObjects.timePicker.setDefaultAbsoluteRange(); @@ -32,8 +33,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('discover feature controls security', () => { before(async () => { - await esArchiver.load( - 'x-pack/test/functional/es_archives/discover/feature_controls/security' + await kibanaServer.importExport.load( + 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/security' ); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); @@ -42,8 +43,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); after(async () => { - await esArchiver.unload( - 'x-pack/test/functional/es_archives/discover/feature_controls/security' + await kibanaServer.importExport.unload( + 'x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/security' ); // logout, so the other tests don't accidentally run as the custom users we're testing below diff --git a/x-pack/test/functional/es_archives/canvas/filter/data.json.gz b/x-pack/test/functional/es_archives/canvas/filter/data.json.gz deleted file mode 100644 index 524a5c38fc376..0000000000000 Binary files a/x-pack/test/functional/es_archives/canvas/filter/data.json.gz and /dev/null differ diff --git a/x-pack/test/functional/es_archives/canvas/filter/mappings.json b/x-pack/test/functional/es_archives/canvas/filter/mappings.json deleted file mode 100644 index 66f40d746b794..0000000000000 --- a/x-pack/test/functional/es_archives/canvas/filter/mappings.json +++ /dev/null @@ -1,2431 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": { - } - }, - "index": ".kibana_1", - "mappings": { - "_meta": { - "migrationMappingPropertyHashes": { - "action": "6e96ac5e648f57523879661ea72525b7", - "action_task_params": "a9d49f184ee89641044be0ca2950fa3a", - "alert": "eaf6f5841dbf4cb5e3045860f75f53ca", - "apm-indices": "9bb9b2bf1fa636ed8619cbab5ce6a1dd", - "apm-telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "app_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "application_usage_daily": "43b8830d5d0df85a6823d290885fc9fd", - "application_usage_totals": "3d1b76c39bfb2cc8296b024d73854724", - "application_usage_transactional": "3d1b76c39bfb2cc8296b024d73854724", - "canvas-element": "7390014e1091044523666d97247392fc", - "canvas-workpad": "b0a1706d356228dbdcb4a17e6b9eb231", - "canvas-workpad-template": "ae2673f678281e2c055d764b153e9715", - "cases": "477f214ff61acc3af26a7b7818e380c1", - "cases-comments": "c2061fb929f585df57425102fa928b4b", - "cases-configure": "387c5f3a3bda7e0ae0dd4e106f914a69", - "cases-user-actions": "32277330ec6b721abe3b846cfd939a71", - "config": "c63748b75f39d0c54de12d12c1ccbc20", - "dashboard": "40554caf09725935e2c02e02563a2d07", - "endpoint:user-artifact": "4a11183eee21e6fbad864f7a30b39ad0", - "endpoint:user-artifact-manifest": "a0d7b04ad405eed54d76e279c3727862", - "enterprise_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "epm-packages": "2b83397e3eaaaa8ef15e38813f3721c3", - "exception-list": "67f055ab8c10abd7b2ebfd969b836788", - "exception-list-agnostic": "67f055ab8c10abd7b2ebfd969b836788", - "file-upload-telemetry": "0ed4d3e1983d1217a30982630897092e", - "fleet-agent-actions": "9511b565b1cc6441a42033db3d5de8e9", - "fleet-agent-events": "e20a508b6e805189356be381dbfac8db", - "fleet-agents": "cb661e8ede2b640c42c8e5ef99db0683", - "fleet-enrollment-api-keys": "a69ef7ae661dab31561d6c6f052ef2a7", - "graph-workspace": "cd7ba1330e6682e9cc00b78850874be1", - "index-pattern": "45915a1ad866812242df474eb0479052", - "infrastructure-ui-source": "3d1b76c39bfb2cc8296b024d73854724", - "ingest-agent-policies": "8b0733cce189659593659dad8db426f0", - "ingest-outputs": "8854f34453a47e26f86a29f8f3b80b4e", - "ingest-package-policies": "f74dfe498e1849267cda41580b2be110", - "ingest_manager_settings": "02a03095f0e05b7a538fa801b88a217f", - "inventory-view": "3d1b76c39bfb2cc8296b024d73854724", - "kql-telemetry": "d12a98a6f19a2d273696597547e064ee", - "lens": "52346cfec69ff7b47d5f0c12361a2797", - "lens-ui-telemetry": "509bfa5978586998e05f9e303c07a327", - "map": "4a05b35c3a3a58fbc72dd0202dc3487f", - "maps-telemetry": "5ef305b18111b77789afefbd36b66171", - "metrics-explorer-view": "3d1b76c39bfb2cc8296b024d73854724", - "migrationVersion": "4a1746014a75ade3a714e1db5763276f", - "ml-telemetry": "257fd1d4b4fdbb9cb4b8a3b27da201e9", - "monitoring-telemetry": "2669d5ec15e82391cf58df4294ee9c68", - "namespace": "2f4316de49999235636386fe51dc06c1", - "namespaces": "2f4316de49999235636386fe51dc06c1", - "originId": "2f4316de49999235636386fe51dc06c1", - "query": "11aaeb7f5f7fa5bb43f25e18ce26e7d9", - "references": "7997cf5a56cc02bdc9c93361bde732b0", - "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", - "search": "43012c7ebc4cb57054e0a490e4b43023", - "search-telemetry": "3d1b76c39bfb2cc8296b024d73854724", - "siem-detection-engine-rule-actions": "6569b288c169539db10cb262bf79de18", - "siem-detection-engine-rule-status": "ae783f41c6937db6b7a2ef5c93a9e9b0", - "siem-ui-timeline": "d12c5474364d737d17252acf1dc4585c", - "siem-ui-timeline-note": "8874706eedc49059d4cf0f5094559084", - "siem-ui-timeline-pinned-event": "20638091112f0e14f0e443d512301c29", - "space": "c5ca8acafa0beaa4d08d014a97b6bc6b", - "telemetry": "36a616f7026dfa617d6655df850fe16d", - "timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", - "tsvb-validation-telemetry": "3a37ef6c8700ae6fc97d5c7da00e9215", - "type": "2f4316de49999235636386fe51dc06c1", - "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", - "updated_at": "00da57df13e94e9d98437d13ace4bfe0", - "upgrade-assistant-reindex-operation": "215107c281839ea9b3ad5f6419819763", - "upgrade-assistant-telemetry": "56702cec857e0a9dacfb696655b4ff7b", - "uptime-dynamic-settings": "3d1b76c39bfb2cc8296b024d73854724", - "url": "c7f66a0df8b1b52f17c28c4adb111105", - "visualization": "f819cf6636b75c9e76ba733a0c6ef355", - "workplace_search_telemetry": "3d1b76c39bfb2cc8296b024d73854724" - } - }, - "dynamic": "strict", - "properties": { - "action": { - "properties": { - "actionTypeId": { - "type": "keyword" - }, - "config": { - "enabled": false, - "type": "object" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "secrets": { - "type": "binary" - } - } - }, - "action_task_params": { - "properties": { - "actionId": { - "type": "keyword" - }, - "apiKey": { - "type": "binary" - }, - "params": { - "enabled": false, - "type": "object" - } - } - }, - "alert": { - "properties": { - "actions": { - "properties": { - "actionRef": { - "type": "keyword" - }, - "actionTypeId": { - "type": "keyword" - }, - "group": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - } - }, - "type": "nested" - }, - "alertTypeId": { - "type": "keyword" - }, - "apiKey": { - "type": "binary" - }, - "apiKeyOwner": { - "type": "keyword" - }, - "consumer": { - "type": "keyword" - }, - "createdAt": { - "type": "date" - }, - "createdBy": { - "type": "keyword" - }, - "enabled": { - "type": "boolean" - }, - "executionStatus": { - "properties": { - "error": { - "properties": { - "message": { - "type": "keyword" - }, - "reason": { - "type": "keyword" - } - } - }, - "lastExecutionDate": { - "type": "date" - }, - "status": { - "type": "keyword" - } - } - }, - "meta": { - "properties": { - "versionApiKeyLastmodified": { - "type": "keyword" - } - } - }, - "muteAll": { - "type": "boolean" - }, - "mutedInstanceIds": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "params": { - "enabled": false, - "type": "object" - }, - "schedule": { - "properties": { - "interval": { - "type": "keyword" - } - } - }, - "scheduledTaskId": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "throttle": { - "type": "keyword" - }, - "updatedBy": { - "type": "keyword" - } - } - }, - "apm-indices": { - "properties": { - "apm_oss": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } - }, - "apm-telemetry": { - "dynamic": "false", - "type": "object" - }, - "app_search_telemetry": { - "dynamic": "false", - "type": "object" - }, - "application_usage_daily": { - "dynamic": "false", - "properties": { - "timestamp": { - "type": "date" - } - } - }, - "application_usage_totals": { - "dynamic": "false", - "type": "object" - }, - "application_usage_transactional": { - "dynamic": "false", - "type": "object" - }, - "canvas-element": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "content": { - "type": "text" - }, - "help": { - "type": "text" - }, - "image": { - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "canvas-workpad": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "canvas-workpad-template": { - "dynamic": "false", - "properties": { - "help": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "tags": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - }, - "template_key": { - "type": "keyword" - } - } - }, - "cases": { - "properties": { - "closed_at": { - "type": "date" - }, - "closed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "connector": { - "properties": { - "fields": { - "properties": { - "key": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "id": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "description": { - "type": "text" - }, - "external_service": { - "properties": { - "connector_id": { - "type": "keyword" - }, - "connector_name": { - "type": "keyword" - }, - "external_id": { - "type": "keyword" - }, - "external_title": { - "type": "text" - }, - "external_url": { - "type": "text" - }, - "pushed_at": { - "type": "date" - }, - "pushed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "status": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-comments": { - "properties": { - "comment": { - "type": "text" - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "pushed_at": { - "type": "date" - }, - "pushed_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-configure": { - "properties": { - "closure_type": { - "type": "keyword" - }, - "connector": { - "properties": { - "fields": { - "properties": { - "key": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "id": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date" - }, - "created_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - } - } - }, - "cases-user-actions": { - "properties": { - "action": { - "type": "keyword" - }, - "action_at": { - "type": "date" - }, - "action_by": { - "properties": { - "email": { - "type": "keyword" - }, - "full_name": { - "type": "keyword" - }, - "username": { - "type": "keyword" - } - } - }, - "action_field": { - "type": "keyword" - }, - "new_value": { - "type": "text" - }, - "old_value": { - "type": "text" - } - } - }, - "config": { - "dynamic": "false", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "optionsJSON": { - "index": false, - "type": "text" - }, - "panelsJSON": { - "index": false, - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "pause": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "section": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "value": { - "doc_values": false, - "index": false, - "type": "integer" - } - } - }, - "timeFrom": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "timeRestore": { - "doc_values": false, - "index": false, - "type": "boolean" - }, - "timeTo": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "endpoint:user-artifact": { - "properties": { - "body": { - "type": "binary" - }, - "compressionAlgorithm": { - "index": false, - "type": "keyword" - }, - "created": { - "index": false, - "type": "date" - }, - "decodedSha256": { - "index": false, - "type": "keyword" - }, - "decodedSize": { - "index": false, - "type": "long" - }, - "encodedSha256": { - "type": "keyword" - }, - "encodedSize": { - "index": false, - "type": "long" - }, - "encryptionAlgorithm": { - "index": false, - "type": "keyword" - }, - "identifier": { - "type": "keyword" - } - } - }, - "endpoint:user-artifact-manifest": { - "properties": { - "created": { - "index": false, - "type": "date" - }, - "schemaVersion": { - "type": "keyword" - }, - "semanticVersion": { - "index": false, - "type": "keyword" - }, - "artifacts": { - "type": "nested", - "properties": { - "policyId": { - "type": "keyword", - "index": false - }, - "artifactId": { - "type": "keyword", - "index": false - } - } - } - } - }, - "enterprise_search_telemetry": { - "dynamic": "false", - "type": "object" - }, - "epm-packages": { - "properties": { - "es_index_patterns": { - "enabled": false, - "type": "object" - }, - "install_source": { - "type": "keyword" - }, - "install_started_at": { - "type": "date" - }, - "install_status": { - "type": "keyword" - }, - "install_version": { - "type": "keyword" - }, - "installed_es": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "installed_kibana": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "internal": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "removable": { - "type": "boolean" - }, - "version": { - "type": "keyword" - } - } - }, - "exception-list": { - "properties": { - "_tags": { - "type": "keyword" - }, - "comments": { - "properties": { - "comment": { - "type": "keyword" - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "updated_at": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "keyword" - }, - "entries": { - "properties": { - "entries": { - "properties": { - "field": { - "type": "keyword" - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "field": { - "type": "keyword" - }, - "list": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "immutable": { - "type": "boolean" - }, - "item_id": { - "type": "keyword" - }, - "list_id": { - "type": "keyword" - }, - "list_type": { - "type": "keyword" - }, - "meta": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "os_types": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "tie_breaker_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "exception-list-agnostic": { - "properties": { - "_tags": { - "type": "keyword" - }, - "comments": { - "properties": { - "comment": { - "type": "keyword" - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "updated_at": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "keyword" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "keyword" - }, - "entries": { - "properties": { - "entries": { - "properties": { - "field": { - "type": "keyword" - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "field": { - "type": "keyword" - }, - "list": { - "properties": { - "id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "operator": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "value": { - "fields": { - "text": { - "type": "text" - } - }, - "type": "keyword" - } - } - }, - "immutable": { - "type": "boolean" - }, - "item_id": { - "type": "keyword" - }, - "list_id": { - "type": "keyword" - }, - "list_type": { - "type": "keyword" - }, - "meta": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "os_types": { - "type": "keyword" - }, - "tags": { - "type": "keyword" - }, - "tie_breaker_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_by": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "file-upload-telemetry": { - "properties": { - "filesUploadedTotalCount": { - "type": "long" - } - } - }, - "fleet-agent-actions": { - "properties": { - "ack_data": { - "type": "text" - }, - "agent_id": { - "type": "keyword" - }, - "created_at": { - "type": "date" - }, - "data": { - "type": "binary" - }, - "policy_id": { - "type": "keyword" - }, - "policy_revision": { - "type": "integer" - }, - "sent_at": { - "type": "date" - }, - "type": { - "type": "keyword" - } - } - }, - "fleet-agent-events": { - "properties": { - "action_id": { - "type": "keyword" - }, - "agent_id": { - "type": "keyword" - }, - "data": { - "type": "text" - }, - "message": { - "type": "text" - }, - "payload": { - "type": "text" - }, - "policy_id": { - "type": "keyword" - }, - "stream_id": { - "type": "keyword" - }, - "subtype": { - "type": "keyword" - }, - "timestamp": { - "type": "date" - }, - "type": { - "type": "keyword" - } - } - }, - "fleet-agents": { - "properties": { - "access_api_key_id": { - "type": "keyword" - }, - "active": { - "type": "boolean" - }, - "current_error_events": { - "index": false, - "type": "text" - }, - "default_api_key": { - "type": "binary" - }, - "default_api_key_id": { - "type": "keyword" - }, - "enrolled_at": { - "type": "date" - }, - "last_checkin": { - "type": "date" - }, - "last_checkin_status": { - "type": "keyword" - }, - "last_updated": { - "type": "date" - }, - "local_metadata": { - "type": "flattened" - }, - "packages": { - "type": "keyword" - }, - "policy_id": { - "type": "keyword" - }, - "policy_revision": { - "type": "integer" - }, - "shared_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "unenrolled_at": { - "type": "date" - }, - "unenrollment_started_at": { - "type": "date" - }, - "updated_at": { - "type": "date" - }, - "upgrade_started_at": { - "type": "date" - }, - "upgraded_at": { - "type": "date" - }, - "user_provided_metadata": { - "type": "flattened" - }, - "version": { - "type": "keyword" - } - } - }, - "fleet-enrollment-api-keys": { - "properties": { - "active": { - "type": "boolean" - }, - "api_key": { - "type": "binary" - }, - "api_key_id": { - "type": "keyword" - }, - "created_at": { - "type": "date" - }, - "expire_at": { - "type": "date" - }, - "name": { - "type": "keyword" - }, - "policy_id": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - } - } - }, - "graph-workspace": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "numLinks": { - "type": "integer" - }, - "numVertices": { - "type": "integer" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "wsState": { - "type": "text" - } - } - }, - "index-pattern": { - "dynamic": "false", - "properties": { - "title": { - "type": "text" - }, - "type": { - "type": "keyword" - } - } - }, - "infrastructure-ui-source": { - "dynamic": "false", - "type": "object" - }, - "ingest-agent-policies": { - "properties": { - "description": { - "type": "text" - }, - "is_default": { - "type": "boolean" - }, - "monitoring_enabled": { - "index": false, - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "namespace": { - "type": "keyword" - }, - "package_policies": { - "type": "keyword" - }, - "revision": { - "type": "integer" - }, - "status": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "ingest-outputs": { - "properties": { - "ca_sha256": { - "index": false, - "type": "keyword" - }, - "config": { - "type": "flattened" - }, - "config_yaml": { - "type": "text" - }, - "fleet_enroll_password": { - "type": "binary" - }, - "fleet_enroll_username": { - "type": "binary" - }, - "hosts": { - "type": "keyword" - }, - "is_default": { - "type": "boolean" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "ingest-package-policies": { - "properties": { - "created_at": { - "type": "date" - }, - "created_by": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "enabled": { - "type": "boolean" - }, - "inputs": { - "enabled": false, - "properties": { - "config": { - "type": "flattened" - }, - "enabled": { - "type": "boolean" - }, - "streams": { - "properties": { - "compiled_stream": { - "type": "flattened" - }, - "config": { - "type": "flattened" - }, - "data_stream": { - "properties": { - "dataset": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "enabled": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "vars": { - "type": "flattened" - } - }, - "type": "nested" - }, - "type": { - "type": "keyword" - }, - "vars": { - "type": "flattened" - } - }, - "type": "nested" - }, - "name": { - "type": "keyword" - }, - "namespace": { - "type": "keyword" - }, - "output_id": { - "type": "keyword" - }, - "package": { - "properties": { - "name": { - "type": "keyword" - }, - "title": { - "type": "keyword" - }, - "version": { - "type": "keyword" - } - } - }, - "policy_id": { - "type": "keyword" - }, - "revision": { - "type": "integer" - }, - "updated_at": { - "type": "date" - }, - "updated_by": { - "type": "keyword" - } - } - }, - "ingest_manager_settings": { - "properties": { - "agent_auto_upgrade": { - "type": "keyword" - }, - "has_seen_add_data_notice": { - "index": false, - "type": "boolean" - }, - "kibana_ca_sha256": { - "type": "keyword" - }, - "kibana_urls": { - "type": "keyword" - }, - "package_auto_upgrade": { - "type": "keyword" - } - } - }, - "inventory-view": { - "dynamic": "false", - "type": "object" - }, - "kql-telemetry": { - "properties": { - "optInCount": { - "type": "long" - }, - "optOutCount": { - "type": "long" - } - } - }, - "lens": { - "properties": { - "description": { - "type": "text" - }, - "expression": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "state": { - "type": "flattened" - }, - "title": { - "type": "text" - }, - "visualizationType": { - "type": "keyword" - } - } - }, - "lens-ui-telemetry": { - "properties": { - "count": { - "type": "integer" - }, - "date": { - "type": "date" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - } - }, - "map": { - "properties": { - "description": { - "type": "text" - }, - "layerListJSON": { - "type": "text" - }, - "mapStateJSON": { - "type": "text" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "maps-telemetry": { - "enabled": false, - "type": "object" - }, - "metrics-explorer-view": { - "dynamic": "false", - "type": "object" - }, - "migrationVersion": { - "dynamic": "true", - "properties": { - "canvas-workpad": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "config": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "space": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "ml-telemetry": { - "properties": { - "file_data_visualizer": { - "properties": { - "index_creation_count": { - "type": "long" - } - } - } - } - }, - "monitoring-telemetry": { - "properties": { - "reportedClusterUuids": { - "type": "keyword" - } - } - }, - "namespace": { - "type": "keyword" - }, - "namespaces": { - "type": "keyword" - }, - "originId": { - "type": "keyword" - }, - "query": { - "properties": { - "description": { - "type": "text" - }, - "filters": { - "enabled": false, - "type": "object" - }, - "query": { - "properties": { - "language": { - "type": "keyword" - }, - "query": { - "index": false, - "type": "keyword" - } - } - }, - "timefilter": { - "enabled": false, - "type": "object" - }, - "title": { - "type": "text" - } - } - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "sample-data-telemetry": { - "properties": { - "installCount": { - "type": "long" - }, - "unInstallCount": { - "type": "long" - } - } - }, - "search": { - "properties": { - "columns": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "doc_values": false, - "index": false, - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "sort": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "search-telemetry": { - "dynamic": "false", - "type": "object" - }, - "siem-detection-engine-rule-actions": { - "properties": { - "actions": { - "properties": { - "action_type_id": { - "type": "keyword" - }, - "group": { - "type": "keyword" - }, - "id": { - "type": "keyword" - }, - "params": { - "enabled": false, - "type": "object" - } - } - }, - "alertThrottle": { - "type": "keyword" - }, - "ruleAlertId": { - "type": "keyword" - }, - "ruleThrottle": { - "type": "keyword" - } - } - }, - "siem-detection-engine-rule-status": { - "properties": { - "alertId": { - "type": "keyword" - }, - "bulkCreateTimeDurations": { - "type": "float" - }, - "gap": { - "type": "text" - }, - "lastFailureAt": { - "type": "date" - }, - "lastFailureMessage": { - "type": "text" - }, - "lastLookBackDate": { - "type": "date" - }, - "lastSuccessAt": { - "type": "date" - }, - "lastSuccessMessage": { - "type": "text" - }, - "searchAfterTimeDurations": { - "type": "float" - }, - "status": { - "type": "keyword" - }, - "statusDate": { - "type": "date" - } - } - }, - "siem-ui-timeline": { - "properties": { - "columns": { - "properties": { - "aggregatable": { - "type": "boolean" - }, - "category": { - "type": "keyword" - }, - "columnHeaderType": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "example": { - "type": "text" - }, - "id": { - "type": "keyword" - }, - "indexes": { - "type": "keyword" - }, - "name": { - "type": "text" - }, - "placeholder": { - "type": "text" - }, - "searchable": { - "type": "boolean" - }, - "type": { - "type": "keyword" - } - } - }, - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "dataProviders": { - "properties": { - "and": { - "properties": { - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "type": { - "type": "text" - } - } - }, - "enabled": { - "type": "boolean" - }, - "excluded": { - "type": "boolean" - }, - "id": { - "type": "keyword" - }, - "kqlQuery": { - "type": "text" - }, - "name": { - "type": "text" - }, - "queryMatch": { - "properties": { - "displayField": { - "type": "text" - }, - "displayValue": { - "type": "text" - }, - "field": { - "type": "text" - }, - "operator": { - "type": "text" - }, - "value": { - "type": "text" - } - } - }, - "type": { - "type": "text" - } - } - }, - "dateRange": { - "properties": { - "end": { - "type": "date" - }, - "start": { - "type": "date" - } - } - }, - "description": { - "type": "text" - }, - "eventType": { - "type": "keyword" - }, - "excludedRowRendererIds": { - "type": "text" - }, - "favorite": { - "properties": { - "favoriteDate": { - "type": "date" - }, - "fullName": { - "type": "text" - }, - "keySearch": { - "type": "text" - }, - "userName": { - "type": "text" - } - } - }, - "filters": { - "properties": { - "exists": { - "type": "text" - }, - "match_all": { - "type": "text" - }, - "meta": { - "properties": { - "alias": { - "type": "text" - }, - "controlledBy": { - "type": "text" - }, - "disabled": { - "type": "boolean" - }, - "field": { - "type": "text" - }, - "formattedValue": { - "type": "text" - }, - "index": { - "type": "keyword" - }, - "key": { - "type": "keyword" - }, - "negate": { - "type": "boolean" - }, - "params": { - "type": "text" - }, - "type": { - "type": "keyword" - }, - "value": { - "type": "text" - } - } - }, - "missing": { - "type": "text" - }, - "query": { - "type": "text" - }, - "range": { - "type": "text" - }, - "script": { - "type": "text" - } - } - }, - "indexNames": { - "type": "text" - }, - "kqlMode": { - "type": "keyword" - }, - "kqlQuery": { - "properties": { - "filterQuery": { - "properties": { - "kuery": { - "properties": { - "expression": { - "type": "text" - }, - "kind": { - "type": "keyword" - } - } - }, - "serializedQuery": { - "type": "text" - } - } - } - } - }, - "savedQueryId": { - "type": "keyword" - }, - "sort": { - "properties": { - "columnId": { - "type": "keyword" - }, - "sortDirection": { - "type": "keyword" - } - } - }, - "status": { - "type": "keyword" - }, - "templateTimelineId": { - "type": "text" - }, - "templateTimelineVersion": { - "type": "integer" - }, - "timelineType": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-note": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "note": { - "type": "text" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "siem-ui-timeline-pinned-event": { - "properties": { - "created": { - "type": "date" - }, - "createdBy": { - "type": "text" - }, - "eventId": { - "type": "keyword" - }, - "timelineId": { - "type": "keyword" - }, - "updated": { - "type": "date" - }, - "updatedBy": { - "type": "text" - } - } - }, - "space": { - "properties": { - "_reserved": { - "type": "boolean" - }, - "color": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "disabledFeatures": { - "type": "keyword" - }, - "imageUrl": { - "index": false, - "type": "text" - }, - "initials": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "telemetry": { - "properties": { - "allowChangingOptInStatus": { - "type": "boolean" - }, - "enabled": { - "type": "boolean" - }, - "lastReported": { - "type": "date" - }, - "lastVersionChecked": { - "type": "keyword" - }, - "reportFailureCount": { - "type": "integer" - }, - "reportFailureVersion": { - "type": "keyword" - }, - "sendUsageFrom": { - "type": "keyword" - }, - "userHasSeenNotice": { - "type": "boolean" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "tsvb-validation-telemetry": { - "properties": { - "failedRequests": { - "type": "long" - } - } - }, - "type": { - "type": "keyword" - }, - "ui-metric": { - "properties": { - "count": { - "type": "integer" - } - } - }, - "updated_at": { - "type": "date" - }, - "upgrade-assistant-reindex-operation": { - "properties": { - "errorMessage": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "indexName": { - "type": "keyword" - }, - "lastCompletedStep": { - "type": "long" - }, - "locked": { - "type": "date" - }, - "newIndexName": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "reindexOptions": { - "properties": { - "openAndClose": { - "type": "boolean" - }, - "queueSettings": { - "properties": { - "queuedAt": { - "type": "long" - }, - "startedAt": { - "type": "long" - } - } - } - } - }, - "reindexTaskId": { - "fields": { - "keyword": { - "ignore_above": 256, - "type": "keyword" - } - }, - "type": "text" - }, - "reindexTaskPercComplete": { - "type": "float" - }, - "runningReindexCount": { - "type": "integer" - }, - "status": { - "type": "integer" - } - } - }, - "upgrade-assistant-telemetry": { - "properties": { - "features": { - "properties": { - "deprecation_logging": { - "properties": { - "enabled": { - "null_value": true, - "type": "boolean" - } - } - } - } - }, - "ui_open": { - "properties": { - "cluster": { - "null_value": 0, - "type": "long" - }, - "indices": { - "null_value": 0, - "type": "long" - }, - "overview": { - "null_value": 0, - "type": "long" - } - } - }, - "ui_reindex": { - "properties": { - "close": { - "null_value": 0, - "type": "long" - }, - "open": { - "null_value": 0, - "type": "long" - }, - "start": { - "null_value": 0, - "type": "long" - }, - "stop": { - "null_value": 0, - "type": "long" - } - } - } - } - }, - "uptime-dynamic-settings": { - "dynamic": "false", - "type": "object" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "index": false, - "type": "text" - } - } - }, - "savedSearchRefName": { - "doc_values": false, - "index": false, - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "index": false, - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "index": false, - "type": "text" - } - } - }, - "workplace_search_telemetry": { - "dynamic": "false", - "type": "object" - } - } - }, - "settings": { - "index": { - "auto_expand_replicas": "0-1", - "number_of_replicas": "0", - "number_of_shards": "1" - } - } - } -} diff --git a/x-pack/test/functional/es_archives/canvas/lens/data.json b/x-pack/test/functional/es_archives/canvas/lens/data.json deleted file mode 100644 index dca7d31d71082..0000000000000 --- a/x-pack/test/functional/es_archives/canvas/lens/data.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "type": "doc", - "value": { - "id": "space:default", - "index": ".kibana_1", - "source": { - "space": { - "_reserved": true, - "color": "#00bfb3", - "description": "This is your default space!", - "name": "Default" - }, - "type": "space", - "updated_at": "2018-11-06T18:20:26.703Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "canvas-workpad:workpad-1705f884-6224-47de-ba49-ca224fe6ec31", - "index": ".kibana_1", - "source": { - "canvas-workpad": { - "@created": "2018-11-19T19:17:12.646Z", - "@timestamp": "2018-11-19T19:36:28.499Z", - "assets": { - }, - "colors": [ - "#37988d", - "#c19628", - "#b83c6f", - "#3f9939", - "#1785b0", - "#ca5f35", - "#45bdb0", - "#f2bc33", - "#e74b8b", - "#4fbf48", - "#1ea6dc", - "#fd7643", - "#72cec3", - "#f5cc5d", - "#ec77a8", - "#7acf74", - "#4cbce4", - "#fd986f", - "#a1ded7", - "#f8dd91", - "#f2a4c5", - "#a6dfa2", - "#86d2ed", - "#fdba9f", - "#000000", - "#444444", - "#777777", - "#BBBBBB", - "#FFFFFF", - "rgba(255,255,255,0)" - ], - "height": 920, - "id": "workpad-1705f884-6224-47de-ba49-ca224fe6ec31", - "isWriteable": true, - "name": "Test Workpad", - "page": 0, - "pages": [ - { - "elements": [ - { - "expression": "savedLens id=\"my-lens-vis\" timerange={timerange from=\"2014-01-01\" to=\"2018-01-01\"}", - "id": "element-8f64a10a-01f3-4a71-a682-5b627cbe4d0e", - "position": { - "angle": 0, - "height": 238, - "left": 33.5, - "top": 20, - "width": 338 - } - } - ], - "id": "page-c38cd459-10fe-45f9-847b-2cbd7ec74319", - "style": { - "background": "#fff" - }, - "transition": { - } - } - ], - "width": 840 - }, - "type": "canvas-workpad", - "updated_at": "2018-11-19T19:36:28.511Z" - } - } -} - -{ - "type": "doc", - "value": { - "id": "lens:my-lens-vis", - "index": ".kibana_1", - "source": { - "lens": { - "expression": "", - "state": { - "datasourceMetaData": { - "filterableIndexPatterns": [ - { - "id": "logstash-lens", - "title": "logstash-lens" - } - ] - }, - "datasourceStates": { - "indexpattern": { - "currentIndexPatternId": "logstash-lens", - "layers": { - "c61a8afb-a185-4fae-a064-fb3846f6c451": { - "columnOrder": [ - "2cd09808-3915-49f4-b3b0-82767eba23f7" - ], - "columns": { - "2cd09808-3915-49f4-b3b0-82767eba23f7": { - "dataType": "number", - "isBucketed": false, - "label": "Maximum of bytes", - "operationType": "max", - "scale": "ratio", - "sourceField": "bytes" - } - }, - "indexPatternId": "logstash-lens" - } - } - } - }, - "filters": [], - "query": { - "language": "kuery", - "query": "" - }, - "visualization": { - "accessor": "2cd09808-3915-49f4-b3b0-82767eba23f7", - "layerId": "c61a8afb-a185-4fae-a064-fb3846f6c451" - } - }, - "title": "Artistpreviouslyknownaslens", - "visualizationType": "lnsMetric" - }, - "references": [], - "type": "lens", - "updated_at": "2019-10-16T00:28:08.979Z" - } - } -} - -{ - "type": "doc", - "value": { - "index": "logstash-lens", - "id": "1", - "source": { - "@timestamp": "2015-09-20T02:00:00.000Z", - "bytes": 16788 - } - } -} - -{ - "type": "doc", - "value": { - "id": "index-pattern:logstash-lens", - "index": ".kibana_1", - "source": { - "index-pattern" : { - "title" : "logstash-lens", - "timeFieldName" : "@timestamp", - "fields" : "[]" - }, - "type" : "index-pattern", - "references" : [ ], - "migrationVersion" : { - "index-pattern" : "7.6.0" - }, - "updated_at" : "2020-08-19T08:39:09.998Z" - }, - "type": "_doc" - } -} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/canvas/lens/mappings.json b/x-pack/test/functional/es_archives/canvas/lens/mappings.json deleted file mode 100644 index 811bfaaae0d2c..0000000000000 --- a/x-pack/test/functional/es_archives/canvas/lens/mappings.json +++ /dev/null @@ -1,409 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": { - } - }, - "index": ".kibana_1", - "mappings": { - "dynamic": "strict", - "properties": { - "canvas-workpad": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "id": { - "index": false, - "type": "text" - }, - "name": { - "fields": { - "keyword": { - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "buildNum": { - "type": "keyword" - } - } - }, - "references": { - "properties": { - "id": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - } - }, - "type": "nested" - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "graph-workspace": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "numLinks": { - "type": "integer" - }, - "numVertices": { - "type": "integer" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "wsState": { - "type": "text" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "type": { - "type": "keyword" - }, - "typeMeta": { - "type": "keyword" - } - } - }, - "lens": { - "properties": { - "expression": { - "index": false, - "type": "keyword" - }, - "state": { - "type": "flattened" - }, - "title": { - "type": "text" - }, - "visualizationType": { - "type": "keyword" - } - } - }, - "kql-telemetry": { - "properties": { - "optInCount": { - "type": "long" - }, - "optOutCount": { - "type": "long" - } - } - }, - "migrationVersion": { - "dynamic": "true", - "type": "object" - }, - "namespace": { - "type": "keyword" - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "space": { - "properties": { - "_reserved": { - "type": "boolean" - }, - "color": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "initials": { - "type": "keyword" - }, - "disabledFeatures": { - "type": "keyword" - }, - "name": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "telemetry": { - "properties": { - "enabled": { - "type": "boolean" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "fields": { - "keyword": { - "ignore_above": 2048, - "type": "keyword" - } - }, - "type": "text" - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - } - } - }, - "settings": { - "index": { - "number_of_replicas": "1", - "number_of_shards": "1" - } - } - } -} - -{ - "type": "index", - "value": { - "index": "logstash-lens", - "mappings": { - "properties": { - "@timestamp": { - "type": "date" - }, - "bytes": { - "type": "float" - } - } - }, - "settings": { - "index": { - "number_of_shards": "1", - "number_of_replicas": "0" - } - } - } -} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/canvas/logstash_lens/data.json b/x-pack/test/functional/es_archives/canvas/logstash_lens/data.json new file mode 100644 index 0000000000000..13330ce1c9ec4 --- /dev/null +++ b/x-pack/test/functional/es_archives/canvas/logstash_lens/data.json @@ -0,0 +1,11 @@ +{ + "type": "doc", + "value": { + "id": "1", + "index": "logstash-lens", + "source": { + "@timestamp": "2015-09-20T02:00:00.000Z", + "bytes": 16788 + } + } +} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/canvas/logstash_lens/mappings.json b/x-pack/test/functional/es_archives/canvas/logstash_lens/mappings.json new file mode 100644 index 0000000000000..bdc22d3bcdbda --- /dev/null +++ b/x-pack/test/functional/es_archives/canvas/logstash_lens/mappings.json @@ -0,0 +1,24 @@ +{ + "type": "index", + "value": { + "aliases": { + }, + "index": "logstash-lens", + "mappings": { + "properties": { + "@timestamp": { + "type": "date" + }, + "bytes": { + "type": "float" + } + } + }, + "settings": { + "index": { + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } +} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/discover/feature_controls/security/data.json b/x-pack/test/functional/es_archives/discover/feature_controls/security/data.json deleted file mode 100644 index 03859300b5999..0000000000000 --- a/x-pack/test/functional/es_archives/discover/feature_controls/security/data.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "type": "doc", - "value": { - "index": ".kibana", - "type": "doc", - "id": "index-pattern:logstash-*", - "source": { - "index-pattern": { - "title": "logstash-*", - "timeFieldName": "@timestamp", - "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]" - }, - "type": "index-pattern", - "migrationVersion": { - "index-pattern": "6.5.0" - }, - "updated_at": "2018-12-21T00:43:07.096Z" - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "type": "doc", - "id": "config:6.0.0", - "source": { - "config": { - "buildNum": 9007199254740991, - "defaultIndex": "logstash-*" - }, - "type": "config", - "updated_at": "2019-01-22T19:32:02.235Z" - } - } -} - -{ - "type": "doc", - "value": { - "index": ".kibana", - "type": "doc", - "id": "query:OKJpgs", - "source": { - "query": { - "title": "OKJpgs", - "description": "Ok responses for jpg files", - "query": { - "query": "response:200", - "language": "kuery" - }, - "filters": [{"meta":{"index":"b15b1d40-a8bb-11e9-98cf-2bb06ef63e0b","alias":null,"negate":false,"type":"phrase","key":"extension.raw","value":"jpg","params":{"query":"jpg"},"disabled":false},"query":{"match":{"extension.raw":{"query":"jpg","type":"phrase"}}},"$state":{"store":"appState"}}] - }, - "type": "query", - "updated_at": "2019-07-17T17:54:26.378Z" - } - } -} diff --git a/x-pack/test/functional/es_archives/discover/feature_controls/security/mappings.json b/x-pack/test/functional/es_archives/discover/feature_controls/security/mappings.json deleted file mode 100644 index 69fceb7c9d209..0000000000000 --- a/x-pack/test/functional/es_archives/discover/feature_controls/security/mappings.json +++ /dev/null @@ -1,491 +0,0 @@ -{ - "type": "index", - "value": { - "aliases": { - ".kibana": {} - }, - "index": ".kibana_1", - "settings": { - "index": { - "number_of_shards": "1", - "auto_expand_replicas": "0-1", - "number_of_replicas": "0" - } - }, - "mappings": { - "dynamic": "strict", - "properties": { - "apm-telemetry": { - "properties": { - "has_any_services": { - "type": "boolean" - }, - "services_per_agent": { - "properties": { - "go": { - "type": "long", - "null_value": 0 - }, - "java": { - "type": "long", - "null_value": 0 - }, - "js-base": { - "type": "long", - "null_value": 0 - }, - "nodejs": { - "type": "long", - "null_value": 0 - }, - "python": { - "type": "long", - "null_value": 0 - }, - "ruby": { - "type": "long", - "null_value": 0 - } - } - } - } - }, - "canvas-workpad": { - "dynamic": "false", - "properties": { - "@created": { - "type": "date" - }, - "@timestamp": { - "type": "date" - }, - "id": { - "type": "text", - "index": false - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword" - } - } - } - } - }, - "config": { - "dynamic": "true", - "properties": { - "accessibility:disableAnimations": { - "type": "boolean" - }, - "buildNum": { - "type": "keyword" - }, - "dateFormat:tz": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "defaultIndex": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "telemetry:optIn": { - "type": "boolean" - } - } - }, - "dashboard": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "optionsJSON": { - "type": "text" - }, - "panelsJSON": { - "type": "text" - }, - "refreshInterval": { - "properties": { - "display": { - "type": "keyword" - }, - "pause": { - "type": "boolean" - }, - "section": { - "type": "integer" - }, - "value": { - "type": "integer" - } - } - }, - "timeFrom": { - "type": "keyword" - }, - "timeRestore": { - "type": "boolean" - }, - "timeTo": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "gis-map" : { - "properties" : { - "bounds": { - "dynamic": false, - "properties": {} - }, - "description" : { - "type" : "text" - }, - "layerListJSON" : { - "type" : "text" - }, - "mapStateJSON" : { - "type" : "text" - }, - "title" : { - "type" : "text" - }, - "uiStateJSON" : { - "type" : "text" - }, - "version" : { - "type" : "integer" - } - } - }, - "graph-workspace": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "numLinks": { - "type": "integer" - }, - "numVertices": { - "type": "integer" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "wsState": { - "type": "text" - } - } - }, - "index-pattern": { - "properties": { - "fieldFormatMap": { - "type": "text" - }, - "fields": { - "type": "text" - }, - "intervalName": { - "type": "keyword" - }, - "notExpandable": { - "type": "boolean" - }, - "sourceFilters": { - "type": "text" - }, - "timeFieldName": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "type": { - "type": "keyword" - }, - "typeMeta": { - "type": "keyword" - } - } - }, - "kql-telemetry": { - "properties": { - "optInCount": { - "type": "long" - }, - "optOutCount": { - "type": "long" - } - } - }, - "migrationVersion": { - "dynamic": "true", - "properties": { - "index-pattern": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "space": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "namespace": { - "type": "keyword" - }, - "search": { - "properties": { - "columns": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "sort": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "server": { - "properties": { - "uuid": { - "type": "keyword" - } - } - }, - "space": { - "properties": { - "_reserved": { - "type": "boolean" - }, - "color": { - "type": "keyword" - }, - "description": { - "type": "text" - }, - "disabledFeatures": { - "type": "keyword" - }, - "initials": { - "type": "keyword" - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "spaceId": { - "type": "keyword" - }, - "telemetry": { - "properties": { - "enabled": { - "type": "boolean" - } - } - }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, - "type": { - "type": "keyword" - }, - "updated_at": { - "type": "date" - }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, - "visualization": { - "properties": { - "description": { - "type": "text" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "savedSearchId": { - "type": "keyword" - }, - "title": { - "type": "text" - }, - "uiStateJSON": { - "type": "text" - }, - "version": { - "type": "integer" - }, - "visState": { - "type": "text" - } - } - }, - "query": { - "properties": { - "title": { - "type": "text" - }, - "description": { - "type": "text" - }, - "query": { - "properties": { - "language": { - "type": "keyword" - }, - "query": { - "type": "keyword", - "index": false - } - } - }, - "filters": { - "type": "object", - "enabled": false - }, - "timefilter": { - "type": "object", - "enabled": false - } - } - } - } - } - } -} diff --git a/x-pack/test/functional/fixtures/kbn_archiver/canvas/default.json b/x-pack/test/functional/fixtures/kbn_archiver/canvas/default.json new file mode 100644 index 0000000000000..7dfe1bd395640 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/canvas/default.json @@ -0,0 +1,108 @@ +{ + "attributes": { + "@created": "2018-11-19T19:17:12.646Z", + "@timestamp": "2018-11-19T19:36:28.499Z", + "assets": {}, + "colors": [ + "#37988d", + "#c19628", + "#b83c6f", + "#3f9939", + "#1785b0", + "#ca5f35", + "#45bdb0", + "#f2bc33", + "#e74b8b", + "#4fbf48", + "#1ea6dc", + "#fd7643", + "#72cec3", + "#f5cc5d", + "#ec77a8", + "#7acf74", + "#4cbce4", + "#fd986f", + "#a1ded7", + "#f8dd91", + "#f2a4c5", + "#a6dfa2", + "#86d2ed", + "#fdba9f", + "#000000", + "#444444", + "#777777", + "#BBBBBB", + "#FFFFFF", + "rgba(255,255,255,0)" + ], + "height": 920, + "isWriteable": true, + "name": "Test Workpad", + "page": 0, + "pages": [ + { + "elements": [ + { + "expression": "markdown \n \"### Welcome to Canvas\n\nEnjoy your stay!\n\n- Green: Markdown, Browser function\n- Blue: SQL, Server function\n- Pink: CSV, Common function\n- Orange: Timelion, Server function\"\n| render \n containerStyle={containerStyle padding=\"8px\" opacity=\"1\" backgroundColor=\"#7acf74\"}", + "id": "element-8f64a10a-01f3-4a71-a682-5b627cbe4d0e", + "position": { + "angle": 0, + "height": 238, + "left": 33.5, + "top": 20, + "width": 338 + } + }, + { + "expression": "filters\n| essql query=\"SELECT extension,bytes FROM \\\"logstash*\\\" LIMIT 10\"\n| table\n| render \n containerStyle={containerStyle padding=\"4px\" opacity=\"0.7\" backgroundColor=\"#4cbce4\"}", + "id": "element-d3bf91e2-7e8c-4884-942e-d4e9006aef09", + "position": { + "angle": 0, + "height": 345, + "left": 439, + "top": 20, + "width": 367 + } + }, + { + "expression": "csv \"desc,price\nred fish,100\nblue fish,200\"\n| render \n containerStyle={containerStyle backgroundColor=\"#ec77a8\" padding=\"4px\" opacity=\"0.7\"}", + "id": "element-223fe2b3-ffb4-4070-ae61-3e06b8052abb", + "position": { + "angle": 0, + "height": 132, + "left": 25, + "top": 390, + "width": 207 + } + }, + { + "expression": "filters\n| timelion query=\".es(index=logstash*,q=extension:jpg)\" interval=\"1M\" from=\"2017-01-01\" to=\"2017-12-31\"\n| table perPage=200\n| render containerStyle={containerStyle backgroundColor=\"#fd986f\" opacity=\"0.7\"}", + "id": "element-3c905696-8258-4e9c-ab58-89018681f79f", + "position": { + "angle": 0, + "height": 397, + "left": 263.5, + "top": 390, + "width": 533 + } + } + ], + "id": "page-c38cd459-10fe-45f9-847b-2cbd7ec74319", + "style": { + "background": "#fff" + }, + "transition": {} + } + ], + "width": 840 + }, + "coreMigrationVersion": "7.15.0", + "id": "workpad-1705f884-6224-47de-ba49-ca224fe6ec31", + "migrationVersion": { + "canvas-workpad": "7.0.0" + }, + "references": [], + "type": "canvas-workpad", + "updated_at": "2018-11-19T19:36:28.511Z", + "version": "WzUsMl0=" +} \ No newline at end of file diff --git a/x-pack/test/functional/fixtures/kbn_archiver/canvas/filter.json b/x-pack/test/functional/fixtures/kbn_archiver/canvas/filter.json new file mode 100644 index 0000000000000..4934af13b2648 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/canvas/filter.json @@ -0,0 +1,105 @@ +{ + "attributes": { + "@created": "2020-10-28T17:58:54.801Z", + "@timestamp": "2020-10-28T17:59:56.747Z", + "assets": {}, + "colors": [ + "#37988d", + "#c19628", + "#b83c6f", + "#3f9939", + "#1785b0", + "#ca5f35", + "#45bdb0", + "#f2bc33", + "#e74b8b", + "#4fbf48", + "#1ea6dc", + "#fd7643", + "#72cec3", + "#f5cc5d", + "#ec77a8", + "#7acf74", + "#4cbce4", + "#fd986f", + "#a1ded7", + "#f8dd91", + "#f2a4c5", + "#a6dfa2", + "#86d2ed", + "#fdba9f", + "#000000", + "#444444", + "#777777", + "#BBBBBB", + "#FFFFFF", + "rgba(255,255,255,0)" + ], + "css": ".canvasPage {\n\n}", + "height": 720, + "isWriteable": true, + "name": "Filter Debug Workpad", + "page": 0, + "pages": [ + { + "elements": [ + { + "expression": "timefilterControl compact=true column=@timestamp\n| render", + "filter": "timefilter from=\"2020-10-18T17:59:51.260Z\" to=2020-10-24T17:59:54.412Z column=@timestamp", + "id": "element-1a9e6a1e-3231-4752-acdd-20fff6afd9ee", + "position": { + "angle": 0, + "height": 50, + "left": 20, + "parent": null, + "top": 20, + "width": 500 + } + }, + { + "expression": "filters\n| render as=debug", + "id": "element-d5687399-fd3e-4923-9280-ba1e8af578d1", + "position": { + "angle": 0, + "height": 526, + "left": 559, + "parent": null, + "top": 21, + "width": 500 + } + }, + { + "expression": "demodata\n| dropdownControl valueColumn=project filterColumn=project | render", + "filter": "exactly value=\"apm\" column=\"project\"", + "id": "element-61165541-a4cb-4638-b911-cf7eacc31c44", + "position": { + "angle": 0, + "height": 50, + "left": 20, + "parent": null, + "top": 128, + "width": 500 + } + } + ], + "groups": [], + "id": "page-2276b5d0-9b3d-4a95-9e57-ea6c040c447d", + "style": { + "background": "#FFF" + }, + "transition": {} + } + ], + "variables": [], + "width": 1080 + }, + "coreMigrationVersion": "7.15.0", + "id": "workpad-b5618217-56d2-47fa-b756-1be2306cda68", + "migrationVersion": { + "canvas-workpad": "7.0.0" + }, + "references": [], + "type": "canvas-workpad", + "updated_at": "2020-10-28T17:59:56.753Z", + "version": "WzEsMl0=" +} \ No newline at end of file diff --git a/x-pack/test/functional/fixtures/kbn_archiver/canvas/lens.json b/x-pack/test/functional/fixtures/kbn_archiver/canvas/lens.json new file mode 100644 index 0000000000000..d615438ba9d66 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/canvas/lens.json @@ -0,0 +1,151 @@ +{ + "attributes": { + "fields": "[]", + "timeFieldName": "@timestamp", + "title": "logstash-lens" + }, + "coreMigrationVersion": "7.15.0", + "id": "logstash-lens", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2020-08-19T08:39:09.998Z", + "version": "WzcsMl0=" +} + +{ + "attributes": { + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "c61a8afb-a185-4fae-a064-fb3846f6c451": { + "columnOrder": [ + "2cd09808-3915-49f4-b3b0-82767eba23f7" + ], + "columns": { + "2cd09808-3915-49f4-b3b0-82767eba23f7": { + "dataType": "number", + "isBucketed": false, + "label": "Maximum of bytes", + "operationType": "max", + "scale": "ratio", + "sourceField": "bytes" + } + } + } + } + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "accessor": "2cd09808-3915-49f4-b3b0-82767eba23f7", + "layerId": "c61a8afb-a185-4fae-a064-fb3846f6c451" + } + }, + "title": "Artistpreviouslyknownaslens", + "visualizationType": "lnsMetric" + }, + "coreMigrationVersion": "7.15.0", + "id": "my-lens-vis", + "migrationVersion": { + "lens": "7.14.0" + }, + "references": [ + { + "id": "logstash-lens", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern" + }, + { + "id": "logstash-lens", + "name": "indexpattern-datasource-layer-c61a8afb-a185-4fae-a064-fb3846f6c451", + "type": "index-pattern" + } + ], + "type": "lens", + "updated_at": "2019-10-16T00:28:08.979Z", + "version": "WzYsMl0=" +} + +{ + "attributes": { + "@created": "2018-11-19T19:17:12.646Z", + "@timestamp": "2018-11-19T19:36:28.499Z", + "assets": {}, + "colors": [ + "#37988d", + "#c19628", + "#b83c6f", + "#3f9939", + "#1785b0", + "#ca5f35", + "#45bdb0", + "#f2bc33", + "#e74b8b", + "#4fbf48", + "#1ea6dc", + "#fd7643", + "#72cec3", + "#f5cc5d", + "#ec77a8", + "#7acf74", + "#4cbce4", + "#fd986f", + "#a1ded7", + "#f8dd91", + "#f2a4c5", + "#a6dfa2", + "#86d2ed", + "#fdba9f", + "#000000", + "#444444", + "#777777", + "#BBBBBB", + "#FFFFFF", + "rgba(255,255,255,0)" + ], + "height": 920, + "isWriteable": true, + "name": "Test Workpad", + "page": 0, + "pages": [ + { + "elements": [ + { + "expression": "savedLens id=\"my-lens-vis\" timerange={timerange from=\"2014-01-01\" to=\"2018-01-01\"}", + "id": "element-8f64a10a-01f3-4a71-a682-5b627cbe4d0e", + "position": { + "angle": 0, + "height": 238, + "left": 33.5, + "top": 20, + "width": 338 + } + } + ], + "id": "page-c38cd459-10fe-45f9-847b-2cbd7ec74319", + "style": { + "background": "#fff" + }, + "transition": {} + } + ], + "width": 840 + }, + "coreMigrationVersion": "7.15.0", + "id": "workpad-1705f884-6224-47de-ba49-ca224fe6ec31", + "migrationVersion": { + "canvas-workpad": "7.0.0" + }, + "references": [], + "type": "canvas-workpad", + "updated_at": "2018-11-19T19:36:28.511Z", + "version": "WzUsMl0=" +} \ No newline at end of file diff --git a/x-pack/test/functional/fixtures/kbn_archiver/canvas/reports.json b/x-pack/test/functional/fixtures/kbn_archiver/canvas/reports.json new file mode 100644 index 0000000000000..c30e95ec5c719 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/canvas/reports.json @@ -0,0 +1,79 @@ +{ + "attributes": { + "@created": "2020-10-21T23:50:26.466Z", + "@timestamp": "2020-10-22T23:44:48.387Z", + "assets": {}, + "colors": [ + "#37988d", + "#c19628", + "#b83c6f", + "#3f9939", + "#1785b0", + "#ca5f35", + "#45bdb0", + "#f2bc33", + "#e74b8b", + "#4fbf48", + "#1ea6dc", + "#fd7643", + "#72cec3", + "#f5cc5d", + "#ec77a8", + "#7acf74", + "#4cbce4", + "#fd986f", + "#a1ded7", + "#f8dd91", + "#f2a4c5", + "#a6dfa2", + "#86d2ed", + "#fdba9f", + "#000000", + "#444444", + "#777777", + "#BBBBBB", + "#FFFFFF", + "rgba(255,255,255,0)" + ], + "css": ".canvasPage {\n\n}", + "height": 8, + "isWriteable": true, + "name": "The Very Cool Workpad for PDF Tests", + "page": 0, + "pages": [ + { + "elements": [ + { + "expression": "shape \"square\" fill=\"#4cbce4\" border=\"rgba(255,255,255,0)\" borderWidth=0 maintainAspect=false | render", + "id": "element-e05237c6-0fda-49e7-84fc-b8573739b515", + "position": { + "angle": 0, + "height": 18, + "left": -1, + "parent": null, + "top": -1, + "width": 15.5 + } + } + ], + "groups": [], + "id": "page-c0e601aa-1c72-4d4a-b73f-8fb72a9d8d3a", + "style": { + "background": "#FFF" + }, + "transition": {} + } + ], + "variables": [], + "width": 8 + }, + "coreMigrationVersion": "7.15.0", + "id": "workpad-c13808dc-e690-4bab-be06-2073ba071754", + "migrationVersion": { + "canvas-workpad": "7.0.0" + }, + "references": [], + "type": "canvas-workpad", + "updated_at": "2020-10-22T23:44:48.392Z", + "version": "WzgsMl0=" +} \ No newline at end of file diff --git a/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/security.json b/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/security.json new file mode 100644 index 0000000000000..a94480a17ec28 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/discover/feature_controls/security.json @@ -0,0 +1,91 @@ +{ + "attributes": { + "buildNum": 9007199254740991, + "defaultIndex": "logstash-*" + }, + "coreMigrationVersion": "7.15.0", + "id": "6.0.0", + "migrationVersion": { + "config": "7.13.0" + }, + "references": [], + "type": "config", + "updated_at": "2019-01-22T19:32:02.235Z", + "version": "WzQsMl0=" +} + +{ + "attributes": { + "buildNum": 9007199254740991, + "defaultIndex": "logstash-*" + }, + "coreMigrationVersion": "7.15.0", + "id": "7.15.0", + "migrationVersion": { + "config": "7.13.0" + }, + "references": [], + "type": "config", + "updated_at": "2021-07-29T12:29:34.863Z", + "version": "WzcsMl0=" +} + +{ + "attributes": { + "description": "Ok responses for jpg files", + "filters": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "index": "b15b1d40-a8bb-11e9-98cf-2bb06ef63e0b", + "key": "extension.raw", + "negate": false, + "params": { + "query": "jpg" + }, + "type": "phrase", + "value": "jpg" + }, + "query": { + "match": { + "extension.raw": { + "query": "jpg", + "type": "phrase" + } + } + } + } + ], + "query": { + "language": "kuery", + "query": "response:200" + }, + "title": "OKJpgs" + }, + "coreMigrationVersion": "7.15.0", + "id": "OKJpgs", + "references": [], + "type": "query", + "updated_at": "2019-07-17T17:54:26.378Z", + "version": "WzUsMl0=" +} + +{ + "attributes": { + "timeFieldName": "@timestamp", + "title": "logstash-*" + }, + "coreMigrationVersion": "7.15.0", + "id": "logstash-*", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2018-12-21T00:43:07.096Z", + "version": "WzMsMl0=" +} diff --git a/x-pack/test/functional/fixtures/kbn_archiver/spaces/disabled_features.json b/x-pack/test/functional/fixtures/kbn_archiver/spaces/disabled_features.json new file mode 100644 index 0000000000000..bf736f17b88a7 --- /dev/null +++ b/x-pack/test/functional/fixtures/kbn_archiver/spaces/disabled_features.json @@ -0,0 +1,16 @@ +{ + "attributes": { + "fields": "[{\"name\":\"@message\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@message.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@tags\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"@tags.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"@timestamp\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"agent\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"agent.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"bytes\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"clientip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"extension\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"extension.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.coordinates\",\"type\":\"geo_point\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.dest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.src\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"geo.srcdest\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"headings\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"headings.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"host\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"host.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"id\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"index.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"ip\",\"type\":\"ip\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"links\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"links.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.os\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"machine.os.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"machine.ram\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"memory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.char\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"meta.related\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.firstname\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"meta.user.lastname\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"phpmemory\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"referer\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:modified_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:published_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:section\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:section.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.article:tag\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.article:tag.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:height\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:height.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:image:width\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:image:width.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:site_name\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:site_name.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:type.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.og:url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.og:url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:card\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:card.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:description\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:description.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:image\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:image.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:site\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:site.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.twitter:title\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.twitter:title.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"relatedContent.url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"relatedContent.url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"request\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"request.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"response\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"response.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"spaces\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"spaces.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"url\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"url.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"utc_time\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"xss\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"xss.raw\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true}]", + "timeFieldName": "@timestamp", + "title": "logstash-*" + }, + "coreMigrationVersion": "7.15.0", + "id": "logstash-*", + "migrationVersion": { + "index-pattern": "7.11.0" + }, + "references": [], + "type": "index-pattern", + "updated_at": "2018-12-21T00:43:07.096Z", + "version": "WzYsMl0=" +} \ No newline at end of file diff --git a/x-pack/test/functional/services/monitoring/cluster_overview.js b/x-pack/test/functional/services/monitoring/cluster_overview.js index 5874606056db9..7e888d6233ff7 100644 --- a/x-pack/test/functional/services/monitoring/cluster_overview.js +++ b/x-pack/test/functional/services/monitoring/cluster_overview.js @@ -79,6 +79,10 @@ export function MonitoringClusterOverviewProvider({ getService }) { return testSubjects.click('alerts-modal-remind-later-button'); } + acceptAlertsModal() { + return testSubjects.click('alerts-modal-button'); + } + getEsStatus() { return testSubjects.getVisibleText(SUBJ_ES_STATUS); } diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/security_roles_privileges.ts b/x-pack/test/reporting_api_integration/reporting_and_security/security_roles_privileges.ts index 4dbf1b6fa5ebb..f260ada7fe15d 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/security_roles_privileges.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/security_roles_privileges.ts @@ -35,6 +35,7 @@ export default function ({ getService }: FtrProviderContext) { }, browserTimezone: 'UTC', title: 'testfooyu78yt90-', + version: '7.13.0', } as any )) as supertest.Response; expect(res.status).to.eql(403); @@ -52,6 +53,7 @@ export default function ({ getService }: FtrProviderContext) { }, browserTimezone: 'UTC', title: 'testfooyu78yt90-', + version: '7.13.0', } as any )) as supertest.Response; expect(res.status).to.eql(200); @@ -69,6 +71,7 @@ export default function ({ getService }: FtrProviderContext) { layout: { id: 'preserve' }, relativeUrls: ['/fooyou'], objectType: 'dashboard', + version: '7.14.0', } ); expect(res.status).to.eql(403); @@ -84,6 +87,7 @@ export default function ({ getService }: FtrProviderContext) { layout: { id: 'preserve' }, relativeUrls: ['/fooyou'], objectType: 'dashboard', + version: '7.14.0', } ); expect(res.status).to.eql(200); @@ -101,6 +105,7 @@ export default function ({ getService }: FtrProviderContext) { layout: { id: 'preserve' }, relativeUrls: ['/fooyou'], objectType: 'visualization', + version: '7.14.0', } ); expect(res.status).to.eql(403); @@ -116,6 +121,7 @@ export default function ({ getService }: FtrProviderContext) { layout: { id: 'preserve' }, relativeUrls: ['/fooyou'], objectType: 'visualization', + version: '7.14.0', } ); expect(res.status).to.eql(200); @@ -133,6 +139,7 @@ export default function ({ getService }: FtrProviderContext) { layout: { id: 'preserve' }, relativeUrls: ['/fooyou'], objectType: 'canvas', + version: '7.14.0', } ); expect(res.status).to.eql(403); @@ -148,6 +155,7 @@ export default function ({ getService }: FtrProviderContext) { layout: { id: 'preserve' }, relativeUrls: ['/fooyou'], objectType: 'canvas', + version: '7.14.0', } ); expect(res.status).to.eql(200); @@ -164,6 +172,7 @@ export default function ({ getService }: FtrProviderContext) { searchSource: {}, objectType: 'search', title: 'test disallowed', + version: '7.14.0', } ); expect(res.status).to.eql(403); @@ -183,6 +192,7 @@ export default function ({ getService }: FtrProviderContext) { index: '5193f870-d861-11e9-a311-0fa548c5f953', } as any, columns: [], + version: '7.13.0', } ); expect(res.status).to.eql(200); diff --git a/x-pack/test/stack_functional_integration/apps/monitoring/_monitoring_metricbeat.js b/x-pack/test/stack_functional_integration/apps/monitoring/_monitoring_metricbeat.js index 9dcc18b3c3f20..79b3b98aafddd 100644 --- a/x-pack/test/stack_functional_integration/apps/monitoring/_monitoring_metricbeat.js +++ b/x-pack/test/stack_functional_integration/apps/monitoring/_monitoring_metricbeat.js @@ -26,7 +26,7 @@ export default ({ getService, getPageObjects }) => { } // navigateToApp without a username and password will default to the superuser await PageObjects.common.navigateToApp('monitoring', { insertTimestamp: false }); - await clusterOverview.closeAlertsModal(); + await clusterOverview.acceptAlertsModal(); }); it('should have Monitoring already enabled', async () => {