From 8c959c50d328f6293b7fc4bfd654a74fa2d4bc09 Mon Sep 17 00:00:00 2001 From: Byron Hulcher Date: Tue, 2 Aug 2022 11:20:59 -0400 Subject: [PATCH 01/21] Do not display client id and secret form elements when connector has public key (#137786) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../applications/workplace_search/types.ts | 1 - .../components/add_source/save_config.tsx | 80 ++++++++++--------- .../views/content_sources/source_data.tsx | 27 +------ 3 files changed, 45 insertions(+), 63 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts b/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts index 23d1f519f552e..908a2bc2a200d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/types.ts @@ -58,7 +58,6 @@ export interface Features { } export interface Configuration { - isPublicKey: boolean; needsBaseUrl: boolean; needsSubdomain?: boolean; needsConfiguration?: boolean; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.tsx index 5c1c0b3199600..46269d0d85664 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/add_source/save_config.tsx @@ -34,44 +34,47 @@ import { AddSourceLogic, SourceConfigFormElement } from './add_source_logic'; import { ConfigDocsLinks } from './config_docs_links'; import { OAUTH_SAVE_CONFIG_BUTTON, OAUTH_BACK_BUTTON } from './constants'; +const clientIdSecretFields: SourceConfigFormElement[] = [ + { + key: 'client_id', + label: i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.contentSource.saveConfig.clientIDLabel', + { + defaultMessage: 'Client ID', + } + ), + }, + { + key: 'client_secret', + label: i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.contentSource.saveConfig.clientSecretLabel', + { + defaultMessage: 'Client Secret', + } + ), + }, +]; + +const baseUrlFields: SourceConfigFormElement[] = [ + { + key: 'base_url', + label: i18n.translate( + 'xpack.enterpriseSearch.workplaceSearch.contentSource.saveConfig.baseUrlLabel', + { + defaultMessage: 'Base URL', + } + ), + }, +]; + const getInternalConnectorConfigurableFields = ( - configuration: Configuration + needsClientIdSecret: boolean, + needsBaseUrl: boolean ): SourceConfigFormElement[] => { - const internalConnectorFields: SourceConfigFormElement[] = [ - { - key: 'client_id', - label: i18n.translate( - 'xpack.enterpriseSearch.workplaceSearch.contentSource.saveConfig.clientIDLabel', - { - defaultMessage: 'Client ID', - } - ), - }, - { - key: 'client_secret', - label: i18n.translate( - 'xpack.enterpriseSearch.workplaceSearch.contentSource.saveConfig.clientSecretLabel', - { - defaultMessage: 'Client Secret', - } - ), - }, + return [ + ...(needsClientIdSecret ? clientIdSecretFields : []), + ...(needsBaseUrl ? baseUrlFields : []), ]; - - return configuration.needsBaseUrl - ? [ - ...internalConnectorFields, - { - key: 'base_url', - label: i18n.translate( - 'xpack.enterpriseSearch.workplaceSearch.contentSource.saveConfig.baseUrlLabel', - { - defaultMessage: 'Base URL', - } - ), - }, - ] - : internalConnectorFields; }; interface SaveConfigProps { @@ -101,10 +104,13 @@ export const SaveConfig: React.FC = ({ const { accountContextOnly, serviceType, configurableFields = [] } = sourceConfigData; + const isPublicKey = configuredFields.public_key && configuredFields.consumer_key; + const needsClientIdSecret = !isPublicKey; + const formFields: SourceConfigFormElement[] = serviceType === 'external' ? configurableFields - : getInternalConnectorConfigurableFields(configuration); + : getInternalConnectorConfigurableFields(needsClientIdSecret, configuration.needsBaseUrl); const handleFormSubmission = (e: FormEvent) => { e.preventDefault(); @@ -154,7 +160,7 @@ export const SaveConfig: React.FC = ({ applicationPortalUrl={applicationPortalUrl} applicationLinkTitle={applicationLinkTitle} /> - {configuredFields.public_key && configuredFields.consumer_key && ( + {isPublicKey && ( <> diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_data.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_data.tsx index 4b1bd88dd045b..30419d79edebc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_data.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/source_data.tsx @@ -22,7 +22,6 @@ export const staticGenericExternalSourceData: SourceDataItem = { categories: ['API', 'Custom'], serviceType: 'external', configuration: { - isPublicKey: false, hasOauthRedirect: false, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchCustomConnectorPackage, @@ -48,7 +47,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.CLOUD, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchBox, @@ -76,7 +74,6 @@ export const staticSourceData: SourceDataItem[] = [ serviceType: 'confluence_cloud', categories: [SOURCE_CATEGORIES.WIKI, SOURCE_CATEGORIES.ATLASSIAN, SOURCE_CATEGORIES.INTRANET], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: true, documentationUrl: docLinks.workplaceSearchConfluenceCloud, @@ -111,7 +108,6 @@ export const staticSourceData: SourceDataItem[] = [ baseServiceType: 'confluence_cloud', categories: [SOURCE_CATEGORIES.WIKI, SOURCE_CATEGORIES.ATLASSIAN, SOURCE_CATEGORIES.INTRANET], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: true, documentationUrl: docLinks.workplaceSearchConfluenceCloudConnectorPackage, @@ -145,9 +141,8 @@ export const staticSourceData: SourceDataItem[] = [ serviceType: 'confluence_server', categories: [SOURCE_CATEGORIES.WIKI, SOURCE_CATEGORIES.ATLASSIAN, SOURCE_CATEGORIES.INTRANET], configuration: { - isPublicKey: true, hasOauthRedirect: true, - needsBaseUrl: false, + needsBaseUrl: true, documentationUrl: docLinks.workplaceSearchConfluenceServer, }, objTypes: [ @@ -180,7 +175,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.CLOUD, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchDropbox, @@ -212,7 +206,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.CODE_REPOSITORY, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, needsConfiguration: true, @@ -251,7 +244,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.CODE_REPOSITORY, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsConfiguration: true, needsBaseUrl: true, @@ -296,7 +288,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.GOOGLE, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchGmail, @@ -319,7 +310,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.GSUITE, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchGoogleDrive, @@ -356,7 +346,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.PROJECT_MANAGEMENT, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: true, documentationUrl: docLinks.workplaceSearchJiraCloud, @@ -396,9 +385,8 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.PROJECT_MANAGEMENT, ], configuration: { - isPublicKey: true, hasOauthRedirect: true, - needsBaseUrl: false, + needsBaseUrl: true, documentationUrl: docLinks.workplaceSearchJiraServer, applicationPortalUrl: '', }, @@ -431,7 +419,6 @@ export const staticSourceData: SourceDataItem[] = [ serviceType: 'custom', baseServiceType: 'network_drive', configuration: { - isPublicKey: false, hasOauthRedirect: false, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchNetworkDrive, @@ -451,7 +438,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.OFFICE_365, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchOneDrive, @@ -483,7 +469,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.ACCOUNT_MANAGEMENT, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchSalesforce, @@ -522,7 +507,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.ACCOUNT_MANAGEMENT, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchSalesforce, @@ -557,7 +541,6 @@ export const staticSourceData: SourceDataItem[] = [ serviceType: 'service_now', categories: [SOURCE_CATEGORIES.WORKFLOW], configuration: { - isPublicKey: false, hasOauthRedirect: false, needsBaseUrl: true, needsCredentials: true, @@ -596,7 +579,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.OFFICE_365, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchSharePoint, @@ -631,7 +613,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.OFFICE_365, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchExternalSharePointOnline, @@ -667,7 +648,6 @@ export const staticSourceData: SourceDataItem[] = [ serviceType: 'custom', baseServiceType: 'share_point_server', configuration: { - isPublicKey: false, hasOauthRedirect: false, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchSharePointServer, @@ -686,7 +666,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.CHAT, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchSlack, @@ -713,7 +692,6 @@ export const staticSourceData: SourceDataItem[] = [ SOURCE_CATEGORIES.HELPDESK, ], configuration: { - isPublicKey: false, hasOauthRedirect: true, needsBaseUrl: false, needsSubdomain: true, @@ -744,7 +722,6 @@ export const staticCustomSourceData: SourceDataItem = { categories: ['API', 'Custom'], serviceType: 'custom', configuration: { - isPublicKey: false, hasOauthRedirect: false, needsBaseUrl: false, documentationUrl: docLinks.workplaceSearchCustomSources, From ee8bf485b02dd9f74ba97f5c2613ce635ec647f9 Mon Sep 17 00:00:00 2001 From: Sergi Massaneda Date: Tue, 2 Aug 2022 17:25:19 +0200 Subject: [PATCH 02/21] [Security Solution] Consolidate links configuration and needsUrlState function (#137699) * use app links needsUrlState function * narrow LinkItem type * consolidate links * link globalNavPosition prop * comments added * deprecate useFormatUrl * useFormatUrl deprecation alternatives added Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../public/app/deep_links/index.ts | 5 +-- .../security_solution/public/cases/links.ts | 3 +- .../public/cloud_security_posture/links.ts | 3 +- .../public/common/components/link_to/index.ts | 28 ++++++--------- .../public/common/links/types.ts | 34 +++++++++---------- .../utils/global_query_string/index.test.tsx | 1 - .../public/detections/links.ts | 3 +- .../public/kubernetes/links.ts | 2 -- .../public/landing_pages/links.ts | 6 ++-- .../public/management/links.ts | 5 +-- .../public/threat_intelligence/links.ts | 1 - .../public/timelines/links.ts | 3 +- 12 files changed, 38 insertions(+), 56 deletions(-) diff --git a/x-pack/plugins/security_solution/public/app/deep_links/index.ts b/x-pack/plugins/security_solution/public/app/deep_links/index.ts index d5e4b13bef56f..33b57a1b59917 100644 --- a/x-pack/plugins/security_solution/public/app/deep_links/index.ts +++ b/x-pack/plugins/security_solution/public/app/deep_links/index.ts @@ -585,10 +585,11 @@ const formatDeepLinks = (appLinks: AppLinkItems): AppDeepLink[] => id: appLink.id, path: appLink.path, title: appLink.title, - navLinkStatus: appLink.globalNavEnabled ? AppNavLinkStatus.visible : AppNavLinkStatus.hidden, searchable: !appLink.globalSearchDisabled, + ...(appLink.globalNavPosition != null + ? { navLinkStatus: AppNavLinkStatus.visible, order: appLink.globalNavPosition } + : { navLinkStatus: AppNavLinkStatus.hidden }), ...(appLink.globalSearchKeywords != null ? { keywords: appLink.globalSearchKeywords } : {}), - ...(appLink.globalNavOrder != null ? { order: appLink.globalNavOrder } : {}), ...(appLink.links && appLink.links?.length ? { deepLinks: formatDeepLinks(appLink.links), diff --git a/x-pack/plugins/security_solution/public/cases/links.ts b/x-pack/plugins/security_solution/public/cases/links.ts index e74ed3ca103f3..679c355c819ed 100644 --- a/x-pack/plugins/security_solution/public/cases/links.ts +++ b/x-pack/plugins/security_solution/public/cases/links.ts @@ -19,8 +19,7 @@ export const getCasesLinkItems = (): LinkItem => { basePath: CASES_PATH, extend: { [SecurityPageName.case]: { - globalNavEnabled: true, - globalNavOrder: 5, + globalNavPosition: 5, capabilities: [`${CASES_FEATURE_ID}.${READ_CASES_CAPABILITY}`], }, [SecurityPageName.caseConfigure]: { diff --git a/x-pack/plugins/security_solution/public/cloud_security_posture/links.ts b/x-pack/plugins/security_solution/public/cloud_security_posture/links.ts index 1d4c311b34e4c..7da3f75ba22e5 100644 --- a/x-pack/plugins/security_solution/public/cloud_security_posture/links.ts +++ b/x-pack/plugins/security_solution/public/cloud_security_posture/links.ts @@ -18,8 +18,7 @@ const commonLinkProperties: Partial = { export const rootLinks: LinkItem = { ...getSecuritySolutionLink('findings'), - globalNavEnabled: true, - globalNavOrder: 3, + globalNavPosition: 3, ...commonLinkProperties, }; diff --git a/x-pack/plugins/security_solution/public/common/components/link_to/index.ts b/x-pack/plugins/security_solution/public/common/components/link_to/index.ts index a85d42e3f3d1e..95ea38b29709c 100644 --- a/x-pack/plugins/security_solution/public/common/components/link_to/index.ts +++ b/x-pack/plugins/security_solution/public/common/components/link_to/index.ts @@ -11,7 +11,8 @@ import { useGetUrlSearch, useGetUrlStateQueryString } from '../navigation/use_ge import { navTabs } from '../../../app/home/home_navigations'; import { useAppUrl } from '../../lib/kibana/hooks'; import type { SecurityNavKey } from '../navigation/types'; -import { SecurityPageName } from '../../../app/types'; +import type { SecurityPageName } from '../../../app/types'; +import { needsUrlState } from '../../links'; export { getDetectionEngineUrl, getRuleDetailsUrl } from './redirect_to_detection_engine'; export { getHostDetailsUrl, getTabsOnHostDetailsUrl, getHostsUrl } from './redirect_to_hosts'; @@ -33,6 +34,14 @@ interface FormatUrlOptions { export type FormatUrl = (path: string, options?: Partial) => string; +/** + * @deprecated `useFormatUrl` is deprecated. Alternatives: + * - `SecuritySolutionLinkAnchor` -> Component with built-in Security link anchor + * - `SecuritySolutionLinkButton` -> Component with built-in Security link button + * - `withSecuritySolutionLink` -> HOC to create a custom Security link component. + * - `useGetSecuritySolutionLinkProps` -> Hook to get `href` and `onClick` Security link props. + * - `useGetSecuritySolutionUrl` -> Hook to get a Security formatted url. + */ export const useFormatUrl = (page: SecurityPageName) => { const { getAppUrl } = useAppUrl(); const tab = page in navTabs ? navTabs[page as SecurityNavKey] : undefined; @@ -86,20 +95,3 @@ function formatPath(path: string, search: string, skipSearch?: boolean) { }`; return formattedPath; } - -// TODO: migrate to links.needsUrlState -function needsUrlState(pageId: SecurityPageName) { - return ( - pageId !== SecurityPageName.dashboardsLanding && - pageId !== SecurityPageName.exploreLanding && - pageId !== SecurityPageName.administration && - pageId !== SecurityPageName.rules && - pageId !== SecurityPageName.exceptions && - pageId !== SecurityPageName.endpoints && - pageId !== SecurityPageName.policies && - pageId !== SecurityPageName.trustedApps && - pageId !== SecurityPageName.eventFilters && - pageId !== SecurityPageName.blocklist && - pageId !== SecurityPageName.hostIsolationExceptions - ); -} diff --git a/x-pack/plugins/security_solution/public/common/links/types.ts b/x-pack/plugins/security_solution/public/common/links/types.ts index f5432b16e9f78..210a5f4a59754 100644 --- a/x-pack/plugins/security_solution/public/common/links/types.ts +++ b/x-pack/plugins/security_solution/public/common/links/types.ts @@ -28,20 +28,12 @@ export interface LinkCategory { export type LinkCategories = Readonly; export interface LinkItem { - /** - * The description of the link content - */ - description?: string; - /** - * Experimental flag needed to enable the link - */ - experimentalKey?: keyof ExperimentalFeatures; /** * Capabilities strings (using object dot notation) to enable the link. * * The format of defining features supports OR and AND mechanism. To specify features in an OR fashion * they can be defined in a single level array like: [requiredFeature1, requiredFeature2]. If either of these features - * is satisfied the deeplinks would be included. To require that the features be AND'd together a second level array + * is satisfied the link would be included. To require that the features be AND'd together a second level array * can be specified: [feature1, [feature2, feature3]] this would result in feature1 || (feature2 && feature3). To specify * features that all must be and'd together an example would be: [[feature1, feature2]], this would result in the boolean * operation feature1 && feature2. @@ -55,13 +47,19 @@ export interface LinkItem { */ categories?: LinkCategories; /** - * Enables link in the global navigation. Defaults to false. + * The description of the link content + */ + description?: string; + /** + * Experimental flag needed to enable the link */ - globalNavEnabled?: boolean; + experimentalKey?: keyof ExperimentalFeatures; /** - * Global navigation order number + * Global navigation position number. + * Define this property only if the link needs to be visible within + * the Security section of the Kibana collapsible global navigation */ - globalNavOrder?: number; + globalNavPosition?: number; /** * Disables link in the global search. Defaults to false. */ @@ -70,6 +68,10 @@ export interface LinkItem { * Keywords for the global search to search. */ globalSearchKeywords?: string[]; + /** + * Disables the timeline call to action on the bottom of the page. Defaults to false. + */ + hideTimeline?: boolean; /** * Experimental flag needed to disable the link. Opposite of experimentalKey */ @@ -79,7 +81,7 @@ export interface LinkItem { */ id: SecurityPageName; /** - * Displays the "Beta" badge + * Displays the "Beta" badge. Defaults to false. */ isBeta?: boolean; /** @@ -112,10 +114,6 @@ export interface LinkItem { * Disables the state query string in the URL. Defaults to false. */ skipUrlState?: boolean; - /** - * Disables the timeline call to action on the bottom of the page. Defaults to false. - */ - hideTimeline?: boolean; // defaults to false /** * Title of the link */ diff --git a/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx b/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx index 91a5fb9fb145c..a400ab24e06dd 100644 --- a/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx @@ -46,7 +46,6 @@ const defaultLinkInfo: LinkInfo = { id: SecurityPageName.alerts, path: '/test', title: 'test title', - skipUrlState: false, }; const mockLinkInfo = jest.fn().mockResolvedValue(defaultLinkInfo); diff --git a/x-pack/plugins/security_solution/public/detections/links.ts b/x-pack/plugins/security_solution/public/detections/links.ts index ddc6fb944e15c..79271592d174e 100644 --- a/x-pack/plugins/security_solution/public/detections/links.ts +++ b/x-pack/plugins/security_solution/public/detections/links.ts @@ -14,8 +14,7 @@ export const links: LinkItem = { title: ALERTS, path: ALERTS_PATH, capabilities: [`${SERVER_APP_ID}.show`], - globalNavEnabled: true, - globalNavOrder: 2, + globalNavPosition: 2, globalSearchKeywords: [ i18n.translate('xpack.securitySolution.appLinks.alerts', { defaultMessage: 'Alerts', diff --git a/x-pack/plugins/security_solution/public/kubernetes/links.ts b/x-pack/plugins/security_solution/public/kubernetes/links.ts index 0e0d069d12981..83f2672e6cb2a 100644 --- a/x-pack/plugins/security_solution/public/kubernetes/links.ts +++ b/x-pack/plugins/security_solution/public/kubernetes/links.ts @@ -20,9 +20,7 @@ export const links: LinkItem = { 'Provides interactive visualizations of your Kubernetes workload and session data.', }), path: KUBERNETES_PATH, - globalNavEnabled: false, isBeta: true, experimentalKey: 'kubernetesEnabled', globalSearchKeywords: ['Kubernetes'], - globalNavOrder: 9005, }; diff --git a/x-pack/plugins/security_solution/public/landing_pages/links.ts b/x-pack/plugins/security_solution/public/landing_pages/links.ts index 773e18b0271d8..dc5cb5f5a5dec 100644 --- a/x-pack/plugins/security_solution/public/landing_pages/links.ts +++ b/x-pack/plugins/security_solution/public/landing_pages/links.ts @@ -26,8 +26,7 @@ export const dashboardsLandingLinks: LinkItem = { id: SecurityPageName.dashboardsLanding, title: DASHBOARDS, path: DASHBOARDS_PATH, - globalNavEnabled: true, - globalNavOrder: 1, + globalNavPosition: 1, capabilities: [`${SERVER_APP_ID}.show`], globalSearchKeywords: [ i18n.translate('xpack.securitySolution.appLinks.dashboards', { @@ -43,8 +42,7 @@ export const threatHuntingLandingLinks: LinkItem = { id: SecurityPageName.exploreLanding, title: EXPLORE, path: EXPLORE_PATH, - globalNavEnabled: true, - globalNavOrder: 6, + globalNavPosition: 6, capabilities: [`${SERVER_APP_ID}.show`], globalSearchKeywords: [ i18n.translate('xpack.securitySolution.appLinks.explore', { diff --git a/x-pack/plugins/security_solution/public/management/links.ts b/x-pack/plugins/security_solution/public/management/links.ts index 73eb5179c3141..46a07087b1434 100644 --- a/x-pack/plugins/security_solution/public/management/links.ts +++ b/x-pack/plugins/security_solution/public/management/links.ts @@ -80,8 +80,7 @@ export const links: LinkItem = { path: MANAGE_PATH, skipUrlState: true, hideTimeline: true, - globalNavEnabled: true, - globalNavOrder: 7, + globalNavPosition: 7, capabilities: [`${SERVER_APP_ID}.show`], globalSearchKeywords: [ i18n.translate('xpack.securitySolution.appLinks.manage', { @@ -123,6 +122,8 @@ export const links: LinkItem = { }), landingIcon: IconExceptionLists, path: EXCEPTIONS_PATH, + skipUrlState: true, + hideTimeline: true, globalSearchKeywords: [ i18n.translate('xpack.securitySolution.appLinks.exceptions', { defaultMessage: 'Exception lists', diff --git a/x-pack/plugins/security_solution/public/threat_intelligence/links.ts b/x-pack/plugins/security_solution/public/threat_intelligence/links.ts index 471f120d0e003..f5610dd3e931c 100644 --- a/x-pack/plugins/security_solution/public/threat_intelligence/links.ts +++ b/x-pack/plugins/security_solution/public/threat_intelligence/links.ts @@ -21,7 +21,6 @@ export const links: LinkItem = { 'Elastic threat intelligence helps you see if you are open to or have been subject to current or historical known threats.', }), capabilities: [`${SERVER_APP_ID}.show`], - globalNavEnabled: false, globalSearchKeywords: [ i18n.translate('xpack.securitySolution.appLinks.threatIntelligence', { defaultMessage: 'Threat Intelligence', diff --git a/x-pack/plugins/security_solution/public/timelines/links.ts b/x-pack/plugins/security_solution/public/timelines/links.ts index 7a9b32b87675c..e50e151e0c662 100644 --- a/x-pack/plugins/security_solution/public/timelines/links.ts +++ b/x-pack/plugins/security_solution/public/timelines/links.ts @@ -14,8 +14,7 @@ export const links: LinkItem = { id: SecurityPageName.timelines, title: TIMELINES, path: TIMELINES_PATH, - globalNavEnabled: true, - globalNavOrder: 4, + globalNavPosition: 4, capabilities: [`${SERVER_APP_ID}.show`], globalSearchKeywords: [ i18n.translate('xpack.securitySolution.appLinks.timelines', { From 5861f67ba08463289324fc0eb3a8575ab716f371 Mon Sep 17 00:00:00 2001 From: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com> Date: Tue, 2 Aug 2022 11:28:53 -0400 Subject: [PATCH 03/21] [ResponseOps][Cases] User suggestion API (#137346) * Refactoring services, auth * Adding suggest api and tests * Working integration tests * Switching suggest api tags * Adding tests for size and owner * Adding api tag tests * Addressing feedback * Addressing feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../plugins/cases/common/api/cases/index.ts | 1 + .../cases/common/api/cases/user_profiles.ts | 18 + x-pack/plugins/cases/common/constants.ts | 2 + x-pack/plugins/cases/server/features.ts | 1 + x-pack/plugins/cases/server/plugin.ts | 11 +- .../server/routes/api/get_internal_routes.ts | 5 +- .../api/internal/suggest_user_profiles.ts | 36 ++ .../server/routes/api/register_routes.ts | 3 +- .../plugins/cases/server/routes/api/types.ts | 9 + x-pack/plugins/cases/server/services/index.ts | 1 + .../server/services/user_profiles/index.ts | 130 ++++++ x-pack/plugins/observability/server/plugin.ts | 3 +- .../security_solution/server/features.ts | 3 +- .../test/api_integration/apis/cases/index.ts | 25 +- .../api_integration/apis/cases/privileges.ts | 14 - .../apis/cases/suggest_user_profiles.ts | 72 ++++ .../plugins/observability/server/plugin.ts | 1 + .../security_solution/server/plugin.ts | 1 + .../common/lib/authentication/roles.ts | 24 ++ .../common/lib/authentication/users.ts | 8 + .../cases_api_integration/common/lib/utils.ts | 45 +++ .../security_and_spaces/tests/common/index.ts | 1 + .../common/internal/suggest_user_profiles.ts | 381 ++++++++++++++++++ .../spaces_only/tests/common/index.ts | 1 + .../common/internal/suggest_user_profiles.ts | 29 ++ 25 files changed, 803 insertions(+), 22 deletions(-) create mode 100644 x-pack/plugins/cases/common/api/cases/user_profiles.ts create mode 100644 x-pack/plugins/cases/server/routes/api/internal/suggest_user_profiles.ts create mode 100644 x-pack/plugins/cases/server/services/user_profiles/index.ts create mode 100644 x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts create mode 100644 x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/suggest_user_profiles.ts create mode 100644 x-pack/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts diff --git a/x-pack/plugins/cases/common/api/cases/index.ts b/x-pack/plugins/cases/common/api/cases/index.ts index 2bcad0c556e63..3a3eab2ca3198 100644 --- a/x-pack/plugins/cases/common/api/cases/index.ts +++ b/x-pack/plugins/cases/common/api/cases/index.ts @@ -12,3 +12,4 @@ export * from './status'; export * from './user_actions'; export * from './constants'; export * from './alerts'; +export * from './user_profiles'; diff --git a/x-pack/plugins/cases/common/api/cases/user_profiles.ts b/x-pack/plugins/cases/common/api/cases/user_profiles.ts new file mode 100644 index 0000000000000..75cd1f9cb9f94 --- /dev/null +++ b/x-pack/plugins/cases/common/api/cases/user_profiles.ts @@ -0,0 +1,18 @@ +/* + * 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 * as rt from 'io-ts'; + +export const SuggestUserProfilesRequestRt = rt.intersection([ + rt.type({ + name: rt.string, + owners: rt.array(rt.string), + }), + rt.partial({ size: rt.number }), +]); + +export type SuggestUserProfilesRequest = rt.TypeOf; diff --git a/x-pack/plugins/cases/common/constants.ts b/x-pack/plugins/cases/common/constants.ts index f9de7753a7d33..e88a7baf2f583 100644 --- a/x-pack/plugins/cases/common/constants.ts +++ b/x-pack/plugins/cases/common/constants.ts @@ -78,6 +78,8 @@ export const CASE_METRICS_DETAILS_URL = `${CASES_URL}/metrics/{case_id}` as cons export const CASES_INTERNAL_URL = '/internal/cases' as const; export const INTERNAL_BULK_CREATE_ATTACHMENTS_URL = `${CASES_INTERNAL_URL}/{case_id}/attachments/_bulk_create` as const; +export const INTERNAL_SUGGEST_USER_PROFILES_URL = + `${CASES_INTERNAL_URL}/_suggest_user_profiles` as const; /** * Action routes diff --git a/x-pack/plugins/cases/server/features.ts b/x-pack/plugins/cases/server/features.ts index f2e7ad3bb74c6..f4e502912a2a6 100644 --- a/x-pack/plugins/cases/server/features.ts +++ b/x-pack/plugins/cases/server/features.ts @@ -38,6 +38,7 @@ export const getCasesKibanaFeature = (): KibanaFeatureConfig => { cases: [APP_ID], privileges: { all: { + api: ['casesSuggestUserProfiles'], cases: { create: [APP_ID], read: [APP_ID], diff --git a/x-pack/plugins/cases/server/plugin.ts b/x-pack/plugins/cases/server/plugin.ts index e1291e1a8b0ae..a0acd302a9373 100644 --- a/x-pack/plugins/cases/server/plugin.ts +++ b/x-pack/plugins/cases/server/plugin.ts @@ -51,6 +51,7 @@ import { createCasesTelemetry, scheduleCasesTelemetryTask } from './telemetry'; import { getInternalRoutes } from './routes/api/get_internal_routes'; import { PersistableStateAttachmentTypeRegistry } from './attachment_framework/persistable_state_registry'; import { ExternalReferenceAttachmentTypeRegistry } from './attachment_framework/external_reference_registry'; +import { UserProfileService } from './services'; export interface PluginsSetup { actions: ActionsPluginSetup; @@ -77,6 +78,7 @@ export class CasePlugin { private lensEmbeddableFactory?: LensServerPluginSetup['lensEmbeddableFactory']; private persistableStateAttachmentTypeRegistry: PersistableStateAttachmentTypeRegistry; private externalReferenceAttachmentTypeRegistry: ExternalReferenceAttachmentTypeRegistry; + private userProfileService: UserProfileService; constructor(private readonly initializerContext: PluginInitializerContext) { this.kibanaVersion = initializerContext.env.packageInfo.version; @@ -84,6 +86,7 @@ export class CasePlugin { this.clientFactory = new CasesClientFactory(this.logger); this.persistableStateAttachmentTypeRegistry = new PersistableStateAttachmentTypeRegistry(); this.externalReferenceAttachmentTypeRegistry = new ExternalReferenceAttachmentTypeRegistry(); + this.userProfileService = new UserProfileService(this.logger); } public setup(core: CoreSetup, plugins: PluginsSetup): PluginSetupContract { @@ -138,7 +141,7 @@ export class CasePlugin { registerRoutes({ router, - routes: [...getExternalRoutes(), ...getInternalRoutes()], + routes: [...getExternalRoutes(), ...getInternalRoutes(this.userProfileService)], logger: this.logger, kibanaVersion: this.kibanaVersion, telemetryUsageCounter, @@ -163,6 +166,12 @@ export class CasePlugin { scheduleCasesTelemetryTask(plugins.taskManager, this.logger); } + this.userProfileService.initialize({ + spaces: plugins.spaces, + securityPluginSetup: this.securityPluginSetup, + securityPluginStart: plugins.security, + }); + this.clientFactory.initialize({ securityPluginSetup: this.securityPluginSetup, securityPluginStart: plugins.security, diff --git a/x-pack/plugins/cases/server/routes/api/get_internal_routes.ts b/x-pack/plugins/cases/server/routes/api/get_internal_routes.ts index 10d379c080abb..50e6bcf64cbd9 100644 --- a/x-pack/plugins/cases/server/routes/api/get_internal_routes.ts +++ b/x-pack/plugins/cases/server/routes/api/get_internal_routes.ts @@ -5,7 +5,10 @@ * 2.0. */ +import { UserProfileService } from '../../services'; import { bulkCreateAttachmentsRoute } from './internal/bulk_create_attachments'; +import { suggestUserProfilesRoute } from './internal/suggest_user_profiles'; import { CaseRoute } from './types'; -export const getInternalRoutes = () => [bulkCreateAttachmentsRoute] as CaseRoute[]; +export const getInternalRoutes = (userProfileService: UserProfileService) => + [bulkCreateAttachmentsRoute, suggestUserProfilesRoute(userProfileService)] as CaseRoute[]; diff --git a/x-pack/plugins/cases/server/routes/api/internal/suggest_user_profiles.ts b/x-pack/plugins/cases/server/routes/api/internal/suggest_user_profiles.ts new file mode 100644 index 0000000000000..00a8d06259e22 --- /dev/null +++ b/x-pack/plugins/cases/server/routes/api/internal/suggest_user_profiles.ts @@ -0,0 +1,36 @@ +/* + * 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 { UserProfileService } from '../../../services'; +import { INTERNAL_SUGGEST_USER_PROFILES_URL } from '../../../../common/constants'; +import { createCaseError } from '../../../common/error'; +import { createCasesRoute } from '../create_cases_route'; +import { escapeHatch } from '../utils'; + +export const suggestUserProfilesRoute = (userProfileService: UserProfileService) => + createCasesRoute({ + method: 'post', + path: INTERNAL_SUGGEST_USER_PROFILES_URL, + routerOptions: { + tags: ['access:casesSuggestUserProfiles'], + }, + params: { + body: escapeHatch, + }, + handler: async ({ request, response }) => { + try { + return response.ok({ + body: await userProfileService.suggest(request), + }); + } catch (error) { + throw createCaseError({ + message: `Failed to find user profiles: ${error}`, + error, + }); + } + }, + }); diff --git a/x-pack/plugins/cases/server/routes/api/register_routes.ts b/x-pack/plugins/cases/server/routes/api/register_routes.ts index e46491ffad80a..a9dcd51864a57 100644 --- a/x-pack/plugins/cases/server/routes/api/register_routes.ts +++ b/x-pack/plugins/cases/server/routes/api/register_routes.ts @@ -74,11 +74,12 @@ export const registerRoutes = (deps: RegisterRoutesDeps) => { const { router, routes, logger, kibanaVersion, telemetryUsageCounter } = deps; routes.forEach((route) => { - const { method, path, params, options, handler } = route; + const { method, path, params, options, routerOptions, handler } = route; (router[method] as RouteRegistrar)( { path, + options: routerOptions, validate: { params: params?.params ?? escapeHatch, query: params?.query ?? escapeHatch, diff --git a/x-pack/plugins/cases/server/routes/api/types.ts b/x-pack/plugins/cases/server/routes/api/types.ts index d49861881d586..3c340cec9ef2a 100644 --- a/x-pack/plugins/cases/server/routes/api/types.ts +++ b/x-pack/plugins/cases/server/routes/api/types.ts @@ -40,10 +40,19 @@ interface CaseRouteHandlerArguments { kibanaVersion: PluginInitializerContext['env']['packageInfo']['version']; } +type CaseRouteTags = 'access:casesSuggestUserProfiles'; + export interface CaseRoute

{ method: 'get' | 'post' | 'put' | 'delete' | 'patch'; path: string; params?: RouteValidatorConfig; + /** + * These options control pre-route execution behavior + */ options?: { deprecated?: boolean }; + /** + * These options are passed to the router's options field + */ + routerOptions?: { tags: CaseRouteTags[] }; handler: (args: CaseRouteHandlerArguments) => Promise; } diff --git a/x-pack/plugins/cases/server/services/index.ts b/x-pack/plugins/cases/server/services/index.ts index bfd551d27e23e..5ba4fe74603e6 100644 --- a/x-pack/plugins/cases/server/services/index.ts +++ b/x-pack/plugins/cases/server/services/index.ts @@ -14,6 +14,7 @@ export { CaseUserActionService } from './user_actions'; export { ConnectorMappingsService } from './connector_mappings'; export { AlertService } from './alerts'; export { AttachmentService } from './attachments'; +export { UserProfileService } from './user_profiles'; export interface ClientArgs { unsecuredSavedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/cases/server/services/user_profiles/index.ts b/x-pack/plugins/cases/server/services/user_profiles/index.ts new file mode 100644 index 0000000000000..36bc0c439a79e --- /dev/null +++ b/x-pack/plugins/cases/server/services/user_profiles/index.ts @@ -0,0 +1,130 @@ +/* + * 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 Boom from '@hapi/boom'; +import { pipe } from 'fp-ts/lib/pipeable'; +import { fold } from 'fp-ts/lib/Either'; +import { identity } from 'fp-ts/lib/function'; + +import { KibanaRequest, Logger } from '@kbn/core/server'; +import { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/server'; +import type { UserProfile } from '@kbn/security-plugin/common'; +import { SpacesPluginStart } from '@kbn/spaces-plugin/server'; + +import { excess, SuggestUserProfilesRequestRt, throwErrors } from '../../../common/api'; +import { Operations } from '../../authorization'; +import { createCaseError } from '../../common/error'; + +const MAX_SUGGESTION_SIZE = 100; +const MIN_SUGGESTION_SIZE = 0; + +interface UserProfileOptions { + securityPluginSetup?: SecurityPluginSetup; + securityPluginStart?: SecurityPluginStart; + spaces: SpacesPluginStart; +} + +export class UserProfileService { + private options?: UserProfileOptions; + + constructor(private readonly logger: Logger) {} + + public initialize(options: UserProfileOptions) { + if (this.options !== undefined) { + throw new Error('UserProfileService was already initialized'); + } + + this.options = options; + } + + public async suggest(request: KibanaRequest): Promise { + const params = pipe( + excess(SuggestUserProfilesRequestRt).decode(request.body), + fold(throwErrors(Boom.badRequest), identity) + ); + + const { name, size, owners } = params; + + try { + if (this.options === undefined) { + throw new Error('UserProfileService must be initialized before calling suggest'); + } + + const { spaces } = this.options; + + const securityPluginFields = { + securityPluginSetup: this.options.securityPluginSetup, + securityPluginStart: this.options.securityPluginStart, + }; + + /** + * The limit of 100 helps prevent DDoS attacks and is also enforced by the security plugin. + */ + if (size !== undefined && (size > MAX_SUGGESTION_SIZE || size < MIN_SUGGESTION_SIZE)) { + throw Boom.badRequest('size must be between 0 and 100'); + } + + if (!UserProfileService.isSecurityEnabled(securityPluginFields)) { + return []; + } + + const { securityPluginStart } = securityPluginFields; + + return securityPluginStart.userProfiles.suggest({ + name, + size, + dataPath: 'avatar', + requiredPrivileges: { + spaceId: spaces.spacesService.getSpaceId(request), + privileges: { + kibana: UserProfileService.buildRequiredPrivileges(owners, securityPluginStart), + }, + }, + }); + } catch (error) { + throw createCaseError({ + logger: this.logger, + message: `Failed to retrieve suggested user profiles in service for name: ${name} owners: [${owners}]: ${error}`, + error, + }); + } + } + + private static isSecurityEnabled(fields: { + securityPluginSetup?: SecurityPluginSetup; + securityPluginStart?: SecurityPluginStart; + }): fields is { + securityPluginSetup: SecurityPluginSetup; + securityPluginStart: SecurityPluginStart; + } { + const { securityPluginSetup, securityPluginStart } = fields; + + return ( + securityPluginStart !== undefined && + securityPluginSetup !== undefined && + securityPluginSetup.license.isEnabled() + ); + } + + /** + * This function constructs the privileges required for a user to be assigned to a case. We're requiring the ability + * to read and update a case saved object. My thought process was that a user should at a minimum be able to read it + * and change its status to close it. This is does not require that the user have access to comments or various other + * privileges around the other entities within cases. If we move to a more granular object level permissions we'll + * likely need to expand this to include the privileges for the other entities as well. + */ + private static buildRequiredPrivileges(owners: string[], security: SecurityPluginStart) { + const privileges: string[] = []; + for (const owner of owners) { + for (const operation of [Operations.updateCase.name, Operations.getCase.name]) { + privileges.push(security.authz.actions.cases.get(owner, operation)); + } + } + + return privileges; + } +} diff --git a/x-pack/plugins/observability/server/plugin.ts b/x-pack/plugins/observability/server/plugin.ts index a5e530f6d6fbe..de4345998d4fe 100644 --- a/x-pack/plugins/observability/server/plugin.ts +++ b/x-pack/plugins/observability/server/plugin.ts @@ -55,6 +55,7 @@ export class ObservabilityPlugin implements Plugin { cases: [observabilityFeatureId], privileges: { all: { + api: ['casesSuggestUserProfiles'], app: [casesFeatureId, 'kibana'], catalogue: [observabilityFeatureId], cases: { @@ -63,7 +64,6 @@ export class ObservabilityPlugin implements Plugin { update: [observabilityFeatureId], push: [observabilityFeatureId], }, - api: [], savedObject: { all: [], read: [], @@ -76,7 +76,6 @@ export class ObservabilityPlugin implements Plugin { cases: { read: [observabilityFeatureId], }, - api: [], savedObject: { all: [], read: [], diff --git a/x-pack/plugins/security_solution/server/features.ts b/x-pack/plugins/security_solution/server/features.ts index 337ed1455c4b9..fa9d94a260ce6 100644 --- a/x-pack/plugins/security_solution/server/features.ts +++ b/x-pack/plugins/security_solution/server/features.ts @@ -29,6 +29,7 @@ export const getCasesKibanaFeature = (): KibanaFeatureConfig => { cases: [APP_ID], privileges: { all: { + api: ['casesSuggestUserProfiles'], app: [CASES_FEATURE_ID, 'kibana'], catalogue: [APP_ID], cases: { @@ -37,7 +38,6 @@ export const getCasesKibanaFeature = (): KibanaFeatureConfig => { update: [APP_ID], push: [APP_ID], }, - api: [], savedObject: { all: [], read: [], @@ -50,7 +50,6 @@ export const getCasesKibanaFeature = (): KibanaFeatureConfig => { cases: { read: [APP_ID], }, - api: [], savedObject: { all: [], read: [], diff --git a/x-pack/test/api_integration/apis/cases/index.ts b/x-pack/test/api_integration/apis/cases/index.ts index 3ec21e4d1cce1..76cbed2567f96 100644 --- a/x-pack/test/api_integration/apis/cases/index.ts +++ b/x-pack/test/api_integration/apis/cases/index.ts @@ -5,10 +5,33 @@ * 2.0. */ +import { + createUsersAndRoles, + deleteUsersAndRoles, +} from '../../../cases_api_integration/common/lib/authentication'; + +import { loginUsers } from '../../../cases_api_integration/common/lib/utils'; +import { casesAllUser, obsCasesAllUser, secAllUser, users } from './common/users'; +import { roles } from './common/roles'; import { FtrProviderContext } from '../../ftr_provider_context'; -export default function ({ loadTestFile }: FtrProviderContext) { +export default function ({ loadTestFile, getService }: FtrProviderContext) { describe('cases', function () { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + + before(async () => { + await createUsersAndRoles(getService, users, roles); + await loginUsers({ + supertest: supertestWithoutAuth, + users: [casesAllUser, secAllUser, obsCasesAllUser], + }); + }); + + after(async () => { + await deleteUsersAndRoles(getService, users, roles); + }); + loadTestFile(require.resolve('./privileges')); + loadTestFile(require.resolve('./suggest_user_profiles')); }); } diff --git a/x-pack/test/api_integration/apis/cases/privileges.ts b/x-pack/test/api_integration/apis/cases/privileges.ts index 7279e89c9b167..f2e2732a93935 100644 --- a/x-pack/test/api_integration/apis/cases/privileges.ts +++ b/x-pack/test/api_integration/apis/cases/privileges.ts @@ -10,10 +10,6 @@ import { APP_ID as CASES_APP_ID } from '@kbn/cases-plugin/common/constants'; import { APP_ID as SECURITY_SOLUTION_APP_ID } from '@kbn/security-solution-plugin/common/constants'; import { observabilityFeatureId as OBSERVABILITY_APP_ID } from '@kbn/observability-plugin/common'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { - createUsersAndRoles, - deleteUsersAndRoles, -} from '../../../cases_api_integration/common/lib/authentication'; import { createCase, @@ -37,9 +33,7 @@ import { secReadCasesNoneUser, secReadCasesReadUser, secReadUser, - users, } from './common/users'; -import { roles } from './common/roles'; import { getPostCaseRequest } from '../../../cases_api_integration/common/lib/mock'; export default ({ getService }: FtrProviderContext): void => { @@ -48,14 +42,6 @@ export default ({ getService }: FtrProviderContext): void => { const supertestWithoutAuth = getService('supertestWithoutAuth'); const supertest = getService('supertest'); - before(async () => { - await createUsersAndRoles(getService, users, roles); - }); - - after(async () => { - await deleteUsersAndRoles(getService, users, roles); - }); - afterEach(async () => { await deleteAllCaseItems(es); }); diff --git a/x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts b/x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts new file mode 100644 index 0000000000000..72680ef786e9e --- /dev/null +++ b/x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts @@ -0,0 +1,72 @@ +/* + * 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 expect from '@kbn/expect'; +import { APP_ID as CASES_APP_ID } from '@kbn/cases-plugin/common/constants'; +import { APP_ID as SECURITY_SOLUTION_APP_ID } from '@kbn/security-solution-plugin/common/constants'; +import { observabilityFeatureId as OBSERVABILITY_APP_ID } from '@kbn/observability-plugin/common'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +import { + deleteAllCaseItems, + suggestUserProfiles, +} from '../../../cases_api_integration/common/lib/utils'; +import { + casesAllUser, + casesOnlyDeleteUser, + obsCasesAllUser, + obsCasesOnlyDeleteUser, + secAllCasesReadUser, + secAllUser, +} from './common/users'; + +export default ({ getService }: FtrProviderContext): void => { + describe('suggest_user_profiles', () => { + const es = getService('es'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + + afterEach(async () => { + await deleteAllCaseItems(es); + }); + + for (const { user, owner } of [ + { user: secAllUser, owner: SECURITY_SOLUTION_APP_ID }, + { user: casesAllUser, owner: CASES_APP_ID }, + { user: obsCasesAllUser, owner: OBSERVABILITY_APP_ID }, + ]) { + it(`User ${ + user.username + } with roles(s) ${user.roles.join()} can retrieve user profile suggestions`, async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { name: user.username, owners: [owner], size: 1 }, + auth: { user, space: null }, + }); + + expect(profiles.length).to.be(1); + expect(profiles[0].user.username).to.eql(user.username); + }); + } + + for (const { user, owner } of [ + { user: secAllCasesReadUser, owner: SECURITY_SOLUTION_APP_ID }, + { user: casesOnlyDeleteUser, owner: CASES_APP_ID }, + { user: obsCasesOnlyDeleteUser, owner: OBSERVABILITY_APP_ID }, + ]) { + it(`User ${ + user.username + } with role(s) ${user.roles.join()} cannot retrieve user profile suggestions because they lack privileges`, async () => { + await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { name: user.username, owners: [owner] }, + auth: { user, space: null }, + expectedHttpCode: 403, + }); + }); + } + }); +}; diff --git a/x-pack/test/cases_api_integration/common/fixtures/plugins/observability/server/plugin.ts b/x-pack/test/cases_api_integration/common/fixtures/plugins/observability/server/plugin.ts index 83ec0812264bb..9dcdc8a26af0e 100644 --- a/x-pack/test/cases_api_integration/common/fixtures/plugins/observability/server/plugin.ts +++ b/x-pack/test/cases_api_integration/common/fixtures/plugins/observability/server/plugin.ts @@ -31,6 +31,7 @@ export class FixturePlugin implements Plugin, unknown>, id: string ) => esResponse.body._source?.references?.find((r) => r.id === id); + +export const suggestUserProfiles = async ({ + supertest, + req, + expectedHttpCode = 200, + auth = { user: superUser, space: null }, +}: { + supertest: SuperTest.SuperTest; + req: SuggestUserProfilesRequest; + expectedHttpCode?: number; + auth?: { user: User; space: string | null }; +}): ReturnType => { + const { body: profiles } = await supertest + .post(`${getSpaceUrlPrefix(auth.space)}${INTERNAL_SUGGEST_USER_PROFILES_URL}`) + .auth(auth.user.username, auth.user.password) + .set('kbn-xsrf', 'true') + .send(req) + .expect(expectedHttpCode); + + return profiles; +}; + +export const loginUsers = async ({ + supertest, + users = [superUser], +}: { + supertest: SuperTest.SuperTest; + users?: User[]; +}) => { + for (const user of users) { + await supertest + .post('/internal/security/login') + .set('kbn-xsrf', 'xxx') + .send({ + providerType: 'basic', + providerName: 'basic', + currentURL: '/', + params: { username: user.username, password: user.password }, + }) + .expect(200); + } +}; diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/index.ts b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/index.ts index 4b709998f1a2e..5de45ed0869c9 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/index.ts +++ b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/index.ts @@ -44,6 +44,7 @@ export default ({ loadTestFile }: FtrProviderContext): void => { */ loadTestFile(require.resolve('./internal/bulk_create_attachments')); + loadTestFile(require.resolve('./internal/suggest_user_profiles')); /** * Attachments framework diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/suggest_user_profiles.ts b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/suggest_user_profiles.ts new file mode 100644 index 0000000000000..31dc298f92be1 --- /dev/null +++ b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/suggest_user_profiles.ts @@ -0,0 +1,381 @@ +/* + * 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 expect from '@kbn/expect'; +import { loginUsers, suggestUserProfiles } from '../../../../common/lib/utils'; +import { FtrProviderContext } from '../../../../common/ftr_provider_context'; +import { + secOnly, + superUser, + secOnlyNoDelete, + secOnlyRead, + obsOnly, + noCasesPrivilegesSpace1, +} from '../../../../common/lib/authentication/users'; +import { Role, User } from '../../../../common/lib/authentication/types'; +import { createUsersAndRoles, deleteUsersAndRoles } from '../../../../common/lib/authentication'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService }: FtrProviderContext) { + const supertestWithoutAuth = getService('supertestWithoutAuth'); + + describe('suggest_user_profiles', () => { + before(async () => { + await loginUsers({ + supertest: supertestWithoutAuth, + users: [secOnly, secOnlyNoDelete, secOnlyRead, obsOnly], + }); + }); + + it('finds the profile for the user without deletion privileges', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'delete', + owners: ['securitySolutionFixture'], + }, + auth: { user: superUser, space: 'space1' }, + }); + + expectSnapshot(profiles.map(({ user, data }) => ({ user, data }))).toMatchInline(` + Array [ + Object { + "data": Object {}, + "user": Object { + "email": "sec_only_no_delete@elastic.co", + "full_name": "sec only_no_delete", + "username": "sec_only_no_delete", + }, + }, + ] + `); + }); + + it('does not find a user who does not have access to the default space', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'delete', + owners: ['securitySolutionFixture'], + }, + auth: { user: superUser, space: null }, + }); + + expect(profiles).to.be.empty(); + }); + + it('does not find a user who does not have access to the securitySolutionFixture owner', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'only', + owners: ['securitySolutionFixture'], + }, + auth: { user: superUser, space: 'space1' }, + }); + + // ensure that the returned profiles doesn't include the obsOnly user + expect(profiles.filter(({ user }) => user.username === obsOnly.username)).to.be.empty(); + expectSnapshot(profiles.map(({ user, data }) => ({ user, data }))).toMatchInline(` + Array [ + Object { + "data": Object {}, + "user": Object { + "email": "sec_only_no_delete@elastic.co", + "full_name": "sec only_no_delete", + "username": "sec_only_no_delete", + }, + }, + Object { + "data": Object {}, + "user": Object { + "email": "sec_only@elastic.co", + "full_name": "sec only", + "username": "sec_only", + }, + }, + ] + `); + }); + + it('does not find a user who does not have update privileges to cases', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'read', + owners: ['securitySolutionFixture'], + }, + auth: { user: superUser, space: 'space1' }, + }); + + expect(profiles).to.be.empty(); + }); + + it('fails with a 403 because the user making the request does not have the appropriate api kibana endpoint privileges', async () => { + await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'delete', + owners: ['securitySolutionFixture'], + }, + auth: { user: noCasesPrivilegesSpace1, space: 'space1' }, + expectedHttpCode: 403, + }); + }); + + it('returns no profiles for an owner that does not exist', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'read', + owners: ['invalidOwner'], + }, + auth: { user: superUser, space: null }, + }); + + expect(profiles).to.be.empty(); + }); + + it('returns a 400 if size is greater than 100', async () => { + await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'blah', + owners: ['securitySolutionFixture'], + size: 101, + }, + auth: { user: superUser, space: 'space1' }, + expectedHttpCode: 400, + }); + }); + + it('returns a 400 if size is less than 0', async () => { + await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'blah', + owners: ['securitySolutionFixture'], + size: -1, + }, + auth: { user: superUser, space: 'space1' }, + expectedHttpCode: 400, + }); + }); + + it('limits the results to one, when the size is specified as one', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'only', + owners: ['securitySolutionFixture'], + size: 1, + }, + auth: { user: superUser, space: 'space1' }, + }); + + expect(profiles.length).to.be(1); + expectSnapshot(profiles.map(({ user, data }) => ({ user, data }))).toMatchInline(` + Array [ + Object { + "data": Object {}, + "user": Object { + "email": "sec_only_no_delete@elastic.co", + "full_name": "sec only_no_delete", + "username": "sec_only_no_delete", + }, + }, + ] + `); + }); + + describe('user with both security and observability privileges', () => { + const obsAndSecRole: Role = { + name: 'obsAndSecRole', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + securitySolutionFixture: ['all'], + observabilityFixture: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['space1'], + }, + ], + }, + }; + + const obsAndSecUser: User = { + username: 'obs_and_sec_user', + password: 'obs_and_sec_user', + roles: [obsAndSecRole.name], + }; + + const users = [obsAndSecUser]; + const roles = [obsAndSecRole]; + + before(async () => { + await createUsersAndRoles(getService, users, roles); + await loginUsers({ + supertest: supertestWithoutAuth, + users, + }); + }); + + after(async () => { + await deleteUsersAndRoles(getService, users, roles); + }); + + it('finds 3 profiles when searching for the name sec when a user has both security and observability privileges', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'sec', + owners: ['securitySolutionFixture'], + }, + auth: { user: superUser, space: 'space1' }, + }); + + expectSnapshot(profiles.map(({ user, data }) => ({ user, data }))).toMatchInline(` + Array [ + Object { + "data": Object {}, + "user": Object { + "email": "sec_only_no_delete@elastic.co", + "full_name": "sec only_no_delete", + "username": "sec_only_no_delete", + }, + }, + Object { + "data": Object {}, + "user": Object { + "email": "obs_and_sec_user@elastic.co", + "full_name": "obs and_sec_user", + "username": "obs_and_sec_user", + }, + }, + Object { + "data": Object {}, + "user": Object { + "email": "sec_only@elastic.co", + "full_name": "sec only", + "username": "sec_only", + }, + }, + ] + `); + }); + }); + + const deletedUserRole: Role = { + name: 'deleted_user_sec_all_role', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + securitySolutionFixture: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['space1'], + }, + ], + }, + }; + + const deletedUser: User = { + username: 'deletedUserSecAll', + password: 'deletedUserSecAll', + roles: [deletedUserRole.name], + }; + + const users = [deletedUser]; + const roles = [deletedUserRole]; + + describe('deleted user', () => { + before(async () => { + await createUsersAndRoles(getService, users, roles); + await loginUsers({ + supertest: supertestWithoutAuth, + users, + }); + + // don't delete the role + await deleteUsersAndRoles(getService, users, []); + }); + + after(async () => { + await deleteUsersAndRoles(getService, [], roles); + }); + + it('finds the profile for a user who was deleted', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'deletedUserSecAll', + owners: ['securitySolutionFixture'], + }, + auth: { user: superUser, space: 'space1' }, + }); + + expectSnapshot(profiles.map(({ user, data }) => ({ user, data }))).toMatchInline(` + Array [ + Object { + "data": Object {}, + "user": Object { + "email": "deletedUserSecAll@elastic.co", + "full_name": "deletedUserSecAll", + "username": "deletedUserSecAll", + }, + }, + ] + `); + }); + }); + + describe('deleted user and role', () => { + before(async () => { + await createUsersAndRoles(getService, users, roles); + await loginUsers({ + supertest: supertestWithoutAuth, + users, + }); + await deleteUsersAndRoles(getService, users, roles); + }); + + it('does not find the profile for a deleted user and role', async () => { + const profiles = await suggestUserProfiles({ + supertest: supertestWithoutAuth, + req: { + name: 'deletedUserSecAll', + owners: ['securitySolutionFixture'], + }, + auth: { user: superUser, space: 'space1' }, + }); + + expect(profiles).to.be.empty(); + }); + }); + }); +} diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/index.ts b/x-pack/test/cases_api_integration/spaces_only/tests/common/index.ts index a180d46d45edb..81da0454f48a4 100644 --- a/x-pack/test/cases_api_integration/spaces_only/tests/common/index.ts +++ b/x-pack/test/cases_api_integration/spaces_only/tests/common/index.ts @@ -36,5 +36,6 @@ export default ({ loadTestFile }: FtrProviderContext): void => { * Internal routes */ loadTestFile(require.resolve('./internal/bulk_create_attachments')); + loadTestFile(require.resolve('./internal/suggest_user_profiles')); }); }; diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts b/x-pack/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts new file mode 100644 index 0000000000000..44245f9b10e12 --- /dev/null +++ b/x-pack/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts @@ -0,0 +1,29 @@ +/* + * 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 expect from '@kbn/expect'; +import { suggestUserProfiles } from '../../../../common/lib/utils'; +import { FtrProviderContext } from '../../../../common/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function ({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + + describe('suggest_user_profiles', () => { + it('returns an empty array when the security plugin is disabled', async () => { + const profiles = await suggestUserProfiles({ + supertest, + req: { + name: 'jon', + owners: ['securitySolutionFixture'], + }, + }); + + expect(profiles).to.be.empty(); + }); + }); +} From 5b4148e2b0fc4b890dd319b2fabe4197c5aba64a Mon Sep 17 00:00:00 2001 From: Julia Bardi <90178898+juliaElastic@users.noreply.github.com> Date: Tue, 2 Aug 2022 17:55:14 +0200 Subject: [PATCH 04/21] [Fleet] updated openapi spec for bulk actions (#137860) * updated openapi spec for bulk actions * added examples and more description --- .../plugins/fleet/common/openapi/bundled.json | 79 +++++++++++++++---- .../plugins/fleet/common/openapi/bundled.yaml | 42 +++++++++- .../schemas/bulk_upgrade_agents.yaml | 8 +- .../openapi/paths/agents@bulk_reassign.yaml | 6 ++ .../openapi/paths/agents@bulk_unenroll.yaml | 8 ++ .../paths/agents@bulk_update_tags.yaml | 6 +- .../openapi/paths/agents@bulk_upgrade.yaml | 6 ++ 7 files changed, 135 insertions(+), 20 deletions(-) diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json index c0df16457d635..357ceb3192e6f 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.json +++ b/x-pack/plugins/fleet/common/openapi/bundled.json @@ -1273,6 +1273,16 @@ "application/json": { "schema": { "$ref": "#/components/schemas/bulk_upgrade_agents" + }, + "example": { + "version": "8.4.0", + "source_uri": "https://artifacts.elastic.co/downloads/beats/elastic-agent", + "rollout_duration_seconds": 3600, + "agents": [ + "agent1", + "agent2" + ], + "start_time": "2022-08-03T14:00:00.000Z" } } } @@ -1745,18 +1755,21 @@ "type": "object", "properties": { "policy_id": { - "type": "string" + "type": "string", + "description": "new agent policy id" }, "agents": { "oneOf": [ { - "type": "string" + "type": "string", + "description": "KQL query string, leave empty to action all agents" }, { "type": "array", "items": { "type": "string" - } + }, + "description": "list of agent IDs" } ] } @@ -1765,6 +1778,10 @@ "policy_id", "agents" ] + }, + "example": { + "policy_id": "policy_id", + "agents": "fleet-agents.policy_id : (\"policy1\" or \"policy2\")" } } } @@ -1814,21 +1831,25 @@ "type": "object", "properties": { "revoke": { - "type": "boolean" + "type": "boolean", + "description": "Revokes API keys of agents" }, "force": { - "type": "boolean" + "type": "boolean", + "description": "Unenroll hosted agents too" }, "agents": { "oneOf": [ { - "type": "string" + "type": "string", + "description": "KQL query string, leave empty to action all agents" }, { "type": "array", "items": { "type": "string" - } + }, + "description": "list of agent IDs" } ] } @@ -1836,6 +1857,14 @@ "required": [ "agents" ] + }, + "example": { + "revoke": true, + "force": false, + "agents": [ + "agent1", + "agent2" + ] } } } @@ -1888,7 +1917,7 @@ "oneOf": [ { "type": "string", - "description": "KQL query string, can be empty" + "description": "KQL query string, leave empty to action all agents" }, { "type": "array", @@ -1918,6 +1947,18 @@ "required": [ "agents" ] + }, + "example": { + "agents": [ + "agent1", + "agent2" + ], + "tagsToAdd": [ + "newTag" + ], + "tagsToRemove": [ + "existingTag" + ] } } } @@ -4236,27 +4277,33 @@ "type": "object", "properties": { "version": { - "type": "string" + "type": "string", + "description": "version to upgrade to" }, "source_uri": { - "type": "string" + "type": "string", + "description": "alternative upgrade binary download url" }, "rollout_duration_seconds": { - "type": "number" + "type": "number", + "description": "rolling upgrade window duration in seconds" }, "start_time": { - "type": "string" + "type": "string", + "description": "start time of upgrade in ISO 8601 format" }, "agents": { "oneOf": [ + { + "type": "string", + "description": "KQL query string, leave empty to action all agents" + }, { "type": "array", "items": { "type": "string" - } - }, - { - "type": "string" + }, + "description": "list of agent IDs" } ] } diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml index 569443bf19716..b902f130b2e18 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.yaml +++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml @@ -782,6 +782,14 @@ paths: application/json: schema: $ref: '#/components/schemas/bulk_upgrade_agents' + example: + version: 8.4.0 + source_uri: https://artifacts.elastic.co/downloads/beats/elastic-agent + rollout_duration_seconds: 3600 + agents: + - agent1 + - agent2 + start_time: '2022-08-03T14:00:00.000Z' /agents/current_upgrades: get: summary: Agents - Current Bulk Upgrades @@ -1072,15 +1080,21 @@ paths: properties: policy_id: type: string + description: new agent policy id agents: oneOf: - type: string + description: KQL query string, leave empty to action all agents - type: array items: type: string + description: list of agent IDs required: - policy_id - agents + example: + policy_id: policy_id + agents: 'fleet-agents.policy_id : ("policy1" or "policy2")' /agents/bulk_unenroll: post: summary: Agents - Bulk unenroll @@ -1112,16 +1126,26 @@ paths: properties: revoke: type: boolean + description: Revokes API keys of agents force: type: boolean + description: Unenroll hosted agents too agents: oneOf: - type: string + description: KQL query string, leave empty to action all agents - type: array items: type: string + description: list of agent IDs required: - agents + example: + revoke: true + force: false + agents: + - agent1 + - agent2 /agents/bulk_update_agent_tags: post: summary: Agents - Bulk update tags @@ -1154,7 +1178,7 @@ paths: agents: oneOf: - type: string - description: KQL query string, can be empty + description: KQL query string, leave empty to action all agents - type: array items: type: string @@ -1171,6 +1195,14 @@ paths: type: number required: - agents + example: + agents: + - agent1 + - agent2 + tagsToAdd: + - newTag + tagsToRemove: + - existingTag /agents/tags: get: summary: Agent Tags - List @@ -2666,18 +2698,24 @@ components: properties: version: type: string + description: version to upgrade to source_uri: type: string + description: alternative upgrade binary download url rollout_duration_seconds: type: number + description: rolling upgrade window duration in seconds start_time: type: string + description: start time of upgrade in ISO 8601 format agents: oneOf: + - type: string + description: KQL query string, leave empty to action all agents - type: array items: type: string - - type: string + description: list of agent IDs required: - agents - version diff --git a/x-pack/plugins/fleet/common/openapi/components/schemas/bulk_upgrade_agents.yaml b/x-pack/plugins/fleet/common/openapi/components/schemas/bulk_upgrade_agents.yaml index 55373ba2f2d70..0fcd93da6f61a 100644 --- a/x-pack/plugins/fleet/common/openapi/components/schemas/bulk_upgrade_agents.yaml +++ b/x-pack/plugins/fleet/common/openapi/components/schemas/bulk_upgrade_agents.yaml @@ -3,18 +3,24 @@ type: object properties: version: type: string + description: version to upgrade to source_uri: type: string + description: alternative upgrade binary download url rollout_duration_seconds: type: number + description: rolling upgrade window duration in seconds start_time: type: string + description: start time of upgrade in ISO 8601 format agents: oneOf: + - type: string + description: KQL query string, leave empty to action all agents - type: array items: type: string - - type: string + description: list of agent IDs required: - agents - version diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml index a7d70f747cf92..df2f8c0c4c2f2 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml @@ -28,12 +28,18 @@ post: properties: policy_id: type: string + description: new agent policy id agents: oneOf: - type: string + description: KQL query string, leave empty to action all agents - type: array items: type: string + description: list of agent IDs required: - policy_id - agents + example: + policy_id: policy_id + agents: "fleet-agents.policy_id : (\"policy1\" or \"policy2\")" diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml index 55b10def7da7f..c77adc8571973 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml @@ -28,13 +28,21 @@ post: properties: revoke: type: boolean + description: Revokes API keys of agents force: type: boolean + description: Unenroll hosted agents too agents: oneOf: - type: string + description: KQL query string, leave empty to action all agents - type: array items: type: string + description: list of agent IDs required: - agents + example: + revoke: true + force: false + agents: [agent1, agent2] diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml index a8e2de0913a41..d2a5f8a3f3e69 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml @@ -29,7 +29,7 @@ post: agents: oneOf: - type: string - description: KQL query string, can be empty + description: KQL query string, leave empty to action all agents - type: array items: type: string @@ -46,3 +46,7 @@ post: type: number required: - agents + example: + agents: [agent1, agent2] + tagsToAdd: [newTag] + tagsToRemove: [existingTag] diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml index 1467d1f98aa22..dca02df27e7b3 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml @@ -32,3 +32,9 @@ post: application/json: schema: $ref: ../components/schemas/bulk_upgrade_agents.yaml + example: + version: 8.4.0 + source_uri: https://artifacts.elastic.co/downloads/beats/elastic-agent + rollout_duration_seconds: 3600 + agents: [agent1, agent2] + start_time: 2022-08-03T14:00:00.000Z From d279696bc7892eb443f95387cb96d7c5962a5ab3 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 2 Aug 2022 12:00:19 -0400 Subject: [PATCH 05/21] [artifacts] Fix deployment termination on error (#137771) * [artifacts] Fix deployment termination on error * fix conditional --- .buildkite/scripts/steps/artifacts/cloud.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.buildkite/scripts/steps/artifacts/cloud.sh b/.buildkite/scripts/steps/artifacts/cloud.sh index 7088228bd9030..d2d5785093f1e 100644 --- a/.buildkite/scripts/steps/artifacts/cloud.sh +++ b/.buildkite/scripts/steps/artifacts/cloud.sh @@ -50,7 +50,17 @@ jq ' .resources.integrations_server[0].plan.integrations_server.version = "'$FULL_VERSION'" ' .buildkite/scripts/steps/cloud/deploy.json > "$DEPLOYMENT_SPEC" -ecctl deployment create --track --output json --file "$DEPLOYMENT_SPEC" &> "$LOGS" +function shutdown { + echo "--- Shutdown deployment" + # Re-fetch the deployment ID - if there's an error during creation the ID may not be set + CLOUD_DEPLOYMENT_ID=$(ecctl deployment list --output json | jq -r '.deployments[] | select(.name == "'$CLOUD_DEPLOYMENT_NAME'") | .id') + if [ -n "${CLOUD_DEPLOYMENT_ID}" ]; then + ecctl deployment shutdown "$CLOUD_DEPLOYMENT_ID" --force --track --output json > "$LOGS" + fi +} +trap "shutdown" EXIT + +ecctl deployment create --track --output json --file "$DEPLOYMENT_SPEC" > "$LOGS" CLOUD_DEPLOYMENT_USERNAME=$(jq -r --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.username' "$LOGS") CLOUD_DEPLOYMENT_PASSWORD=$(jq -r --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.password' "$LOGS") CLOUD_DEPLOYMENT_ID=$(jq -r --slurp '.[0].id' "$LOGS") @@ -62,12 +72,6 @@ export CLOUD_DEPLOYMENT_ELASTICSEARCH_URL=$(ecctl deployment show "$CLOUD_DEPLOY echo "Kibana: $CLOUD_DEPLOYMENT_KIBANA_URL" echo "ES: $CLOUD_DEPLOYMENT_ELASTICSEARCH_URL" -function shutdown { - echo "--- Shutdown deployment" - ecctl deployment shutdown "$CLOUD_DEPLOYMENT_ID" --force --track --output json &> "$LOGS" -} -trap "shutdown" EXIT - export TEST_KIBANA_PROTOCOL=$(node -e "console.log(new URL(process.env.CLOUD_DEPLOYMENT_KIBANA_URL).protocol.replace(':', ''))") export TEST_KIBANA_HOSTNAME=$(node -e "console.log(new URL(process.env.CLOUD_DEPLOYMENT_KIBANA_URL).hostname)") export TEST_KIBANA_PORT=$(node -e "console.log(new URL(process.env.CLOUD_DEPLOYMENT_KIBANA_URL).port || 443)") From 8edde863377e7f7f54a42a09782cca3a39e7ea00 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Tue, 2 Aug 2022 18:05:13 +0200 Subject: [PATCH 06/21] [ML] Fix check for time field based data view. (#137784) Fixes the check to allow only data views with time fields for the Explain Log Rate Spikes UI. Previously the check was done on an outer component and didn't reach the component that would display an error message, the user ended up with an empty page. Instead of a non-working UI and an error message in a toast, this now hides the entire UI and just displays an error callout component. --- .../explain_log_rate_spikes_app_state.tsx | 52 +++++++++---------- .../aiops/explain_log_rate_spikes.tsx | 4 +- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_app_state.tsx b/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_app_state.tsx index e3c01c3026c7d..56135d4eb7b73 100644 --- a/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_app_state.tsx +++ b/x-pack/plugins/aiops/public/components/explain_log_rate_spikes/explain_log_rate_spikes_app_state.tsx @@ -5,15 +5,18 @@ * 2.0. */ -import React, { FC, useCallback, useEffect } from 'react'; -import { Filter, Query } from '@kbn/es-query'; -import { i18n } from '@kbn/i18n'; +import React, { FC, useCallback } from 'react'; import { parse, stringify } from 'query-string'; import { isEqual } from 'lodash'; import { encode } from 'rison-node'; import { useHistory, useLocation } from 'react-router-dom'; -import { SavedSearch } from '@kbn/discover-plugin/public'; +import { EuiCallOut } from '@elastic/eui'; + +import type { Filter, Query } from '@kbn/es-query'; +import { i18n } from '@kbn/i18n'; + +import type { SavedSearch } from '@kbn/discover-plugin/public'; import type { DataView } from '@kbn/data-views-plugin/public'; import { @@ -21,7 +24,6 @@ import { SearchQueryLanguage, SavedSearchSavedObject, } from '../../application/utils/search_utils'; -import { useAiOpsKibana } from '../../kibana_context'; import { Accessor, Dictionary, @@ -68,30 +70,9 @@ export const ExplainLogRateSpikesAppState: FC dataView, savedSearch, }) => { - const { services } = useAiOpsKibana(); - const { notifications } = services; - const { toasts } = notifications; - const history = useHistory(); const { search: urlSearchString } = useLocation(); - useEffect(() => { - if (!dataView.isTimeBased()) { - toasts.addWarning({ - title: i18n.translate('xpack.aiops.index.dataViewNotBasedOnTimeSeriesNotificationTitle', { - defaultMessage: 'The data view {dataViewTitle} is not based on a time series', - values: { dataViewTitle: dataView.title }, - }), - text: i18n.translate( - 'xpack.aiops.index.dataViewNotBasedOnTimeSeriesNotificationDescription', - { - defaultMessage: 'Log rate spike analysis only runs over time-based indices', - } - ), - }); - } - }, [dataView, toasts]); - const setUrlState: SetUrlState = useCallback( ( accessor: Accessor, @@ -156,6 +137,25 @@ export const ExplainLogRateSpikesAppState: FC if (!dataView) return null; + if (!dataView.isTimeBased()) { + return ( + +

+ {i18n.translate('xpack.aiops.index.dataViewNotBasedOnTimeSeriesNotificationDescription', { + defaultMessage: 'Log rate spike analysis only runs over time-based indices.', + })} +

+ + ); + } + return ( diff --git a/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx b/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx index 7ab537fc26d81..5d9a7fd3a8416 100644 --- a/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx +++ b/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx @@ -43,9 +43,7 @@ export const ExplainLogRateSpikesPage: FC = () => {
- {dataView.timeFieldName && ( - - )} + {dataView && } ); From d6c1ca0a5d4f220c49ae4f77b996de2366d5afd6 Mon Sep 17 00:00:00 2001 From: "Christiane (Tina) Heiligers" Date: Tue, 2 Aug 2022 09:10:25 -0700 Subject: [PATCH 07/21] Migrates use_bulk_actions mountReactNode to toMountPoint (#137637) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../rules/all/bulk_actions/use_bulk_actions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/bulk_actions/use_bulk_actions.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/bulk_actions/use_bulk_actions.tsx index 694df32a97d09..9c5383dc1a693 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/bulk_actions/use_bulk_actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/bulk_actions/use_bulk_actions.tsx @@ -13,7 +13,7 @@ import { euiThemeVars } from '@kbn/ui-theme'; import { useIsMounted } from '@kbn/securitysolution-hook-utils'; import type { Toast } from '@kbn/core/public'; -import { mountReactNode } from '@kbn/core/public/utils'; +import { toMountPoint } from '@kbn/kibana-react-plugin/public'; import type { BulkActionEditPayload } from '../../../../../../../common/detection_engine/schemas/common/schemas'; import { BulkAction, @@ -274,7 +274,7 @@ export const useBulkActions = ({ longTimeWarningToast = toasts.addWarning( { title: i18n.BULK_EDIT_WARNING_TOAST_TITLE, - text: mountReactNode( + text: toMountPoint( <>

{i18n.BULK_EDIT_WARNING_TOAST_DESCRIPTION( From 22b21645bb881aebb742f64576d1056d1b6903fb Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 2 Aug 2022 12:24:01 -0400 Subject: [PATCH 08/21] [ci] Conditional storybook builds (#136219) * [ci] Conditional storybook builds This moves storybook builds to run conditionally, either if there's a storybook change or the `ci:build-storybooks` label is set. These builds don't seem to be providing test coverage, and may not be utilized in scenarios such as automated backports or unrelated changes. * test regex * formatting * Revert "test regex" This reverts commit dcef465414f8697fa7160c1e97b31d66a60e3304. * fix revert * move to spot instance * fix merge --- .buildkite/pipelines/pull_request/base.yml | 7 ------- .buildkite/pipelines/pull_request/storybooks.yml | 7 +++++++ .buildkite/scripts/pipelines/pull_request/pipeline.ts | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 .buildkite/pipelines/pull_request/storybooks.yml diff --git a/.buildkite/pipelines/pull_request/base.yml b/.buildkite/pipelines/pull_request/base.yml index 43b019f936d83..db42cc4c7293c 100644 --- a/.buildkite/pipelines/pull_request/base.yml +++ b/.buildkite/pipelines/pull_request/base.yml @@ -62,13 +62,6 @@ steps: queue: c2-8 timeout_in_minutes: 60 - - command: .buildkite/scripts/steps/storybooks/build_and_upload.sh - label: 'Build Storybooks' - agents: - queue: c2-4 - key: storybooks - timeout_in_minutes: 60 - - command: .buildkite/scripts/steps/build_api_docs.sh label: 'Build API Docs' agents: diff --git a/.buildkite/pipelines/pull_request/storybooks.yml b/.buildkite/pipelines/pull_request/storybooks.yml new file mode 100644 index 0000000000000..b62ba60563176 --- /dev/null +++ b/.buildkite/pipelines/pull_request/storybooks.yml @@ -0,0 +1,7 @@ +steps: + - command: .buildkite/scripts/steps/storybooks/build_and_upload.sh + label: 'Build Storybooks' + agents: + queue: n2-4-spot + key: storybooks + timeout_in_minutes: 60 diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 025a8b497c544..c8062a7f8108a 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -126,6 +126,13 @@ const uploadPipeline = (pipelineContent: string | object) => { pipeline.push(getPipeline('.buildkite/pipelines/pull_request/deploy_cloud.yml')); } + if ( + (await doAnyChangesMatch([/.*stor(ies|y).*/])) || + GITHUB_PR_LABELS.includes('ci:build-storybooks') + ) { + pipeline.push(getPipeline('.buildkite/pipelines/pull_request/storybooks.yml')); + } + if (GITHUB_PR_LABELS.includes('ci:build-webpack-bundle-analyzer')) { pipeline.push(getPipeline('.buildkite/pipelines/pull_request/webpack_bundle_analyzer.yml')); } From 876a433b21716dfeef11c0b7f3aeca7fb1e44b1f Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Tue, 2 Aug 2022 09:37:03 -0700 Subject: [PATCH 09/21] [Reporting] Eliminate request timeout errors in functional test (#136896) * unskip flaky test * [Reporting] Narrow in on skipped usage counters test * add try/catch --- .../usage/api_counters.ts | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/usage/api_counters.ts b/x-pack/test/reporting_api_integration/reporting_and_security/usage/api_counters.ts index e0c918648be9e..b3b90fcd9c5a3 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/usage/api_counters.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/usage/api_counters.ts @@ -11,14 +11,14 @@ import { FtrProviderContext } from '../../ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default function ({ getService }: FtrProviderContext) { + const log = getService('log'); const supertest = getService('supertest'); const supertestUnauth = getService('supertestWithoutAuth'); const esArchiver = getService('esArchiver'); const usageAPI = getService('usageAPI'); const reportingAPI = getService('reportingAPI'); - // Failing: See https://github.com/elastic/kibana/issues/134517 - describe.skip(`Usage Counters`, () => { + describe(`Usage Counters`, () => { before(async () => { await esArchiver.emptyKibanaIndex(); await reportingAPI.initEcommerce(); @@ -92,39 +92,53 @@ export default function ({ getService }: FtrProviderContext) { }); it('downloading', async () => { - await supertestUnauth - .get('/api/reporting/jobs/download/kraz0qle154g0763b569zz83') - .auth('test_user', 'changeme'); - await supertestUnauth - .get('/api/reporting/jobs/download/kraz0vj4154g0763b5curq51') - .auth('test_user', 'changeme'); - await supertestUnauth - .get('/api/reporting/jobs/download/k9a9rq1i0gpe1457b17s7yc6') - .auth('test_user', 'changeme'); + try { + await Promise.all([ + supertestUnauth + .get('/api/reporting/jobs/download/kraz0qle154g0763b569zz83') + .auth('test_user', 'changeme'), + supertestUnauth + .get('/api/reporting/jobs/download/kraz0vj4154g0763b5curq51') + .auth('test_user', 'changeme'), + supertestUnauth + .get('/api/reporting/jobs/download/k9a9rq1i0gpe1457b17s7yc6') + .auth('test_user', 'changeme'), + ]); + } catch (error) { + log.error(error); + } + log.info(`waiting on internal stats aggregation...`); await waitOnAggregation(); + log.info(`waiting on aggregation completed.`); + log.info(`calling getUsageStats...`); expect( getUsageCount(await usageAPI.getUsageStats(), `get /api/reporting/jobs/download/{docId}`) ).to.be(3); }); it('deleting', async () => { - await supertestUnauth - .delete('/api/reporting/jobs/delete/krazcyw4156m0763b503j7f9') - .auth('test_user', 'changeme') - .set('kbn-xsrf', 'xxx'); - - await supertestUnauth - .delete('/api/reporting/jobs/delete/krazaxch156m0763b5bf81ov') - .auth('test_user', 'changeme') - .set('kbn-xsrf', 'xxx'); + log.info(`sending 1 delete request...`); + + try { + await supertestUnauth + .delete('/api/reporting/jobs/delete/krazcyw4156m0763b503j7f9') + .auth('test_user', 'changeme') + .set('kbn-xsrf', 'xxx'); + } catch (error) { + log.error(error); + } + log.info(`delete request completed.`); + log.info(`waiting on internal stats aggregation...`); await waitOnAggregation(); + log.info(`waiting on aggregation completed.`); + log.info(`calling getUsageStats...`); expect( getUsageCount(await usageAPI.getUsageStats(), `delete /api/reporting/jobs/delete/{docId}`) - ).to.be(2); + ).to.be(1); }); }); From c392bf19b0c6db0b54be06baea7c3d4d00d45153 Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Tue, 2 Aug 2022 09:37:33 -0700 Subject: [PATCH 10/21] [Reporting] Improve API tests, reveal cause of test failure (#137543) --- .../reporting_and_security/error_codes.ts | 18 ++++++++++++++++++ .../services/usage.ts | 12 +++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/error_codes.ts b/x-pack/test/reporting_api_integration/reporting_and_security/error_codes.ts index 5051b74c6e8d1..9f0d6ebb15c3e 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/error_codes.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/error_codes.ts @@ -12,6 +12,8 @@ import { FtrProviderContext } from '../ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default function ({ getService }: FtrProviderContext) { const reportingAPI = getService('reportingAPI'); + const esArchiver = getService('esArchiver'); + const supertest = getService('supertestWithoutAuth'); describe('Reporting error codes', () => { it('places error_code in report output', async () => { @@ -39,5 +41,21 @@ export default function ({ getService }: FtrProviderContext) { await reportingAPI.teardownEcommerce(); await reportingAPI.deleteAllReports(); }); + + it('adds warning text with cause of failure in report output', async () => { + await reportingAPI.createDataAnalystRole(); + await reportingAPI.createDataAnalyst(); + await esArchiver.load('x-pack/test/functional/es_archives/reporting/archived_reports'); + + const jobInfo = await supertest + .get('/api/reporting/jobs/info/kraz4j94154g0763b583rc37') + .auth('test_user', 'changeme'); + + expect(jobInfo.body.output.warnings).to.eql([ + 'Error: Max attempts reached (1). Queue timeout reached.', + ]); + + await esArchiver.unload('x-pack/test/functional/es_archives/reporting/archived_reports'); + }); }); } diff --git a/x-pack/test/reporting_api_integration/services/usage.ts b/x-pack/test/reporting_api_integration/services/usage.ts index 80204875cd6d6..07c97475421f9 100644 --- a/x-pack/test/reporting_api_integration/services/usage.ts +++ b/x-pack/test/reporting_api_integration/services/usage.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { Response } from 'supertest'; import expect from '@kbn/expect'; import { indexTimestamp } from '@kbn/reporting-plugin/server/lib/store/index_timestamp'; import { @@ -28,16 +29,14 @@ export function createUsageServices({ getService }: FtrProviderContext) { const supertest = getService('supertest'); return { - async waitForJobToFinish(downloadReportPath: string, ignoreFailure?: boolean) { + async waitForJobToFinish(downloadReportPath: string, ignoreFailure = false) { log.debug(`Waiting for job to finish: ${downloadReportPath}`); const JOB_IS_PENDING_CODE = 503; + let response: Response & { statusCode?: number }; const statusCode = await new Promise((resolve) => { const intervalId = setInterval(async () => { - const response = (await supertest - .get(downloadReportPath) - .responseType('blob') - .set('kbn-xsrf', 'xxx')) as any; + response = await supertest.get(downloadReportPath).responseType('blob'); if (response.statusCode === 503) { log.debug(`Report at path ${downloadReportPath} is pending`); } else if (response.statusCode === 200) { @@ -52,6 +51,8 @@ export function createUsageServices({ getService }: FtrProviderContext) { }, 1500); }); if (!ignoreFailure) { + const jobInfo = await supertest.get(downloadReportPath.replace(/download/, 'info')); + expect(jobInfo.body.output.warnings).to.be(undefined); // expect no failure message to be present in job info expect(statusCode).to.be(200); } }, @@ -95,6 +96,7 @@ export function createUsageServices({ getService }: FtrProviderContext) { async expectAllJobsToFinishSuccessfully(jobPaths: string[]) { await Promise.all( jobPaths.map(async (path) => { + log.debug(`wait for job to finish: ${path}`); await this.waitForJobToFinish(path); }) ); From 718fd20c99ca25fc9e75a6e4a664b412ae746b2d Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Tue, 2 Aug 2022 09:42:10 -0700 Subject: [PATCH 11/21] Fix ILM timeline styles. (#137336) --- .../sections/edit_policy/components/phase_icon/phase_icon.scss | 2 +- .../public/application/sections/edit_policy/edit_policy.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_icon/phase_icon.scss b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_icon/phase_icon.scss index 361c5caf37b9a..8519855aeb68f 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_icon/phase_icon.scss +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_icon/phase_icon.scss @@ -9,7 +9,7 @@ &--disabled { width: $euiSize; height: $euiSize; - margin: $euiSizeS 0; + margin: $euiSizeS; } &--delete { background-color: $euiColorLightShade; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.scss b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.scss index 9263db386d012..c0fac36130ef6 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.scss +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.scss @@ -3,5 +3,5 @@ padding-top: $euiSize; } .ilmPhases [class*='euiTimelineItemIcon-top']::before { - top: $euiSizeL; + margin-top: $euiSizeXL; } From 2a4c473fdb7c7da3212cfac302e2850d0cdcb88b Mon Sep 17 00:00:00 2001 From: Kevin Qualters <56408403+kqualters-elastic@users.noreply.github.com> Date: Tue, 2 Aug 2022 13:02:58 -0400 Subject: [PATCH 12/21] [Security Solution] [Analyzer] Use more correct ids from alerts for entity request, clean up some tests (#137370) * Use more correct ids from alerts for entity request, clean up some tests * Fix cypress tests * Remove cypress config change * Update failing cypress tests, address pr comment * Address pr comment in reality * Update cypress data to work with analyzer api * Update alert count in rule tests * Delete commented code --- .../detection_alerts/alert_flyout.spec.ts | 35 +++-- .../event_correlation_rule.spec.ts | 2 +- .../cypress/screens/alerts_details.ts | 4 + .../cypress/screens/date_picker.ts | 9 ++ .../cypress/tasks/alerts_details.ts | 34 +++++ .../cypress/tasks/date_picker.ts | 15 ++- .../event_details/insights/insights.tsx | 37 ++++-- ...elated_alerts_by_process_ancestry.test.tsx | 54 ++++---- .../related_alerts_by_process_ancestry.tsx | 107 +++++++++------ .../table/investigate_in_timeline_button.tsx | 8 +- .../use_alert_prevalence_from_process_tree.ts | 39 ++++-- .../routes/resolver/tree/queries/stats.ts | 5 +- .../test/security_solution_cypress/config.ts | 1 + .../es_archives/auditbeat/data.json | 123 ++++++++++++++++++ 14 files changed, 350 insertions(+), 123 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alert_flyout.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alert_flyout.spec.ts index 6cde2ac1d10eb..7f3eef4015ba2 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alert_flyout.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_alerts/alert_flyout.spec.ts @@ -11,10 +11,14 @@ import { SUMMARY_VIEW_INVESTIGATE_IN_TIMELINE_BUTTON, INSIGHTS_RELATED_ALERTS_BY_SESSION, INSIGHTS_INVESTIGATE_IN_TIMELINE_BUTTON, + INSIGHTS_RELATED_ALERTS_BY_ANCESTRY, + INSIGHTS_INVESTIGATE_ANCESTRY_ALERTS_IN_TIMELINE_BUTTON, } from '../../screens/alerts_details'; import { QUERY_TAB_BUTTON, TIMELINE_TITLE } from '../../screens/timeline'; import { expandFirstAlert } from '../../tasks/alerts'; +import { verifyInsightCount } from '../../tasks/alerts_details'; +import { setStartDate } from '../../tasks/date_picker'; import { closeTimeline } from '../../tasks/timeline'; import { createCustomRuleEnabled } from '../../tasks/api_calls/rules'; import { cleanKibana } from '../../tasks/common'; @@ -31,6 +35,8 @@ describe('Alert Flyout', () => { login(); createCustomRuleEnabled(getNewRule(), 'rule1'); visitWithoutDateRange(ALERTS_URL); + const dateContainingAllEvents = 'Jul 27, 2015 @ 00:00:00.000'; + setStartDate(dateContainingAllEvents); waitForAlertsToPopulate(); expandFirstAlert(); }); @@ -56,25 +62,16 @@ describe('Alert Flyout', () => { }); it('Opens a new timeline investigation (from an insights module)', () => { - cy.get(INSIGHTS_RELATED_ALERTS_BY_SESSION) - .click() - .invoke('text') - .then((relatedAlertsBySessionText) => { - // Extract the count from the text - const alertCount = relatedAlertsBySessionText.match(/(\d)/); - const actualCount = alertCount && alertCount[0]; - - // Make sure we can see the table - cy.contains('New Rule Test').should('be.visible'); - - // Click on the first button that lets us investigate in timeline - cy.get(ALERT_FLYOUT).find(INSIGHTS_INVESTIGATE_IN_TIMELINE_BUTTON).click(); - - // Make sure a new timeline is created and opened - cy.get(TIMELINE_TITLE).should('contain.text', 'Untitled timeline'); + verifyInsightCount({ + tableSelector: INSIGHTS_RELATED_ALERTS_BY_SESSION, + investigateSelector: INSIGHTS_INVESTIGATE_IN_TIMELINE_BUTTON, + }); + }); - // The alert count in this timeline should match the count shown on the alert flyout - cy.get(QUERY_TAB_BUTTON).should('contain.text', actualCount); - }); + it('Opens a new timeline investigation with alert ids from the process ancestry', () => { + verifyInsightCount({ + tableSelector: INSIGHTS_RELATED_ALERTS_BY_ANCESTRY, + investigateSelector: INSIGHTS_INVESTIGATE_ANCESTRY_ALERTS_IN_TIMELINE_BUTTON, + }); }); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/detection_rules/event_correlation_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/detection_rules/event_correlation_rule.spec.ts index 9b3a9c3a74f4e..310efde996da3 100644 --- a/x-pack/plugins/security_solution/cypress/integration/detection_rules/event_correlation_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/detection_rules/event_correlation_rule.spec.ts @@ -72,7 +72,7 @@ describe('EQL rules', () => { const expectedTags = getEqlRule().tags.join(''); const expectedMitre = formatMitreAttackDescription(getEqlRule().mitre); const expectedNumberOfRules = 1; - const expectedNumberOfAlerts = '1 alert'; + const expectedNumberOfAlerts = '2 alerts'; beforeEach(() => { createTimeline(getEqlRule().timeline).then((response) => { diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts b/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts index a4580105d673c..3384deafbb7c5 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts_details.ts @@ -77,3 +77,7 @@ export const SUMMARY_VIEW_INVESTIGATE_IN_TIMELINE_BUTTON = `${SUMMARY_VIEW} [ari export const INSIGHTS_RELATED_ALERTS_BY_SESSION = `[data-test-subj='related-alerts-by-session']`; export const INSIGHTS_INVESTIGATE_IN_TIMELINE_BUTTON = `${INSIGHTS_RELATED_ALERTS_BY_SESSION} [aria-label='Investigate in timeline']`; + +export const INSIGHTS_RELATED_ALERTS_BY_ANCESTRY = `[data-test-subj='related-alerts-by-ancestry']`; + +export const INSIGHTS_INVESTIGATE_ANCESTRY_ALERTS_IN_TIMELINE_BUTTON = `[data-test-subj='investigate-ancestry-in-timeline']`; diff --git a/x-pack/plugins/security_solution/cypress/screens/date_picker.ts b/x-pack/plugins/security_solution/cypress/screens/date_picker.ts index 5f985a6bba141..337a53650d250 100644 --- a/x-pack/plugins/security_solution/cypress/screens/date_picker.ts +++ b/x-pack/plugins/security_solution/cypress/screens/date_picker.ts @@ -24,5 +24,14 @@ export const DATE_PICKER_END_DATE_POPOVER_BUTTON_TIMELINE = export const DATE_PICKER_START_DATE_POPOVER_BUTTON = 'div[data-test-subj="globalDatePicker"] button[data-test-subj="superDatePickerstartDatePopoverButton"]'; +export const GLOBAL_FILTERS_CONTAINER = '[data-test-subj="globalDatePicker"]'; + +export const SHOW_DATES_BUTTON = '[data-test-subj="superDatePickerShowDatesButton"]'; + +export const DATE_PICKER_SHOW_DATE_POPOVER_BUTTON = `${GLOBAL_FILTERS_CONTAINER} ${SHOW_DATES_BUTTON}`; + +export const DATE_PICKER_RELATIVE_DATE_INPUT_UNIT_SELECTOR = + '[data-test-subj="superDatePickerRelativeDateInputUnitSelector"]'; + export const DATE_PICKER_START_DATE_POPOVER_BUTTON_TIMELINE = '[data-test-subj="timeline-date-picker-container"] [data-test-subj="superDatePickerstartDatePopoverButton"]'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/alerts_details.ts b/x-pack/plugins/security_solution/cypress/tasks/alerts_details.ts index 7d79e63191847..e95e031680e7b 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/alerts_details.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/alerts_details.ts @@ -6,12 +6,14 @@ */ import { + ALERT_FLYOUT, ENRICHMENT_COUNT_NOTIFICATION, JSON_VIEW_TAB, OVERVIEW_TAB, TABLE_TAB, FILTER_INPUT, } from '../screens/alerts_details'; +import { TIMELINE_TITLE, QUERY_TAB_BUTTON } from '../screens/timeline'; export const filterBy = (value: string) => { cy.get(FILTER_INPUT).type(value); @@ -32,3 +34,35 @@ export const openTable = () => { export const openThreatIndicatorDetails = () => { cy.get(ENRICHMENT_COUNT_NOTIFICATION).click(); }; + +export const verifyInsightCount = ({ + tableSelector, + investigateSelector, +}: { + tableSelector: string; + investigateSelector: string; +}) => { + cy.get(tableSelector).click(); + + // Make sure the table containing data has loaded before parsing the text for the alert count + cy.get(investigateSelector); + cy.get(tableSelector) + .invoke('text') + .then((relatedAlertsByAncestryText) => { + // Extract the count from the text + const alertCount = relatedAlertsByAncestryText.match(/(\d)/); + const actualCount = alertCount && alertCount[0]; + + // Make sure we can see the table + cy.contains('New Rule Test').should('be.visible'); + + // Click on the first button that lets us investigate in timeline + cy.get(ALERT_FLYOUT).find(investigateSelector).click(); + + // Make sure a new timeline is created and opened + cy.get(TIMELINE_TITLE).should('contain.text', 'Untitled timeline'); + + // The alert count in this timeline should match the count shown on the alert flyout + cy.get(QUERY_TAB_BUTTON).should('contain.text', actualCount); + }); +}; diff --git a/x-pack/plugins/security_solution/cypress/tasks/date_picker.ts b/x-pack/plugins/security_solution/cypress/tasks/date_picker.ts index 26512a2fcbc5b..3b4d803bf206e 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/date_picker.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/date_picker.ts @@ -13,7 +13,10 @@ import { DATE_PICKER_END_DATE_POPOVER_BUTTON, DATE_PICKER_END_DATE_POPOVER_BUTTON_TIMELINE, DATE_PICKER_START_DATE_POPOVER_BUTTON, + GLOBAL_FILTERS_CONTAINER, + SHOW_DATES_BUTTON, DATE_PICKER_START_DATE_POPOVER_BUTTON_TIMELINE, + DATE_PICKER_SHOW_DATE_POPOVER_BUTTON, } from '../screens/date_picker'; export const setEndDate = (date: string) => { @@ -25,11 +28,21 @@ export const setEndDate = (date: string) => { }; export const setStartDate = (date: string) => { - cy.get(DATE_PICKER_START_DATE_POPOVER_BUTTON).click({ force: true }); + cy.get(GLOBAL_FILTERS_CONTAINER); + cy.get('.euiSuperDatePicker'); + cy.get('body').then(($container) => { + if ($container.find(SHOW_DATES_BUTTON).length > 0) { + cy.get(DATE_PICKER_SHOW_DATE_POPOVER_BUTTON).click({ force: true }); + } else { + cy.get(DATE_PICKER_START_DATE_POPOVER_BUTTON).click({ force: true }); + } + }); cy.get(DATE_PICKER_ABSOLUTE_TAB).first().click({ force: true }); cy.get(DATE_PICKER_ABSOLUTE_INPUT).click().clear().type(date); + + cy.get(DATE_PICKER_APPLY_BUTTON).click(); }; export const setTimelineEndDate = (date: string) => { diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/insights/insights.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/insights/insights.tsx index 7ffb3f6747214..e6ee74185d4e7 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/insights/insights.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/insights/insights.tsx @@ -37,6 +37,14 @@ export const Insights = React.memo( 'insightsRelatedAlertsByProcessAncestry' ); const processEntityField = find({ category: 'process', field: 'process.entity_id' }, data); + const originalDocumentId = find( + { category: 'kibana', field: 'kibana.alert.ancestors.id' }, + data + ); + const originalDocumentIndex = find( + { category: 'kibana', field: 'kibana.alert.rule.parameters.index' }, + data + ); const hasProcessEntityInfo = isRelatedAlertsByProcessAncestryEnabled && processEntityField && processEntityField.values; @@ -64,6 +72,13 @@ export const Insights = React.memo( hasSourceEventInfo || hasProcessSessionInfo; + const canShowAncestryInsight = + isRelatedAlertsByProcessAncestryEnabled && + processEntityField && + processEntityField.values && + originalDocumentId && + originalDocumentIndex; + // If we're in read-only mode or don't have any insight-related data, // don't render anything. if (isReadOnly || !canShowAtLeastOneInsight) { @@ -107,17 +122,17 @@ export const Insights = React.memo( )} - {isRelatedAlertsByProcessAncestryEnabled && - processEntityField && - processEntityField.values && ( - - - - )} + {canShowAncestryInsight && ( + + + + )} ); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.test.tsx index 6237a9dbd43a1..a2bd3ce273ea4 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.test.tsx @@ -21,6 +21,24 @@ jest.mock('../../../containers/alerts/use_alert_prevalence_from_process_tree', ( })); const mockUseAlertPrevalenceFromProcessTree = useAlertPrevalenceFromProcessTree as jest.Mock; +const props = { + eventId: 'random', + data: { + field: 'testfield', + values: ['test value'], + isObjectArray: false, + }, + index: { + field: 'index', + values: ['test value'], + isObjectArray: false, + }, + originalDocumentId: { + field: '_id', + values: ['original'], + isObjectArray: false, + }, +}; describe('RelatedAlertsByProcessAncestry', () => { beforeEach(() => { jest.resetAllMocks(); @@ -29,14 +47,7 @@ describe('RelatedAlertsByProcessAncestry', () => { it('shows an accordion and does not fetch data right away', () => { render( - + ); @@ -51,14 +62,7 @@ describe('RelatedAlertsByProcessAncestry', () => { render( - + ); @@ -75,14 +79,7 @@ describe('RelatedAlertsByProcessAncestry', () => { render( - + ); @@ -100,14 +97,7 @@ describe('RelatedAlertsByProcessAncestry', () => { render( - + ); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.tsx index 0bbf47187b781..0a1adaf9ce9e4 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/insights/related_alerts_by_process_ancestry.tsx @@ -9,6 +9,7 @@ import React, { useMemo, useCallback, useEffect, useState } from 'react'; import { EuiSpacer, EuiLoadingSpinner } from '@elastic/eui'; import type { DataProvider } from '../../../../../common/types'; +import { TimelineId } from '../../../../../common/types/timeline'; import type { TimelineEventsDetailsItem } from '../../../../../common/search_strategy/timeline'; import { getDataProvider } from '../table/use_action_cell_data_provider'; import { useAlertPrevalenceFromProcessTree } from '../../../containers/alerts/use_alert_prevalence_from_process_tree'; @@ -21,6 +22,8 @@ import { PROCESS_ANCESTRY, PROCESS_ANCESTRY_COUNT, PROCESS_ANCESTRY_ERROR } from interface Props { data: TimelineEventsDetailsItem; eventId: string; + index: TimelineEventsDetailsItem; + originalDocumentId: TimelineEventsDetailsItem; timelineId?: string; } @@ -56,53 +59,57 @@ interface Cache { * Due to the ephemeral nature of the data, it was decided to keep the * state inside the component rather than to add it to Redux. */ -export const RelatedAlertsByProcessAncestry = React.memo(({ data, eventId, timelineId }) => { - const [showContent, setShowContent] = useState(false); - const [cache, setCache] = useState>({}); - - const onToggle = useCallback((isOpen: boolean) => setShowContent(isOpen), []); - - // Makes sure the component is not fetching data before the accordion - // has been openend. - const renderContent = useCallback(() => { - if (!showContent) { - return null; - } else if (cache.alertIds) { +export const RelatedAlertsByProcessAncestry = React.memo( + ({ data, originalDocumentId, index, eventId, timelineId }) => { + const [showContent, setShowContent] = useState(false); + const [cache, setCache] = useState>({}); + + const onToggle = useCallback((isOpen: boolean) => setShowContent(isOpen), []); + + // Makes sure the component is not fetching data before the accordion + // has been openend. + const renderContent = useCallback(() => { + if (!showContent) { + return null; + } else if (cache.alertIds) { + return ( + + ); + } return ( - ); - } + }, [showContent, cache, data, eventId, timelineId, index, originalDocumentId]); + + const isEmpty = !!cache.alertIds && cache.alertIds.length === 0; + return ( - ); - }, [showContent, cache, data, eventId, timelineId]); - - const isEmpty = !!cache.alertIds && cache.alertIds.length === 0; - - return ( - - ); -}); + } +); RelatedAlertsByProcessAncestry.displayName = 'RelatedAlertsByProcessAncestry'; @@ -112,10 +119,22 @@ RelatedAlertsByProcessAncestry.displayName = 'RelatedAlertsByProcessAncestry'; const FetchAndNotifyCachedAlertsByProcessAncestry: React.FC<{ data: TimelineEventsDetailsItem; eventId: string; + index: TimelineEventsDetailsItem; + originalDocumentId: TimelineEventsDetailsItem; timelineId?: string; onCacheLoad: (cache: Cache) => void; -}> = ({ data, timelineId, onCacheLoad, eventId }) => { - const { loading, error, alertIds } = useAlertPrevalenceFromProcessTree(eventId, timelineId); +}> = ({ data, originalDocumentId, index, timelineId, onCacheLoad, eventId }) => { + const { values: wrappedProcessEntityId } = data; + const { values: indices } = index; + const { values: wrappedDocumentId } = originalDocumentId; + const documentId = Array.isArray(wrappedDocumentId) ? wrappedDocumentId[0] : ''; + const processEntityId = Array.isArray(wrappedProcessEntityId) ? wrappedProcessEntityId[0] : ''; + const { loading, error, alertIds } = useAlertPrevalenceFromProcessTree({ + processEntityId, + timelineId: timelineId ?? TimelineId.active, + documentId, + indices: indices ?? [], + }); useEffect(() => { if (alertIds) { @@ -162,7 +181,11 @@ const ActualRelatedAlertsByProcessAncestry: React.FC<{ <> - + {ACTION_INVESTIGATE_IN_TIMELINE} diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx index 9b31b64375445..f5d10c02ce216 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx @@ -21,7 +21,7 @@ import { ACTION_INVESTIGATE_IN_TIMELINE } from '../../../../detections/component export const InvestigateInTimelineButton: React.FunctionComponent<{ asEmptyButton: boolean; dataProviders: DataProvider[]; -}> = ({ asEmptyButton, children, dataProviders }) => { +}> = ({ asEmptyButton, children, dataProviders, ...rest }) => { const dispatch = useDispatch(); const clearTimeline = useCreateTimeline({ @@ -64,7 +64,11 @@ export const InvestigateInTimelineButton: React.FunctionComponent<{ {children} ) : ( - + {children} ); diff --git a/x-pack/plugins/security_solution/public/common/containers/alerts/use_alert_prevalence_from_process_tree.ts b/x-pack/plugins/security_solution/public/common/containers/alerts/use_alert_prevalence_from_process_tree.ts index ee6d1e58bb97f..4ea3ff08c2abd 100644 --- a/x-pack/plugins/security_solution/public/common/containers/alerts/use_alert_prevalence_from_process_tree.ts +++ b/x-pack/plugins/security_solution/public/common/containers/alerts/use_alert_prevalence_from_process_tree.ts @@ -27,6 +27,18 @@ interface EntityResponse { schema: object; } +interface UseAlertPrevalenceFromProcessTree { + processEntityId: string; + documentId: string; + timelineId: string; + indices: string[]; +} + +interface UseAlertDocumentAnalyzerSchema { + documentId: string; + indices: string[]; +} + interface TreeResponse { statsNodes: Array<{ data: object; @@ -42,12 +54,12 @@ interface TreeResponse { alertIds: string[]; } -function useAlertDocumentAnalyzerSchema(processEntityId: string, indices: string[]) { +function useAlertDocumentAnalyzerSchema({ documentId, indices }: UseAlertDocumentAnalyzerSchema) { const http = useHttp(); - const query = useQuery(['getAlertPrevalenceSchema', processEntityId], () => { + const query = useQuery(['getAlertPrevalenceSchema', documentId], () => { return http.get(`/api/endpoint/resolver/entity`, { query: { - _id: processEntityId, + _id: documentId, indices, }, }); @@ -59,7 +71,7 @@ function useAlertDocumentAnalyzerSchema(processEntityId: string, indices: string id: null, schema: null, }; - } else if (query.data) { + } else if (query.data && query.data.length > 0) { const { data: [{ schema, id }], } = query; @@ -79,15 +91,20 @@ function useAlertDocumentAnalyzerSchema(processEntityId: string, indices: string } } -export function useAlertPrevalenceFromProcessTree( - processEntityId: string, - timelineId: string | undefined -): UserAlertPrevalenceFromProcessTreeResult { +export function useAlertPrevalenceFromProcessTree({ + processEntityId, + documentId, + timelineId, + indices, +}: UseAlertPrevalenceFromProcessTree): UserAlertPrevalenceFromProcessTreeResult { const http = useHttp(); const { selectedPatterns, to, from } = useTimelineDataFilters(timelineId); - - const { loading, id, schema } = useAlertDocumentAnalyzerSchema(processEntityId, selectedPatterns); + const alertAndOriginalIndices = [...new Set(selectedPatterns.concat(indices))]; + const { loading, id, schema } = useAlertDocumentAnalyzerSchema({ + documentId, + indices: alertAndOriginalIndices, + }); const query = useQuery( ['getAlertPrevalenceFromProcessTree', id], () => { @@ -96,7 +113,7 @@ export function useAlertPrevalenceFromProcessTree( schema, ancestors: 200, descendants: 500, - indexPatterns: selectedPatterns, + indexPatterns: alertAndOriginalIndices, nodes: [id], timeRange: { from, to }, includeHits: true, diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/tree/queries/stats.ts b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/tree/queries/stats.ts index f7adce3a3248a..0b2a7e9c986a0 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/resolver/tree/queries/stats.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/resolver/tree/queries/stats.ts @@ -7,7 +7,6 @@ import type { IScopedClusterClient } from '@kbn/core/server'; import type { AlertsClient } from '@kbn/rule-registry-plugin/server'; -import { ALERT_RULE_UUID } from '@kbn/rule-data-utils'; import type { JsonObject } from '@kbn/utility-types'; import type { EventStats, ResolverSchema } from '../../../../../../common/endpoint/types'; import type { NodeID, TimeRange } from '../utils'; @@ -197,9 +196,7 @@ export class StatsQuery { }, ]) ); - const alertIdsRaw: Array = alertsBody.hits.hits.map((hit) => { - return hit._source && hit._source[ALERT_RULE_UUID]; - }); + const alertIdsRaw: Array = alertsBody.hits.hits.map((hit) => hit._id); const alertIds = alertIdsRaw.flatMap((id) => (!id ? [] : [id])); const eventAggStats = [...eventsWithAggs.values()]; diff --git a/x-pack/test/security_solution_cypress/config.ts b/x-pack/test/security_solution_cypress/config.ts index 4b5b2c361c1b9..9527b0ff37217 100644 --- a/x-pack/test/security_solution_cypress/config.ts +++ b/x-pack/test/security_solution_cypress/config.ts @@ -51,6 +51,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { `--xpack.securitySolution.enableExperimental=${JSON.stringify([ 'riskyHostsEnabled', 'riskyUsersEnabled', + 'insightsRelatedAlertsByProcessAncestry', ])}`, `--home.disableWelcomeScreen=true`, ], diff --git a/x-pack/test/security_solution_cypress/es_archives/auditbeat/data.json b/x-pack/test/security_solution_cypress/es_archives/auditbeat/data.json index 6d62f1654a333..ec69dcaa9d0f7 100644 --- a/x-pack/test/security_solution_cypress/es_archives/auditbeat/data.json +++ b/x-pack/test/security_solution_cypress/es_archives/auditbeat/data.json @@ -120,3 +120,126 @@ } } } + +{ + "type": "doc", + "value": { + "id": "_aZE5nwBOpWiDweSth_E", + "index": "auditbeat-2022", + "source": { + "@timestamp" : "2022-03-04T19:41:34.045Z", + "host" : { + "hostname" : "test.local", + "architecture" : "x86_64", + "os" : { + "platform" : "darwin", + "version" : "10.16", + "family" : "darwin", + "name" : "Mac OS X", + "kernel" : "21.3.0", + "build" : "21D62", + "type" : "macos" + }, + "id" : "44426D67-79AB-547C-7777-440AB8F5DDD2", + "ip" : [ + "fe80::bade:48ff:fe00:1122", + "fe81::4ab:9565:1199:be3", + "192.168.5.175", + "fe80::40d7:d0ff:fe66:f55", + "fe81::40d8:d0ff:fe66:f55", + "fe82::c2c:6bdf:3307:dce0", + "fe83::5069:fcd5:e31c:7059", + "fe80::ce81:b2c:bd2c:69e", + "fe80::febc:bbc1:c517:827b", + "fe80::6d09:bee6:55a5:539d", + "fe80::c920:752e:1e0e:edc9", + "fe80::a4a:ca38:761f:83e2" + ], + "mac" : [ + "ad:df:48:00:11:22", + "a6:86:e7:ae:5a:b6", + "a9:83:e7:ae:5a:b6", + "43:d8:d0:66:0f:55", + "42:d8:d0:66:0f:57", + "82:70:c7:c2:3c:01", + "82:70:c6:c2:4c:00", + "82:76:a6:c2:3c:05", + "82:70:c6:b2:3c:04", + "82:71:a6:c2:3c:01" + ], + "name" : "siem-kibana" + }, + "agent" : { + "type" : "winlogbeat", + "version" : "8.1.0", + "ephemeral_id" : "f6df090f-656a-4a79-a6a1-0c8671c9752d", + "id" : "0ebd469b-c164-4734-00e6-96d018098dc7", + "name" : "test.local" + }, + "event" : { + "module" : "sysmon", + "dataset" : "process", + "kind" : "event", + "category" : [ + "process" + ], + "type" : [ + "start" + ], + "action" : "process_started" + }, + "destination": { + "port": 80 + }, + "process" : { + "start" : "2022-03-04T19:41:34.902Z", + "pid" : 30884, + "working_directory" : "/Users/test/security_solution", + "hash" : { + "sha1" : "ae2d46c38fa207efbea5fcecd6294eebbf5af00f" + }, + "parent" : { + "pid" : 777 + }, + "executable" : "/bin/zsh", + "name" : "zsh", + "args" : [ + "-zsh" + ], + "entity_id" : "q6pltOhTWlQx3BCE", + "entry_leader": { + "entity_id": "q6pltOhTWlQx3BCE", + "name": "fake entry", + "pid": 2342342 + } + }, + "message" : "Process zsh (PID: 27884) by user test STARTED", + "user" : { + "id" : "505", + "group" : { + "name" : "staff", + "id" : "20" + }, + "effective" : { + "id" : "505", + "group" : { + "id" : "20" + } + }, + "saved" : { + "id" : "505", + "group" : { + "id" : "20" + } + }, + "name" : "test" + }, + "service" : { + "type" : "system" + }, + "ecs" : { + "version" : "8.0.0" + } + } + } +} From 878ebfd3a4b3a08f2ff0efd37cc89dc4c421d302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=BCrkan=20YALAMAN?= Date: Tue, 2 Aug 2022 19:10:33 +0200 Subject: [PATCH 13/21] [Enterprise Search] Add missing link to integrations page on new index creation (#137856) * Add link to integrations page on new index creation * Use EuiLinkTo instead --- .../components/new_index/new_index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx index e018457e6f3fc..09d2ed4d244af 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx @@ -21,6 +21,8 @@ import { import { i18n } from '@kbn/i18n'; import { parseQueryParams } from '../../../shared/query_params'; +import { EuiLinkTo } from '../../../shared/react_router_helpers'; + import { EnterpriseSearchContentPageTemplate } from '../layout/page_template'; import { baseBreadcrumbs } from '../search_indices'; @@ -147,6 +149,12 @@ export const NewIndex: React.FC = () => { selected={selectedMethod} onChange={setSelectedMethod} /> + + + {i18n.translate('xpack.enterpriseSearch.content.newIndex.viewIntegrationsLink', { + defaultMessage: 'View additional integrations', + })} + From c3500c21e9a191b2e257247ca98d09b86db29837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Tue, 2 Aug 2022 19:25:53 +0200 Subject: [PATCH 14/21] [IDM] Assign author: Kibana Core to packages owned by core (#137887) --- .github/CODEOWNERS | 2 +- packages/analytics/client/package.json | 1 + packages/analytics/shippers/elastic_v3/browser/package.json | 1 + packages/analytics/shippers/elastic_v3/common/package.json | 1 + packages/analytics/shippers/elastic_v3/server/package.json | 1 + packages/analytics/shippers/fullstory/package.json | 1 + .../core/analytics/core-analytics-browser-internal/package.json | 1 + .../core/analytics/core-analytics-browser-mocks/package.json | 1 + packages/core/analytics/core-analytics-browser/package.json | 1 + .../core/analytics/core-analytics-server-internal/package.json | 1 + .../core/analytics/core-analytics-server-mocks/package.json | 1 + packages/core/analytics/core-analytics-server/package.json | 1 + packages/core/base/core-base-browser-internal/package.json | 1 + packages/core/base/core-base-browser-mocks/package.json | 1 + packages/core/base/core-base-common-internal/package.json | 1 + packages/core/base/core-base-common/package.json | 1 + packages/core/base/core-base-server-internal/package.json | 1 + packages/core/base/core-base-server-mocks/package.json | 1 + .../core/capabilities/core-capabilities-common/package.json | 1 + .../capabilities/core-capabilities-server-internal/package.json | 1 + .../capabilities/core-capabilities-server-mocks/package.json | 1 + .../core/capabilities/core-capabilities-server/package.json | 1 + packages/core/config/core-config-server-internal/package.json | 1 + .../core-deprecations-browser-internal/package.json | 1 + .../deprecations/core-deprecations-browser-mocks/package.json | 1 + .../core/deprecations/core-deprecations-browser/package.json | 1 + .../core/deprecations/core-deprecations-common/package.json | 1 + .../core/doc-links/core-doc-links-browser-internal/package.json | 1 + .../core/doc-links/core-doc-links-browser-mocks/package.json | 1 + packages/core/doc-links/core-doc-links-browser/package.json | 1 + .../core/doc-links/core-doc-links-server-internal/package.json | 1 + .../core/doc-links/core-doc-links-server-mocks/package.json | 1 + packages/core/doc-links/core-doc-links-server/package.json | 1 + .../core-elasticsearch-client-server-internal/package.json | 1 + .../core-elasticsearch-client-server-mocks/package.json | 1 + .../core-elasticsearch-server-internal/package.json | 1 + .../elasticsearch/core-elasticsearch-server-mocks/package.json | 1 + .../core/elasticsearch/core-elasticsearch-server/package.json | 1 + .../environment/core-environment-server-internal/package.json | 1 + .../core/environment/core-environment-server-mocks/package.json | 1 + .../core-execution-context-browser-internal/package.json | 1 + .../core-execution-context-browser-mocks/package.json | 1 + .../core-execution-context-browser/package.json | 1 + .../core-execution-context-common/package.json | 1 + .../core-execution-context-server-internal/package.json | 1 + .../core-execution-context-server-mocks/package.json | 1 + .../core-execution-context-server/package.json | 1 + .../core-fatal-errors-browser-internal/package.json | 1 + .../fatal-errors/core-fatal-errors-browser-mocks/package.json | 1 + .../core/fatal-errors/core-fatal-errors-browser/package.json | 1 + packages/core/http/core-http-browser-internal/package.json | 1 + packages/core/http/core-http-browser-mocks/package.json | 1 + packages/core/http/core-http-browser/package.json | 1 + packages/core/http/core-http-common/package.json | 1 + .../core/http/core-http-context-server-internal/package.json | 1 + packages/core/http/core-http-context-server-mocks/package.json | 1 + .../core/http/core-http-router-server-internal/package.json | 1 + packages/core/http/core-http-router-server-mocks/package.json | 1 + packages/core/http/core-http-server-internal/package.json | 1 + packages/core/http/core-http-server-mocks/package.json | 1 + packages/core/http/core-http-server/package.json | 1 + packages/core/i18n/core-i18n-browser-internal/package.json | 1 + packages/core/i18n/core-i18n-browser-mocks/package.json | 1 + packages/core/i18n/core-i18n-browser/package.json | 1 + .../core-injected-metadata-browser-internal/package.json | 1 + .../core-injected-metadata-browser-mocks/package.json | 1 + .../core-injected-metadata-browser/package.json | 1 + .../core-injected-metadata-common-internal/package.json | 1 + .../core-integrations-browser-internal/package.json | 1 + .../integrations/core-integrations-browser-mocks/package.json | 1 + packages/core/logging/core-logging-server-internal/package.json | 1 + packages/core/logging/core-logging-server-mocks/package.json | 1 + packages/core/logging/core-logging-server/package.json | 1 + .../core-metrics-collectors-server-internal/package.json | 1 + .../metrics/core-metrics-collectors-server-mocks/package.json | 1 + packages/core/metrics/core-metrics-server-internal/package.json | 1 + packages/core/metrics/core-metrics-server-mocks/package.json | 1 + packages/core/metrics/core-metrics-server/package.json | 1 + .../mount-utils/core-mount-utils-browser-internal/package.json | 1 + packages/core/mount-utils/core-mount-utils-browser/package.json | 1 + packages/core/node/core-node-server-internal/package.json | 1 + packages/core/node/core-node-server-mocks/package.json | 1 + packages/core/node/core-node-server/package.json | 1 + .../core-notifications-browser-internal/package.json | 1 + .../notifications/core-notifications-browser-mocks/package.json | 1 + .../core/notifications/core-notifications-browser/package.json | 1 + .../core/overlays/core-overlays-browser-internal/package.json | 1 + packages/core/overlays/core-overlays-browser-mocks/package.json | 1 + packages/core/overlays/core-overlays-browser/package.json | 1 + packages/core/preboot/core-preboot-server-internal/package.json | 1 + packages/core/preboot/core-preboot-server-mocks/package.json | 1 + packages/core/preboot/core-preboot-server/package.json | 1 + .../saved-objects/core-saved-objects-api-browser/package.json | 1 + .../saved-objects/core-saved-objects-api-server/package.json | 1 + .../core/saved-objects/core-saved-objects-common/package.json | 1 + .../core/saved-objects/core-saved-objects-server/package.json | 1 + .../core-test-helpers-http-setup-browser/package.json | 1 + packages/core/theme/core-theme-browser-internal/package.json | 1 + packages/core/theme/core-theme-browser-mocks/package.json | 1 + packages/core/theme/core-theme-browser/package.json | 1 + .../ui-settings/core-ui-settings-browser-internal/package.json | 1 + .../ui-settings/core-ui-settings-browser-mocks/package.json | 1 + packages/core/ui-settings/core-ui-settings-browser/package.json | 1 + packages/core/ui-settings/core-ui-settings-common/package.json | 1 + packages/kbn-analytics/package.json | 2 +- packages/kbn-config-mocks/package.json | 1 + packages/kbn-config-schema/package.json | 1 + packages/kbn-config/package.json | 1 + packages/kbn-docs-utils/src/api_docs/README.md | 2 +- packages/kbn-es-errors/package.json | 1 + packages/kbn-i18n-react/package.json | 1 + packages/kbn-i18n/package.json | 1 + packages/kbn-logging-mocks/package.json | 1 + packages/kbn-logging/package.json | 1 + packages/kbn-server-http-tools/package.json | 1 + packages/kbn-std/package.json | 1 + packages/kbn-telemetry-tools/package.json | 1 + 117 files changed, 117 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bf5c575a9fc5c..d6365810cd41c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -296,7 +296,7 @@ /packages/kbn-config/ @elastic/kibana-core /packages/kbn-logging/ @elastic/kibana-core /packages/kbn-logging-mocks/ @elastic/kibana-core -/packages/kbn-http-tools/ @elastic/kibana-core +/packages/kbn-server-http-tools/ @elastic/kibana-core /packages/kbn-es-errors/ @elastic/kibana-core /src/plugins/saved_objects_management/ @elastic/kibana-core /src/plugins/advanced_settings/ @elastic/kibana-core diff --git a/packages/analytics/client/package.json b/packages/analytics/client/package.json index 9f2c648183a41..6f4f7ed05b540 100644 --- a/packages/analytics/client/package.json +++ b/packages/analytics/client/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "browser": "./target_web/index.js", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/analytics/shippers/elastic_v3/browser/package.json b/packages/analytics/shippers/elastic_v3/browser/package.json index 418887000521a..90a73a6b3dfdd 100644 --- a/packages/analytics/shippers/elastic_v3/browser/package.json +++ b/packages/analytics/shippers/elastic_v3/browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "browser": "./target_web/index.js", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/analytics/shippers/elastic_v3/common/package.json b/packages/analytics/shippers/elastic_v3/common/package.json index ce8825e6bdc1f..2313d1d491090 100644 --- a/packages/analytics/shippers/elastic_v3/common/package.json +++ b/packages/analytics/shippers/elastic_v3/common/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "browser": "./target_web/index.js", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/analytics/shippers/elastic_v3/server/package.json b/packages/analytics/shippers/elastic_v3/server/package.json index 5ab24844eb1ba..846beb3cf2a3d 100644 --- a/packages/analytics/shippers/elastic_v3/server/package.json +++ b/packages/analytics/shippers/elastic_v3/server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/analytics/shippers/fullstory/package.json b/packages/analytics/shippers/fullstory/package.json index ab5ac56b35641..8ad45e29d2060 100644 --- a/packages/analytics/shippers/fullstory/package.json +++ b/packages/analytics/shippers/fullstory/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "browser": "./target_web/index.js", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/analytics/core-analytics-browser-internal/package.json b/packages/core/analytics/core-analytics-browser-internal/package.json index 143ecaaeb9428..a556bd85f8e49 100644 --- a/packages/core/analytics/core-analytics-browser-internal/package.json +++ b/packages/core/analytics/core-analytics-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/analytics/core-analytics-browser-mocks/package.json b/packages/core/analytics/core-analytics-browser-mocks/package.json index ed5e35fb28e04..56e1fd2076796 100644 --- a/packages/core/analytics/core-analytics-browser-mocks/package.json +++ b/packages/core/analytics/core-analytics-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/analytics/core-analytics-browser/package.json b/packages/core/analytics/core-analytics-browser/package.json index b53883055987c..c448c49689233 100644 --- a/packages/core/analytics/core-analytics-browser/package.json +++ b/packages/core/analytics/core-analytics-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/analytics/core-analytics-server-internal/package.json b/packages/core/analytics/core-analytics-server-internal/package.json index 12dc15e9633a4..a80f7ed586a9d 100644 --- a/packages/core/analytics/core-analytics-server-internal/package.json +++ b/packages/core/analytics/core-analytics-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/analytics/core-analytics-server-mocks/package.json b/packages/core/analytics/core-analytics-server-mocks/package.json index 12b50433e7f62..be11f7741aa83 100644 --- a/packages/core/analytics/core-analytics-server-mocks/package.json +++ b/packages/core/analytics/core-analytics-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/analytics/core-analytics-server/package.json b/packages/core/analytics/core-analytics-server/package.json index f990017e75c39..40581cbaee9b4 100644 --- a/packages/core/analytics/core-analytics-server/package.json +++ b/packages/core/analytics/core-analytics-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/base/core-base-browser-internal/package.json b/packages/core/base/core-base-browser-internal/package.json index a790e3c216035..9bdf9735ff417 100644 --- a/packages/core/base/core-base-browser-internal/package.json +++ b/packages/core/base/core-base-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/base/core-base-browser-mocks/package.json b/packages/core/base/core-base-browser-mocks/package.json index 706a7f6ef4d81..e3b87c084e5dc 100644 --- a/packages/core/base/core-base-browser-mocks/package.json +++ b/packages/core/base/core-base-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/base/core-base-common-internal/package.json b/packages/core/base/core-base-common-internal/package.json index 857750d637569..2d8f6269c4d90 100644 --- a/packages/core/base/core-base-common-internal/package.json +++ b/packages/core/base/core-base-common-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/base/core-base-common/package.json b/packages/core/base/core-base-common/package.json index 028c84c15d78a..13c95c7081a6a 100644 --- a/packages/core/base/core-base-common/package.json +++ b/packages/core/base/core-base-common/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/base/core-base-server-internal/package.json b/packages/core/base/core-base-server-internal/package.json index faa96a804973e..783acf08a9d47 100644 --- a/packages/core/base/core-base-server-internal/package.json +++ b/packages/core/base/core-base-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/base/core-base-server-mocks/package.json b/packages/core/base/core-base-server-mocks/package.json index 155f879ff35bd..688dfb4329d73 100644 --- a/packages/core/base/core-base-server-mocks/package.json +++ b/packages/core/base/core-base-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/capabilities/core-capabilities-common/package.json b/packages/core/capabilities/core-capabilities-common/package.json index 9860d13cbab03..9a28f18149cd8 100644 --- a/packages/core/capabilities/core-capabilities-common/package.json +++ b/packages/core/capabilities/core-capabilities-common/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/capabilities/core-capabilities-server-internal/package.json b/packages/core/capabilities/core-capabilities-server-internal/package.json index 0888ed7976817..6a51e2dbeb65e 100644 --- a/packages/core/capabilities/core-capabilities-server-internal/package.json +++ b/packages/core/capabilities/core-capabilities-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/capabilities/core-capabilities-server-mocks/package.json b/packages/core/capabilities/core-capabilities-server-mocks/package.json index 5ed9f9b1d2e65..77b26c96f6e73 100644 --- a/packages/core/capabilities/core-capabilities-server-mocks/package.json +++ b/packages/core/capabilities/core-capabilities-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/capabilities/core-capabilities-server/package.json b/packages/core/capabilities/core-capabilities-server/package.json index 4af69cedb00d8..74a347c2077ba 100644 --- a/packages/core/capabilities/core-capabilities-server/package.json +++ b/packages/core/capabilities/core-capabilities-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/config/core-config-server-internal/package.json b/packages/core/config/core-config-server-internal/package.json index 92cdc3fe27d1f..51cf128309957 100644 --- a/packages/core/config/core-config-server-internal/package.json +++ b/packages/core/config/core-config-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/deprecations/core-deprecations-browser-internal/package.json b/packages/core/deprecations/core-deprecations-browser-internal/package.json index 1f4a5d5531ce9..3c84e32ba713d 100644 --- a/packages/core/deprecations/core-deprecations-browser-internal/package.json +++ b/packages/core/deprecations/core-deprecations-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/deprecations/core-deprecations-browser-mocks/package.json b/packages/core/deprecations/core-deprecations-browser-mocks/package.json index 47b5aa1f0add2..c079cca114440 100644 --- a/packages/core/deprecations/core-deprecations-browser-mocks/package.json +++ b/packages/core/deprecations/core-deprecations-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/deprecations/core-deprecations-browser/package.json b/packages/core/deprecations/core-deprecations-browser/package.json index d4e5346ab80a8..451ebf492334b 100644 --- a/packages/core/deprecations/core-deprecations-browser/package.json +++ b/packages/core/deprecations/core-deprecations-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/deprecations/core-deprecations-common/package.json b/packages/core/deprecations/core-deprecations-common/package.json index 66dd322302c60..377b27999d62f 100644 --- a/packages/core/deprecations/core-deprecations-common/package.json +++ b/packages/core/deprecations/core-deprecations-common/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/doc-links/core-doc-links-browser-internal/package.json b/packages/core/doc-links/core-doc-links-browser-internal/package.json index 045d60439fe28..3c8b135788782 100644 --- a/packages/core/doc-links/core-doc-links-browser-internal/package.json +++ b/packages/core/doc-links/core-doc-links-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/doc-links/core-doc-links-browser-mocks/package.json b/packages/core/doc-links/core-doc-links-browser-mocks/package.json index 2845bbfb053f4..52a9c13781c46 100644 --- a/packages/core/doc-links/core-doc-links-browser-mocks/package.json +++ b/packages/core/doc-links/core-doc-links-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/doc-links/core-doc-links-browser/package.json b/packages/core/doc-links/core-doc-links-browser/package.json index 718249c6bc059..253f8a00b8fd9 100644 --- a/packages/core/doc-links/core-doc-links-browser/package.json +++ b/packages/core/doc-links/core-doc-links-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/doc-links/core-doc-links-server-internal/package.json b/packages/core/doc-links/core-doc-links-server-internal/package.json index b4a53197a5e2b..79ac0d187e905 100644 --- a/packages/core/doc-links/core-doc-links-server-internal/package.json +++ b/packages/core/doc-links/core-doc-links-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/doc-links/core-doc-links-server-mocks/package.json b/packages/core/doc-links/core-doc-links-server-mocks/package.json index abedbcb0eab74..59078c9ab887c 100644 --- a/packages/core/doc-links/core-doc-links-server-mocks/package.json +++ b/packages/core/doc-links/core-doc-links-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/doc-links/core-doc-links-server/package.json b/packages/core/doc-links/core-doc-links-server/package.json index 60abb38eee922..7b6f3c6e77e6c 100644 --- a/packages/core/doc-links/core-doc-links-server/package.json +++ b/packages/core/doc-links/core-doc-links-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/elasticsearch/core-elasticsearch-client-server-internal/package.json b/packages/core/elasticsearch/core-elasticsearch-client-server-internal/package.json index 8029d8dfcf9f5..230b7c0645780 100644 --- a/packages/core/elasticsearch/core-elasticsearch-client-server-internal/package.json +++ b/packages/core/elasticsearch/core-elasticsearch-client-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/elasticsearch/core-elasticsearch-client-server-mocks/package.json b/packages/core/elasticsearch/core-elasticsearch-client-server-mocks/package.json index 5668979087411..97675bc749230 100644 --- a/packages/core/elasticsearch/core-elasticsearch-client-server-mocks/package.json +++ b/packages/core/elasticsearch/core-elasticsearch-client-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/elasticsearch/core-elasticsearch-server-internal/package.json b/packages/core/elasticsearch/core-elasticsearch-server-internal/package.json index c4d93c383d421..f1c98d0af1bf4 100644 --- a/packages/core/elasticsearch/core-elasticsearch-server-internal/package.json +++ b/packages/core/elasticsearch/core-elasticsearch-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/elasticsearch/core-elasticsearch-server-mocks/package.json b/packages/core/elasticsearch/core-elasticsearch-server-mocks/package.json index 4455a10b79d20..dcf8a6db03748 100644 --- a/packages/core/elasticsearch/core-elasticsearch-server-mocks/package.json +++ b/packages/core/elasticsearch/core-elasticsearch-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/elasticsearch/core-elasticsearch-server/package.json b/packages/core/elasticsearch/core-elasticsearch-server/package.json index 87a6b652dbd44..08ab13b7c7dda 100644 --- a/packages/core/elasticsearch/core-elasticsearch-server/package.json +++ b/packages/core/elasticsearch/core-elasticsearch-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/environment/core-environment-server-internal/package.json b/packages/core/environment/core-environment-server-internal/package.json index f99beb7739eef..e66035563796f 100644 --- a/packages/core/environment/core-environment-server-internal/package.json +++ b/packages/core/environment/core-environment-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/environment/core-environment-server-mocks/package.json b/packages/core/environment/core-environment-server-mocks/package.json index 8f96c82592697..ea167991009e8 100644 --- a/packages/core/environment/core-environment-server-mocks/package.json +++ b/packages/core/environment/core-environment-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/execution-context/core-execution-context-browser-internal/package.json b/packages/core/execution-context/core-execution-context-browser-internal/package.json index 675daaa197f0e..75caa4626bafb 100644 --- a/packages/core/execution-context/core-execution-context-browser-internal/package.json +++ b/packages/core/execution-context/core-execution-context-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/execution-context/core-execution-context-browser-mocks/package.json b/packages/core/execution-context/core-execution-context-browser-mocks/package.json index 8c72ba5976789..7551413f36cd8 100644 --- a/packages/core/execution-context/core-execution-context-browser-mocks/package.json +++ b/packages/core/execution-context/core-execution-context-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/execution-context/core-execution-context-browser/package.json b/packages/core/execution-context/core-execution-context-browser/package.json index 2319772d8fd61..03061d5e07777 100644 --- a/packages/core/execution-context/core-execution-context-browser/package.json +++ b/packages/core/execution-context/core-execution-context-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/execution-context/core-execution-context-common/package.json b/packages/core/execution-context/core-execution-context-common/package.json index 48f48621199f7..21667c5d6240a 100644 --- a/packages/core/execution-context/core-execution-context-common/package.json +++ b/packages/core/execution-context/core-execution-context-common/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/execution-context/core-execution-context-server-internal/package.json b/packages/core/execution-context/core-execution-context-server-internal/package.json index bb5ffa6eed7ea..4620f30b6f1f8 100644 --- a/packages/core/execution-context/core-execution-context-server-internal/package.json +++ b/packages/core/execution-context/core-execution-context-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/execution-context/core-execution-context-server-mocks/package.json b/packages/core/execution-context/core-execution-context-server-mocks/package.json index 5434874b3f869..ecbc92ed92b99 100644 --- a/packages/core/execution-context/core-execution-context-server-mocks/package.json +++ b/packages/core/execution-context/core-execution-context-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/execution-context/core-execution-context-server/package.json b/packages/core/execution-context/core-execution-context-server/package.json index 58a8f5adf6eaf..7e5c747f2f727 100644 --- a/packages/core/execution-context/core-execution-context-server/package.json +++ b/packages/core/execution-context/core-execution-context-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/fatal-errors/core-fatal-errors-browser-internal/package.json b/packages/core/fatal-errors/core-fatal-errors-browser-internal/package.json index fc5c13485540e..55ac81c5f63c1 100644 --- a/packages/core/fatal-errors/core-fatal-errors-browser-internal/package.json +++ b/packages/core/fatal-errors/core-fatal-errors-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/fatal-errors/core-fatal-errors-browser-mocks/package.json b/packages/core/fatal-errors/core-fatal-errors-browser-mocks/package.json index 208ee92ee8367..667ceae5bd237 100644 --- a/packages/core/fatal-errors/core-fatal-errors-browser-mocks/package.json +++ b/packages/core/fatal-errors/core-fatal-errors-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/fatal-errors/core-fatal-errors-browser/package.json b/packages/core/fatal-errors/core-fatal-errors-browser/package.json index d45515d4d9f92..ad27ac3cfab68 100644 --- a/packages/core/fatal-errors/core-fatal-errors-browser/package.json +++ b/packages/core/fatal-errors/core-fatal-errors-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-browser-internal/package.json b/packages/core/http/core-http-browser-internal/package.json index 38afd6f60852a..10d7af546754e 100644 --- a/packages/core/http/core-http-browser-internal/package.json +++ b/packages/core/http/core-http-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-browser-mocks/package.json b/packages/core/http/core-http-browser-mocks/package.json index 74ca04ffb8237..960705248b954 100644 --- a/packages/core/http/core-http-browser-mocks/package.json +++ b/packages/core/http/core-http-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-browser/package.json b/packages/core/http/core-http-browser/package.json index 6a07daeaca7ea..78ed7967b8713 100644 --- a/packages/core/http/core-http-browser/package.json +++ b/packages/core/http/core-http-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-common/package.json b/packages/core/http/core-http-common/package.json index 62d50668d283e..3ec2d1e626b4b 100644 --- a/packages/core/http/core-http-common/package.json +++ b/packages/core/http/core-http-common/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-context-server-internal/package.json b/packages/core/http/core-http-context-server-internal/package.json index 1c2c18afb7da0..4c236c6ea30ce 100644 --- a/packages/core/http/core-http-context-server-internal/package.json +++ b/packages/core/http/core-http-context-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-context-server-mocks/package.json b/packages/core/http/core-http-context-server-mocks/package.json index e98f7c35c3968..aff7cd8429cac 100644 --- a/packages/core/http/core-http-context-server-mocks/package.json +++ b/packages/core/http/core-http-context-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-router-server-internal/package.json b/packages/core/http/core-http-router-server-internal/package.json index 45c10b39164b3..12e3cf1498f36 100644 --- a/packages/core/http/core-http-router-server-internal/package.json +++ b/packages/core/http/core-http-router-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-router-server-mocks/package.json b/packages/core/http/core-http-router-server-mocks/package.json index 59c910af29012..05055e151a0e1 100644 --- a/packages/core/http/core-http-router-server-mocks/package.json +++ b/packages/core/http/core-http-router-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-server-internal/package.json b/packages/core/http/core-http-server-internal/package.json index af6db3d6b5106..bf2e87b07d228 100644 --- a/packages/core/http/core-http-server-internal/package.json +++ b/packages/core/http/core-http-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-server-mocks/package.json b/packages/core/http/core-http-server-mocks/package.json index d6757d779dfd6..2efeb0f8db9d3 100644 --- a/packages/core/http/core-http-server-mocks/package.json +++ b/packages/core/http/core-http-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/http/core-http-server/package.json b/packages/core/http/core-http-server/package.json index c47ed37e7692a..e56981c661222 100644 --- a/packages/core/http/core-http-server/package.json +++ b/packages/core/http/core-http-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/i18n/core-i18n-browser-internal/package.json b/packages/core/i18n/core-i18n-browser-internal/package.json index ceb27969df9c5..4feb5bab3251f 100644 --- a/packages/core/i18n/core-i18n-browser-internal/package.json +++ b/packages/core/i18n/core-i18n-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/i18n/core-i18n-browser-mocks/package.json b/packages/core/i18n/core-i18n-browser-mocks/package.json index 45424b4938ade..ef738f9292f52 100644 --- a/packages/core/i18n/core-i18n-browser-mocks/package.json +++ b/packages/core/i18n/core-i18n-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/i18n/core-i18n-browser/package.json b/packages/core/i18n/core-i18n-browser/package.json index 88382aca19615..651e5a0ab57a9 100644 --- a/packages/core/i18n/core-i18n-browser/package.json +++ b/packages/core/i18n/core-i18n-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/injected-metadata/core-injected-metadata-browser-internal/package.json b/packages/core/injected-metadata/core-injected-metadata-browser-internal/package.json index 3fcac1793fcad..19a13df15cbdc 100644 --- a/packages/core/injected-metadata/core-injected-metadata-browser-internal/package.json +++ b/packages/core/injected-metadata/core-injected-metadata-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/injected-metadata/core-injected-metadata-browser-mocks/package.json b/packages/core/injected-metadata/core-injected-metadata-browser-mocks/package.json index e8a4db9f1e47c..090b9a9aba665 100644 --- a/packages/core/injected-metadata/core-injected-metadata-browser-mocks/package.json +++ b/packages/core/injected-metadata/core-injected-metadata-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/injected-metadata/core-injected-metadata-browser/package.json b/packages/core/injected-metadata/core-injected-metadata-browser/package.json index df5f22e5bf0d9..6bc4611c157ac 100644 --- a/packages/core/injected-metadata/core-injected-metadata-browser/package.json +++ b/packages/core/injected-metadata/core-injected-metadata-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/injected-metadata/core-injected-metadata-common-internal/package.json b/packages/core/injected-metadata/core-injected-metadata-common-internal/package.json index 0d1d3b9866f0c..2859de4a935a6 100644 --- a/packages/core/injected-metadata/core-injected-metadata-common-internal/package.json +++ b/packages/core/injected-metadata/core-injected-metadata-common-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/integrations/core-integrations-browser-internal/package.json b/packages/core/integrations/core-integrations-browser-internal/package.json index 999e81599f4aa..1ab0addd1add6 100644 --- a/packages/core/integrations/core-integrations-browser-internal/package.json +++ b/packages/core/integrations/core-integrations-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/integrations/core-integrations-browser-mocks/package.json b/packages/core/integrations/core-integrations-browser-mocks/package.json index b3a20978cfd3d..a2c706786a127 100644 --- a/packages/core/integrations/core-integrations-browser-mocks/package.json +++ b/packages/core/integrations/core-integrations-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/logging/core-logging-server-internal/package.json b/packages/core/logging/core-logging-server-internal/package.json index 3e3ae6f562063..60dd5b9afb1dd 100644 --- a/packages/core/logging/core-logging-server-internal/package.json +++ b/packages/core/logging/core-logging-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/logging/core-logging-server-mocks/package.json b/packages/core/logging/core-logging-server-mocks/package.json index 438d7af38eafb..97f6f4002f58e 100644 --- a/packages/core/logging/core-logging-server-mocks/package.json +++ b/packages/core/logging/core-logging-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/logging/core-logging-server/package.json b/packages/core/logging/core-logging-server/package.json index 03542b51fd835..c3cbc4dab845e 100644 --- a/packages/core/logging/core-logging-server/package.json +++ b/packages/core/logging/core-logging-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/metrics/core-metrics-collectors-server-internal/package.json b/packages/core/metrics/core-metrics-collectors-server-internal/package.json index 4b6b7092ad6af..1955c52a1e1c1 100644 --- a/packages/core/metrics/core-metrics-collectors-server-internal/package.json +++ b/packages/core/metrics/core-metrics-collectors-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/metrics/core-metrics-collectors-server-mocks/package.json b/packages/core/metrics/core-metrics-collectors-server-mocks/package.json index 85c8d3a4882d3..03bd1c83684aa 100644 --- a/packages/core/metrics/core-metrics-collectors-server-mocks/package.json +++ b/packages/core/metrics/core-metrics-collectors-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/metrics/core-metrics-server-internal/package.json b/packages/core/metrics/core-metrics-server-internal/package.json index d31133acbfc7f..7579aea46091b 100644 --- a/packages/core/metrics/core-metrics-server-internal/package.json +++ b/packages/core/metrics/core-metrics-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/metrics/core-metrics-server-mocks/package.json b/packages/core/metrics/core-metrics-server-mocks/package.json index fccc44a6ecf14..b5eb0fab3002d 100644 --- a/packages/core/metrics/core-metrics-server-mocks/package.json +++ b/packages/core/metrics/core-metrics-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/metrics/core-metrics-server/package.json b/packages/core/metrics/core-metrics-server/package.json index 1a61ca24d226a..fbb56452c9a32 100644 --- a/packages/core/metrics/core-metrics-server/package.json +++ b/packages/core/metrics/core-metrics-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/mount-utils/core-mount-utils-browser-internal/package.json b/packages/core/mount-utils/core-mount-utils-browser-internal/package.json index 66bf96174c8c9..073345848d8e2 100644 --- a/packages/core/mount-utils/core-mount-utils-browser-internal/package.json +++ b/packages/core/mount-utils/core-mount-utils-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/mount-utils/core-mount-utils-browser/package.json b/packages/core/mount-utils/core-mount-utils-browser/package.json index 6e766b78cd5c4..b07256c1a50ce 100644 --- a/packages/core/mount-utils/core-mount-utils-browser/package.json +++ b/packages/core/mount-utils/core-mount-utils-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/node/core-node-server-internal/package.json b/packages/core/node/core-node-server-internal/package.json index 91b652b272ca2..47b4c05c3b50a 100644 --- a/packages/core/node/core-node-server-internal/package.json +++ b/packages/core/node/core-node-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/node/core-node-server-mocks/package.json b/packages/core/node/core-node-server-mocks/package.json index 7b96765aa7b53..8be7afe931b6d 100644 --- a/packages/core/node/core-node-server-mocks/package.json +++ b/packages/core/node/core-node-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/node/core-node-server/package.json b/packages/core/node/core-node-server/package.json index 07b3b468eef36..c1d8321a642a1 100644 --- a/packages/core/node/core-node-server/package.json +++ b/packages/core/node/core-node-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/notifications/core-notifications-browser-internal/package.json b/packages/core/notifications/core-notifications-browser-internal/package.json index c31bff466d522..b45295f607634 100644 --- a/packages/core/notifications/core-notifications-browser-internal/package.json +++ b/packages/core/notifications/core-notifications-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/notifications/core-notifications-browser-mocks/package.json b/packages/core/notifications/core-notifications-browser-mocks/package.json index 08d2958e3c5eb..c38d419c5124c 100644 --- a/packages/core/notifications/core-notifications-browser-mocks/package.json +++ b/packages/core/notifications/core-notifications-browser-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/notifications/core-notifications-browser/package.json b/packages/core/notifications/core-notifications-browser/package.json index c38afd1db5d49..891373d673de8 100644 --- a/packages/core/notifications/core-notifications-browser/package.json +++ b/packages/core/notifications/core-notifications-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/overlays/core-overlays-browser-internal/package.json b/packages/core/overlays/core-overlays-browser-internal/package.json index 8008e3d88d94f..9281db3f4663f 100644 --- a/packages/core/overlays/core-overlays-browser-internal/package.json +++ b/packages/core/overlays/core-overlays-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/overlays/core-overlays-browser-mocks/package.json b/packages/core/overlays/core-overlays-browser-mocks/package.json index be515617f7f6f..0822dac0cd36c 100644 --- a/packages/core/overlays/core-overlays-browser-mocks/package.json +++ b/packages/core/overlays/core-overlays-browser-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/overlays/core-overlays-browser/package.json b/packages/core/overlays/core-overlays-browser/package.json index eef1d2792e781..56644fa250e67 100644 --- a/packages/core/overlays/core-overlays-browser/package.json +++ b/packages/core/overlays/core-overlays-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/preboot/core-preboot-server-internal/package.json b/packages/core/preboot/core-preboot-server-internal/package.json index 897d4506b3f7f..a038ae305d586 100644 --- a/packages/core/preboot/core-preboot-server-internal/package.json +++ b/packages/core/preboot/core-preboot-server-internal/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/preboot/core-preboot-server-mocks/package.json b/packages/core/preboot/core-preboot-server-mocks/package.json index e88cee9cfd551..1f40513429607 100644 --- a/packages/core/preboot/core-preboot-server-mocks/package.json +++ b/packages/core/preboot/core-preboot-server-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/preboot/core-preboot-server/package.json b/packages/core/preboot/core-preboot-server/package.json index ef598d368ace4..b5afd04887380 100644 --- a/packages/core/preboot/core-preboot-server/package.json +++ b/packages/core/preboot/core-preboot-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/saved-objects/core-saved-objects-api-browser/package.json b/packages/core/saved-objects/core-saved-objects-api-browser/package.json index 7e40339fbf326..e6894b4b21767 100644 --- a/packages/core/saved-objects/core-saved-objects-api-browser/package.json +++ b/packages/core/saved-objects/core-saved-objects-api-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/saved-objects/core-saved-objects-api-server/package.json b/packages/core/saved-objects/core-saved-objects-api-server/package.json index 971c97fad93bb..6335368dfd7f3 100644 --- a/packages/core/saved-objects/core-saved-objects-api-server/package.json +++ b/packages/core/saved-objects/core-saved-objects-api-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/saved-objects/core-saved-objects-common/package.json b/packages/core/saved-objects/core-saved-objects-common/package.json index b138bcd269def..b2af72692eda1 100644 --- a/packages/core/saved-objects/core-saved-objects-common/package.json +++ b/packages/core/saved-objects/core-saved-objects-common/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/saved-objects/core-saved-objects-server/package.json b/packages/core/saved-objects/core-saved-objects-server/package.json index e5d7a46dec5c2..566ccc3ad49cb 100644 --- a/packages/core/saved-objects/core-saved-objects-server/package.json +++ b/packages/core/saved-objects/core-saved-objects-server/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/test-helpers/core-test-helpers-http-setup-browser/package.json b/packages/core/test-helpers/core-test-helpers-http-setup-browser/package.json index b6c321f96c8fc..608f8b82af43d 100644 --- a/packages/core/test-helpers/core-test-helpers-http-setup-browser/package.json +++ b/packages/core/test-helpers/core-test-helpers-http-setup-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/theme/core-theme-browser-internal/package.json b/packages/core/theme/core-theme-browser-internal/package.json index 620d9b5ddf258..bca678f03158a 100644 --- a/packages/core/theme/core-theme-browser-internal/package.json +++ b/packages/core/theme/core-theme-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/theme/core-theme-browser-mocks/package.json b/packages/core/theme/core-theme-browser-mocks/package.json index 8441e29cde49d..afe7068bec5ca 100644 --- a/packages/core/theme/core-theme-browser-mocks/package.json +++ b/packages/core/theme/core-theme-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/theme/core-theme-browser/package.json b/packages/core/theme/core-theme-browser/package.json index 9d905aebf7541..dff1d13070158 100644 --- a/packages/core/theme/core-theme-browser/package.json +++ b/packages/core/theme/core-theme-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/ui-settings/core-ui-settings-browser-internal/package.json b/packages/core/ui-settings/core-ui-settings-browser-internal/package.json index a333808e2fe63..5e2b66bbc89bd 100644 --- a/packages/core/ui-settings/core-ui-settings-browser-internal/package.json +++ b/packages/core/ui-settings/core-ui-settings-browser-internal/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/ui-settings/core-ui-settings-browser-mocks/package.json b/packages/core/ui-settings/core-ui-settings-browser-mocks/package.json index 7d88d26720d3f..574769c8fcca5 100644 --- a/packages/core/ui-settings/core-ui-settings-browser-mocks/package.json +++ b/packages/core/ui-settings/core-ui-settings-browser-mocks/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/ui-settings/core-ui-settings-browser/package.json b/packages/core/ui-settings/core-ui-settings-browser/package.json index e40aeeac64196..a98b162fd60e7 100644 --- a/packages/core/ui-settings/core-ui-settings-browser/package.json +++ b/packages/core/ui-settings/core-ui-settings-browser/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/core/ui-settings/core-ui-settings-common/package.json b/packages/core/ui-settings/core-ui-settings-common/package.json index 1476582f96d07..b5ce3280dd343 100644 --- a/packages/core/ui-settings/core-ui-settings-common/package.json +++ b/packages/core/ui-settings/core-ui-settings-common/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/kbn-analytics/package.json b/packages/kbn-analytics/package.json index c3b30dcf79431..afe101b731cc3 100644 --- a/packages/kbn-analytics/package.json +++ b/packages/kbn-analytics/package.json @@ -5,6 +5,6 @@ "description": "Kibana Analytics tool", "main": "target_node/index.js", "browser": "target_web/index.js", - "author": "Ahmad Bamieh ", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } \ No newline at end of file diff --git a/packages/kbn-config-mocks/package.json b/packages/kbn-config-mocks/package.json index 4f94fcbdb579d..da209eec5fadf 100644 --- a/packages/kbn-config-mocks/package.json +++ b/packages/kbn-config-mocks/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/kbn-config-schema/package.json b/packages/kbn-config-schema/package.json index d6a0e91b9b429..9f1b42f200385 100644 --- a/packages/kbn-config-schema/package.json +++ b/packages/kbn-config-schema/package.json @@ -3,5 +3,6 @@ "main": "./target_node/index.js", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", + "author": "Kibana Core", "private": true } \ No newline at end of file diff --git a/packages/kbn-config/package.json b/packages/kbn-config/package.json index 012b39d733a78..836e12b41c243 100644 --- a/packages/kbn-config/package.json +++ b/packages/kbn-config/package.json @@ -2,6 +2,7 @@ "name": "@kbn/config", "main": "./target_node/index.js", "version": "1.0.0", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true } \ No newline at end of file diff --git a/packages/kbn-docs-utils/src/api_docs/README.md b/packages/kbn-docs-utils/src/api_docs/README.md index 728cb0690834d..7710aa550b880 100644 --- a/packages/kbn-docs-utils/src/api_docs/README.md +++ b/packages/kbn-docs-utils/src/api_docs/README.md @@ -3,7 +3,7 @@ [RFC](https://github.com/elastic/kibana/blob/main/legacy_rfcs/text/0014_api_documentation.md)) This is an experimental api documentation system that is managed by the Kibana Tech Leads until -we determine the value of such a system and what kind of maintenance burder it will incur. +we determine the value of such a system and what kind of maintenance burden it will incur. To generate the docs run diff --git a/packages/kbn-es-errors/package.json b/packages/kbn-es-errors/package.json index 20416f13d5fa6..f47e1020bd140 100644 --- a/packages/kbn-es-errors/package.json +++ b/packages/kbn-es-errors/package.json @@ -3,5 +3,6 @@ "private": true, "version": "1.0.0", "main": "./target_node/index.js", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0" } diff --git a/packages/kbn-i18n-react/package.json b/packages/kbn-i18n-react/package.json index 3fdadf10a0f03..4c4d845517016 100644 --- a/packages/kbn-i18n-react/package.json +++ b/packages/kbn-i18n-react/package.json @@ -3,6 +3,7 @@ "browser": "./target_web/browser.js", "main": "./target_node/index.js", "version": "1.0.0", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true } \ No newline at end of file diff --git a/packages/kbn-i18n/package.json b/packages/kbn-i18n/package.json index ad6d1f30f9a43..fe757a60439c1 100644 --- a/packages/kbn-i18n/package.json +++ b/packages/kbn-i18n/package.json @@ -4,5 +4,6 @@ "main": "./target_node/index.js", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", + "author": "Kibana Core", "private": true } \ No newline at end of file diff --git a/packages/kbn-logging-mocks/package.json b/packages/kbn-logging-mocks/package.json index 789ffe4500bce..38e1b1eb403bd 100644 --- a/packages/kbn-logging-mocks/package.json +++ b/packages/kbn-logging-mocks/package.json @@ -2,6 +2,7 @@ "name": "@kbn/logging-mocks", "version": "1.0.0", "private": true, + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0", "main": "./target_node/index.js" } \ No newline at end of file diff --git a/packages/kbn-logging/package.json b/packages/kbn-logging/package.json index 0220da8709d30..7b3b64b44d947 100644 --- a/packages/kbn-logging/package.json +++ b/packages/kbn-logging/package.json @@ -2,6 +2,7 @@ "name": "@kbn/logging", "version": "1.0.0", "private": true, + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0", "main": "./target_node/index.js" } \ No newline at end of file diff --git a/packages/kbn-server-http-tools/package.json b/packages/kbn-server-http-tools/package.json index 1d35f093c66e6..277bfbbf4ef97 100644 --- a/packages/kbn-server-http-tools/package.json +++ b/packages/kbn-server-http-tools/package.json @@ -2,6 +2,7 @@ "name": "@kbn/server-http-tools", "main": "./target_node/index.js", "version": "1.0.0", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true } diff --git a/packages/kbn-std/package.json b/packages/kbn-std/package.json index 12f52afbd05cd..68f59742310d1 100644 --- a/packages/kbn-std/package.json +++ b/packages/kbn-std/package.json @@ -2,6 +2,7 @@ "name": "@kbn/std", "main": "./target_node/index.js", "version": "1.0.0", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true } \ No newline at end of file diff --git a/packages/kbn-telemetry-tools/package.json b/packages/kbn-telemetry-tools/package.json index 61960422402ce..a0096f090e830 100644 --- a/packages/kbn-telemetry-tools/package.json +++ b/packages/kbn-telemetry-tools/package.json @@ -1,6 +1,7 @@ { "name": "@kbn/telemetry-tools", "version": "1.0.0", + "author": "Kibana Core", "license": "SSPL-1.0 OR Elastic License 2.0", "main": "./target_node/index.js", "private": true, From 49fd2901132c91791c0a46db7a0dd8e84ad54005 Mon Sep 17 00:00:00 2001 From: Rickyanto Ang Date: Tue, 2 Aug 2022 11:22:56 -0700 Subject: [PATCH 15/21] [Kubernetes Security][Bug Fix] Session view now closes upon choosing another entry within tree view (#137622) * fix for kubernetes session view issue * small fix for the breadcrumb --- .../components/container_name_widget/index.tsx | 4 ++-- .../components/tree_view_container/hooks.tsx | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/kubernetes_security/public/components/container_name_widget/index.tsx b/x-pack/plugins/kubernetes_security/public/components/container_name_widget/index.tsx index 152fa6a77dac9..7617072207524 100644 --- a/x-pack/plugins/kubernetes_security/public/components/container_name_widget/index.tsx +++ b/x-pack/plugins/kubernetes_security/public/components/container_name_widget/index.tsx @@ -232,11 +232,11 @@ export const ContainerNameWidget = ({ }, }); - const cellProps = () => { + const cellProps = useMemo(() => { return { css: styles.cellPad, }; - }; + }, [styles.cellPad]); return (

{ const [noResults, setNoResults] = useState(false); const [treeNavSelection, setTreeNavSelection] = useState({}); + const [hasSelection, setHasSelection] = useState(false); const filterQueryWithTimeRange = useMemo(() => { return JSON.parse( @@ -31,14 +32,10 @@ export const useTreeView = ({ globalFilter, indexPattern }: UseTreeViewProps) => }, [globalFilter.filterQuery, globalFilter.startDate, globalFilter.endDate]); const onTreeNavSelect = useCallback((selection: TreeNavSelection) => { + setHasSelection(false); setTreeNavSelection(selection); }, []); - const hasSelection = useMemo( - () => !!treeNavSelection[KubernetesCollection.cluster], - [treeNavSelection] - ); - const sessionViewFilter = useMemo( () => addTreeNavSelectionToFilterQuery(globalFilter.filterQuery, treeNavSelection), [globalFilter.filterQuery, treeNavSelection] @@ -50,6 +47,13 @@ export const useTreeView = ({ globalFilter, indexPattern }: UseTreeViewProps) => setTreeNavSelection({}); }, [filterQueryWithTimeRange]); + useEffect(() => { + if (!!treeNavSelection[KubernetesCollection.cluster]) { + setHasSelection(true); + setTreeNavSelection(treeNavSelection); + } + }, [treeNavSelection]); + return { noResults, setNoResults, From 2fdb0b37a3323a02735ed809e56e8e5de89ba862 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Tue, 2 Aug 2022 14:29:05 -0400 Subject: [PATCH 16/21] synthetics - adjust failing private locations tests (#137842) --- .../apis/uptime/rest/add_monitor_private_location.ts | 5 ++--- .../api_integration/apis/uptime/rest/add_monitor_project.ts | 5 ++--- .../test/api_integration/apis/uptime/rest/delete_monitor.ts | 5 ++--- .../apis/uptime/rest/sample_data/test_policy.ts | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/x-pack/test/api_integration/apis/uptime/rest/add_monitor_private_location.ts b/x-pack/test/api_integration/apis/uptime/rest/add_monitor_private_location.ts index 7b2dc0a3d1474..7668f2d1f840c 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/add_monitor_private_location.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/add_monitor_private_location.ts @@ -17,8 +17,7 @@ import { comparePolicies, getTestSyntheticsPolicy } from './sample_data/test_pol import { PrivateLocationTestService } from './services/private_location_test_service'; export default function ({ getService }: FtrProviderContext) { - // Failing: See https://github.com/elastic/kibana/issues/137328 - describe.skip('PrivateLocationMonitor', function () { + describe('PrivateLocationMonitor', function () { this.tags('skipCloud'); const kibanaServer = getService('kibanaServer'); const supertestAPI = getService('supertest'); @@ -35,7 +34,7 @@ export default function ({ getService }: FtrProviderContext) { before(async () => { await supertestAPI.post('/api/fleet/setup').set('kbn-xsrf', 'true').send().expect(200); await supertestAPI - .post('/api/fleet/epm/packages/synthetics/0.9.5') + .post('/api/fleet/epm/packages/synthetics/0.9.4') .set('kbn-xsrf', 'true') .send({ force: true }) .expect(200); diff --git a/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts b/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts index 6dbf36b3e99a5..64bf05211dfb9 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts @@ -16,8 +16,7 @@ import { PrivateLocationTestService } from './services/private_location_test_ser import { comparePolicies, getTestProjectSyntheticsPolicy } from './sample_data/test_policy'; export default function ({ getService }: FtrProviderContext) { - // Failing: See https://github.com/elastic/kibana/issues/137818 - describe.skip('[PUT] /api/uptime/service/monitors', function () { + describe('[PUT] /api/uptime/service/monitors', function () { this.tags('skipCloud'); const supertest = getService('supertest'); @@ -70,7 +69,7 @@ export default function ({ getService }: FtrProviderContext) { before(async () => { await supertest.post('/api/fleet/setup').set('kbn-xsrf', 'true').send().expect(200); await supertest - .post('/api/fleet/epm/packages/synthetics/0.9.5') + .post('/api/fleet/epm/packages/synthetics/0.9.4') .set('kbn-xsrf', 'true') .send({ force: true }) .expect(200); diff --git a/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts index f886eb4e49b4f..b26ed4f8972d0 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/delete_monitor.ts @@ -13,8 +13,7 @@ import { getFixtureJson } from './helper/get_fixture_json'; import { PrivateLocationTestService } from './services/private_location_test_service'; export default function ({ getService }: FtrProviderContext) { - // FAILING ON 8.4: https://github.com/elastic/kibana/issues/137338 - describe.skip('[DELETE] /internal/uptime/service/monitors', function () { + describe('[DELETE] /internal/uptime/service/monitors', function () { this.tags('skipCloud'); const supertest = getService('supertest'); @@ -42,7 +41,7 @@ export default function ({ getService }: FtrProviderContext) { _httpMonitorJson = getFixtureJson('http_monitor'); await supertest.post('/api/fleet/setup').set('kbn-xsrf', 'true').send().expect(200); await supertest - .post('/api/fleet/epm/packages/synthetics/0.9.5') + .post('/api/fleet/epm/packages/synthetics/0.9.4') .set('kbn-xsrf', 'true') .send({ force: true }) .expect(200); diff --git a/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts b/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts index b829eb355e8db..36012d4b66d51 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/sample_data/test_policy.ts @@ -14,7 +14,7 @@ export const getTestSyntheticsPolicy = (name: string): PackagePolicy => ({ version: 'WzMyNTcsMV0=', name: '5863efe0-0368-11ed-8df7-a7424c6f5167-5347cd10-0368-11ed-8df7-a7424c6f5167', namespace: 'default', - package: { name: 'synthetics', title: 'Elastic Synthetics', version: '0.9.5' }, + package: { name: 'synthetics', title: 'Elastic Synthetics', version: '0.9.4' }, enabled: true, policy_id: '5347cd10-0368-11ed-8df7-a7424c6f5167', output_id: '', @@ -256,7 +256,7 @@ export const getTestProjectSyntheticsPolicy = ( version: 'WzMwNTMsMV0=', name: 'check if title is present-Test private location 0', namespace: 'default', - package: { name: 'synthetics', title: 'Elastic Synthetics', version: '0.9.5' }, + package: { name: 'synthetics', title: 'Elastic Synthetics', version: '0.9.4' }, enabled: true, policy_id: '46034710-0ba6-11ed-ba04-5f123b9faa8b', output_id: '', From 788d688f1aadd5c821abcb6f00236763ae0d8b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Marcondes?= <55978943+cauemarcondes@users.noreply.github.com> Date: Tue, 2 Aug 2022 15:10:41 -0400 Subject: [PATCH 17/21] [APM] e2e tests fix (Comparison feature flag) (#137209) * call api to update settings * fixing comparison test * adding return * addressing pr comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../{comparison.ts => comparison.spec.ts} | 50 +++++++------------ .../apm/ftr_e2e/cypress/support/commands.ts | 22 ++++++-- .../apm/ftr_e2e/cypress/support/types.d.ts | 10 ++-- 3 files changed, 44 insertions(+), 38 deletions(-) rename x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/{comparison.ts => comparison.spec.ts} (68%) diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/comparison.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/comparison.spec.ts similarity index 68% rename from x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/comparison.ts rename to x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/comparison.spec.ts index 00455444b414b..d3ac4cc0e095f 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/comparison.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/feature_flag/comparison.spec.ts @@ -8,14 +8,9 @@ import { synthtrace } from '../../../../synthtrace'; import { opbeans } from '../../../fixtures/synthtrace/opbeans'; -const settingsPath = '/app/management/kibana/settings'; - const start = '2021-10-10T00:00:00.000Z'; const end = '2021-10-10T00:15:00.000Z'; -describe.skip('Comparison feature flag', () => { - const comparisonToggle = - '[data-test-subj="advancedSetting-editField-observability:enableComparisonByDefault"]'; - +describe('Comparison feature flag', () => { before(async () => { await synthtrace.index( opbeans({ @@ -29,17 +24,9 @@ describe.skip('Comparison feature flag', () => { await synthtrace.clean(); }); - beforeEach(() => { - cy.loginAsEditorUser(); - }); - describe('when comparison feature is enabled', () => { - it('shows the flag as enabled in kibana advanced settings', () => { - cy.visit(settingsPath); - - cy.get(comparisonToggle) - .should('have.attr', 'aria-checked') - .and('equal', 'true'); + beforeEach(() => { + cy.loginAsEditorUser(); }); it('shows the comparison feature enabled in services overview', () => { @@ -62,24 +49,19 @@ describe.skip('Comparison feature flag', () => { }); describe('when comparison feature is disabled', () => { - // Reverts to default state, which is comparison enabled - after(() => { - cy.visit(settingsPath); - cy.get(comparisonToggle).click(); - cy.contains('Save changes').should('not.be.disabled'); - cy.contains('Save changes').click(); + beforeEach(() => { + cy.loginAsEditorUser().then(() => { + // Disables comparison feature on advanced settings + cy.updateAdvancedSettings({ + 'observability:enableComparisonByDefault': false, + }); + }); }); - it('shows the flag as disabled in kibana advanced settings', () => { - cy.visit(settingsPath); - cy.get(comparisonToggle).click(); - cy.contains('Save changes').should('not.be.disabled'); - cy.contains('Save changes').click(); - cy.get(comparisonToggle).should('not.be.checked'); - - cy.get(comparisonToggle) - .should('have.attr', 'aria-checked') - .and('equal', 'false'); + after(() => { + cy.updateAdvancedSettings({ + 'observability:enableComparisonByDefault': true, + }); }); it('shows the comparison feature disabled in services overview', () => { @@ -89,7 +71,11 @@ describe.skip('Comparison feature flag', () => { }); it('shows the comparison feature disabled in dependencies overview page', () => { + cy.intercept('GET', '/internal/apm/dependencies/top_dependencies?*').as( + 'topDependenciesRequest' + ); cy.visit('/app/apm/dependencies'); + cy.wait('@topDependenciesRequest', { requestTimeout: 10000 }); cy.get('input[type="checkbox"]#comparison').should('not.be.checked'); cy.get('[data-test-subj="comparisonSelect"]').should('be.disabled'); }); diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts b/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts index 94c1f44cbcffc..0559b07b1cbf2 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/support/commands.ts @@ -11,11 +11,11 @@ import moment from 'moment'; import { AXE_CONFIG, AXE_OPTIONS } from '@kbn/axe-config'; Cypress.Commands.add('loginAsViewerUser', () => { - cy.loginAs({ username: 'viewer', password: 'changeme' }); + return cy.loginAs({ username: 'viewer', password: 'changeme' }); }); Cypress.Commands.add('loginAsEditorUser', () => { - cy.loginAs({ username: 'editor', password: 'changeme' }); + return cy.loginAs({ username: 'editor', password: 'changeme' }); }); Cypress.Commands.add( @@ -23,7 +23,7 @@ Cypress.Commands.add( ({ username, password }: { username: string; password: string }) => { cy.log(`Logging in as ${username}`); const kibanaUrl = Cypress.env('KIBANA_URL'); - cy.request({ + return cy.request({ log: false, method: 'POST', url: `${kibanaUrl}/internal/security/login`, @@ -84,6 +84,22 @@ Cypress.Commands.add( } ); +Cypress.Commands.add( + 'updateAdvancedSettings', + (settings: Record) => { + const kibanaUrl = Cypress.env('KIBANA_URL'); + cy.request({ + log: false, + method: 'POST', + url: `${kibanaUrl}/api/kibana/settings`, + body: { changes: settings }, + headers: { + 'kbn-xsrf': 'e2e_test', + }, + }); + } +); + // A11y configuration const axeConfig = { diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts b/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts index 0230ab1ef23a1..f46a54142de0e 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/support/types.d.ts @@ -7,14 +7,18 @@ declare namespace Cypress { interface Chainable { - loginAsViewerUser(): void; - loginAsEditorUser(): void; - loginAs(params: { username: string; password: string }): void; + loginAsViewerUser(): Cypress.Chainable>; + loginAsEditorUser(): Cypress.Chainable>; + loginAs(params: { + username: string; + password: string; + }): Cypress.Chainable>; changeTimeRange(value: string): void; selectAbsoluteTimeRange(start: string, end: string): void; expectAPIsToHaveBeenCalledWith(params: { apisIntercepted: string[]; value: string; }): void; + updateAdvancedSettings(settings: Record): void; } } From 2f7603de181a47cde19eccb6fd4b665954bd105b Mon Sep 17 00:00:00 2001 From: Justin Kambic Date: Tue, 2 Aug 2022 15:22:19 -0400 Subject: [PATCH 18/21] [UX Dashboard] Unify processor event (#135367) * Migrate page load distribution query to use data plugin. * Migrate breakdowns to use data plugin. * Delete page load dist breakdown from APM server. * Update comments. * Unify `ProcessorEvent` enum. * Fix linting and delete old code. * Fix import. * Delete obsolete snapshots. * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' * Fix remaining conflicts * Fix remaining conflicts * Fix import Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: emilioalvap --- .../elasticsearch_fieldnames.test.ts.snap | 54 ------------------- x-pack/plugins/apm/common/dependencies.ts | 2 +- .../apm/common/elasticsearch_fieldnames.ts | 13 ----- x-pack/plugins/apm/common/processor_event.ts | 9 +--- .../failed_transactions_correlations.tsx | 2 +- .../app/correlations/latency_correlations.tsx | 2 +- ...endendecy_operation_distribution_chart.tsx | 2 +- .../distribution/index.tsx | 2 +- .../waterfall/span_flyout/index.tsx | 2 +- .../waterfall/transaction_flyout/index.tsx | 2 +- .../waterfall_helpers/waterfall_helpers.ts | 2 +- .../duration_distribution_chart/index.tsx | 2 +- .../total_doc_count_label.tsx | 2 +- .../index.tsx | 2 +- .../shared/kuery_bar/use_processor_event.ts | 6 +-- .../metadata_table/error_metadata/index.tsx | 2 +- .../metadata_table/span_metadata/index.tsx | 2 +- .../transaction_metadata/index.tsx | 2 +- .../components/shared/span_links/index.tsx | 2 +- .../span_links/span_links_tab_content.tsx | 2 +- x-pack/plugins/apm/server/index.ts | 2 - .../create_anomaly_detection_jobs.ts | 2 +- .../collect_data_telemetry/tasks.ts | 2 +- .../get_destination_map.ts | 2 +- .../get_connection_stats/get_stats.ts | 2 +- .../create_apm_event_client/index.ts | 2 +- .../unpack_processor_events.ts | 2 +- .../server/lib/helpers/setup_request.test.ts | 2 +- ...et_is_using_service_destination_metrics.ts | 2 +- .../get_is_using_transaction_events.ts | 2 +- .../server/lib/helpers/transactions/index.ts | 2 +- .../get_transaction_error_count.ts | 2 +- .../alerts/register_anomaly_alert_type.ts | 2 +- .../alerts/register_error_count_alert_type.ts | 2 +- ...egister_transaction_duration_alert_type.ts | 2 +- ...ister_transaction_error_rate_alert_type.ts | 2 +- .../queries/fetch_duration_correlation.ts | 2 +- .../fetch_duration_field_candidates.ts | 2 +- .../queries/fetch_duration_fractions.ts | 2 +- .../queries/fetch_field_value_pairs.ts | 2 +- .../field_stats/fetch_boolean_field_stats.ts | 2 +- .../fetch_field_value_field_stats.ts | 2 +- .../queries/field_stats/fetch_fields_stats.ts | 2 +- .../field_stats/fetch_keyword_field_stats.ts | 2 +- .../field_stats/fetch_numeric_field_stats.ts | 2 +- .../apm/server/routes/correlations/route.ts | 2 +- .../correlations/utils/get_event_type.ts | 2 +- .../get_metadata_for_dependency.ts | 2 +- .../get_top_dependency_operations.ts | 2 +- .../dependencies/get_top_dependency_spans.ts | 2 +- .../environments/get_all_environments.ts | 2 +- .../routes/environments/get_environments.ts | 2 +- .../errors/distribution/get_buckets.test.ts | 2 +- .../routes/errors/distribution/get_buckets.ts | 2 +- .../get_top_erroneous_transactions.ts | 2 +- .../get_error_group_detailed_statistics.ts | 2 +- .../get_error_group_main_statistics.ts | 2 +- .../get_error_group_sample.ts | 2 +- .../event_metadata/get_event_metadata.ts | 2 +- .../has_historical_agent_data.ts | 2 +- .../infrastructure/get_infrastructure_data.ts | 2 +- .../java/gc/fetch_and_transform_gc_metrics.ts | 2 +- .../metrics/fetch_and_transform_metrics.ts | 2 +- .../get_service_count.ts | 2 +- .../routes/observability_overview/has_data.ts | 2 +- .../routes/service_groups/lookup_services.ts | 2 +- .../fetch_service_paths_from_trace_ids.ts | 2 +- .../routes/service_map/get_service_map.ts | 2 +- .../get_service_map_dependency_node_info.ts | 2 +- .../get_service_map_service_node_info.ts | 2 +- .../service_map/get_trace_sample_ids.ts | 2 +- .../routes/service_nodes/get_service_nodes.ts | 2 +- .../routes/services/get_service_agent.ts | 2 +- .../get_service_instance_metadata_details.ts | 2 +- ...vice_instances_system_metric_statistics.ts | 2 +- .../services/get_service_metadata_details.ts | 2 +- .../services/get_service_metadata_icons.ts | 2 +- .../services/get_service_node_metadata.ts | 2 +- ...ervices_from_error_and_metric_documents.ts | 2 +- .../get_sorted_and_filtered_services.ts | 2 +- .../get_service_profiling_statistics.ts | 2 +- .../get_service_profiling_timeline.ts | 2 +- .../get_agent_name_by_service.ts | 2 +- .../settings/custom_link/get_transaction.ts | 2 +- .../routes/span_links/get_linked_children.ts | 2 +- .../routes/span_links/get_linked_parents.ts | 2 +- .../span_links/get_span_links_details.ts | 2 +- .../routes/suggestions/get_suggestions.ts | 2 +- .../get_suggestions_with_terms_aggregation.ts | 2 +- .../server/routes/traces/get_trace_items.ts | 2 +- .../traces/get_trace_samples_by_query.ts | 2 +- .../routes/transactions/breakdown/index.ts | 2 +- .../transactions/get_transaction/index.ts | 2 +- .../get_transaction_by_trace/index.ts | 2 +- .../trace_samples/get_trace_samples/index.ts | 2 +- x-pack/plugins/observability/common/index.ts | 2 + .../common/processor_event.ts | 0 .../charts/visitor_breakdown_chart.tsx | 2 +- .../services/data/core_web_vitals_query.ts | 2 +- .../ux/public/services/data/projections.ts | 2 +- .../event_metadata/event_metadata.spec.ts | 2 +- .../tests/span_links/span_links.spec.ts | 2 +- 102 files changed, 100 insertions(+), 176 deletions(-) rename x-pack/plugins/{ux => observability}/common/processor_event.ts (100%) diff --git a/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap b/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap index b212d4bee63ab..1c7d4dddab38c 100644 --- a/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap +++ b/x-pack/plugins/apm/common/__snapshots__/elasticsearch_fieldnames.test.ts.snap @@ -11,8 +11,6 @@ exports[`Error AGENT_NAME 1`] = `"java"`; exports[`Error AGENT_VERSION 1`] = `"agent version"`; -exports[`Error CLIENT_GEO 1`] = `undefined`; - exports[`Error CLIENT_GEO_COUNTRY_ISO_CODE 1`] = `undefined`; exports[`Error CLOUD 1`] = ` @@ -39,8 +37,6 @@ exports[`Error CLOUD_REGION 1`] = `"europe-west1"`; exports[`Error CLOUD_SERVICE_NAME 1`] = `undefined`; -exports[`Error CLS_FIELD 1`] = `undefined`; - exports[`Error CONTAINER_ID 1`] = `undefined`; exports[`Error DESTINATION_ADDRESS 1`] = `undefined`; @@ -71,10 +67,6 @@ exports[`Error FAAS_ID 1`] = `undefined`; exports[`Error FAAS_TRIGGER_TYPE 1`] = `undefined`; -exports[`Error FCP_FIELD 1`] = `undefined`; - -exports[`Error FID_FIELD 1`] = `undefined`; - exports[`Error HOST 1`] = ` Object { "hostname": "my hostname", @@ -95,8 +87,6 @@ exports[`Error KUBERNETES 1`] = `undefined`; exports[`Error LABEL_NAME 1`] = `undefined`; -exports[`Error LCP_FIELD 1`] = `undefined`; - exports[`Error METRIC_CGROUP_MEMORY_LIMIT_BYTES 1`] = `undefined`; exports[`Error METRIC_CGROUP_MEMORY_USAGE_BYTES 1`] = `undefined`; @@ -145,8 +135,6 @@ exports[`Error PROFILE_ALLOC_SPACE 1`] = `undefined`; exports[`Error PROFILE_CPU_NS 1`] = `undefined`; -exports[`Error PROFILE_DURATION 1`] = `undefined`; - exports[`Error PROFILE_ID 1`] = `undefined`; exports[`Error PROFILE_INUSE_OBJECTS 1`] = `undefined`; @@ -217,12 +205,8 @@ exports[`Error SPAN_SUBTYPE 1`] = `undefined`; exports[`Error SPAN_TYPE 1`] = `undefined`; -exports[`Error TBT_FIELD 1`] = `undefined`; - exports[`Error TRACE_ID 1`] = `"trace id"`; -exports[`Error TRANSACTION_DOM_INTERACTIVE 1`] = `undefined`; - exports[`Error TRANSACTION_DURATION 1`] = `undefined`; exports[`Error TRANSACTION_DURATION_HISTOGRAM 1`] = `undefined`; @@ -239,8 +223,6 @@ exports[`Error TRANSACTION_ROOT 1`] = `undefined`; exports[`Error TRANSACTION_SAMPLED 1`] = `undefined`; -exports[`Error TRANSACTION_TIME_TO_FIRST_BYTE 1`] = `undefined`; - exports[`Error TRANSACTION_TYPE 1`] = `"request"`; exports[`Error TRANSACTION_URL 1`] = `undefined`; @@ -268,8 +250,6 @@ exports[`Span AGENT_NAME 1`] = `"java"`; exports[`Span AGENT_VERSION 1`] = `"agent version"`; -exports[`Span CLIENT_GEO 1`] = `undefined`; - exports[`Span CLIENT_GEO_COUNTRY_ISO_CODE 1`] = `undefined`; exports[`Span CLOUD 1`] = ` @@ -296,8 +276,6 @@ exports[`Span CLOUD_REGION 1`] = `"europe-west1"`; exports[`Span CLOUD_SERVICE_NAME 1`] = `undefined`; -exports[`Span CLS_FIELD 1`] = `undefined`; - exports[`Span CONTAINER_ID 1`] = `undefined`; exports[`Span DESTINATION_ADDRESS 1`] = `undefined`; @@ -328,10 +306,6 @@ exports[`Span FAAS_ID 1`] = `undefined`; exports[`Span FAAS_TRIGGER_TYPE 1`] = `undefined`; -exports[`Span FCP_FIELD 1`] = `undefined`; - -exports[`Span FID_FIELD 1`] = `undefined`; - exports[`Span HOST 1`] = `undefined`; exports[`Span HOST_HOSTNAME 1`] = `undefined`; @@ -348,8 +322,6 @@ exports[`Span KUBERNETES 1`] = `undefined`; exports[`Span LABEL_NAME 1`] = `undefined`; -exports[`Span LCP_FIELD 1`] = `undefined`; - exports[`Span METRIC_CGROUP_MEMORY_LIMIT_BYTES 1`] = `undefined`; exports[`Span METRIC_CGROUP_MEMORY_USAGE_BYTES 1`] = `undefined`; @@ -398,8 +370,6 @@ exports[`Span PROFILE_ALLOC_SPACE 1`] = `undefined`; exports[`Span PROFILE_CPU_NS 1`] = `undefined`; -exports[`Span PROFILE_DURATION 1`] = `undefined`; - exports[`Span PROFILE_ID 1`] = `undefined`; exports[`Span PROFILE_INUSE_OBJECTS 1`] = `undefined`; @@ -466,12 +436,8 @@ exports[`Span SPAN_SUBTYPE 1`] = `"my subtype"`; exports[`Span SPAN_TYPE 1`] = `"span type"`; -exports[`Span TBT_FIELD 1`] = `undefined`; - exports[`Span TRACE_ID 1`] = `"trace id"`; -exports[`Span TRANSACTION_DOM_INTERACTIVE 1`] = `undefined`; - exports[`Span TRANSACTION_DURATION 1`] = `undefined`; exports[`Span TRANSACTION_DURATION_HISTOGRAM 1`] = `undefined`; @@ -488,8 +454,6 @@ exports[`Span TRANSACTION_ROOT 1`] = `undefined`; exports[`Span TRANSACTION_SAMPLED 1`] = `undefined`; -exports[`Span TRANSACTION_TIME_TO_FIRST_BYTE 1`] = `undefined`; - exports[`Span TRANSACTION_TYPE 1`] = `undefined`; exports[`Span TRANSACTION_URL 1`] = `undefined`; @@ -517,8 +481,6 @@ exports[`Transaction AGENT_NAME 1`] = `"java"`; exports[`Transaction AGENT_VERSION 1`] = `"agent version"`; -exports[`Transaction CLIENT_GEO 1`] = `undefined`; - exports[`Transaction CLIENT_GEO_COUNTRY_ISO_CODE 1`] = `undefined`; exports[`Transaction CLOUD 1`] = ` @@ -545,8 +507,6 @@ exports[`Transaction CLOUD_REGION 1`] = `"europe-west1"`; exports[`Transaction CLOUD_SERVICE_NAME 1`] = `undefined`; -exports[`Transaction CLS_FIELD 1`] = `undefined`; - exports[`Transaction CONTAINER_ID 1`] = `"container1234567890abcdef"`; exports[`Transaction DESTINATION_ADDRESS 1`] = `undefined`; @@ -577,10 +537,6 @@ exports[`Transaction FAAS_ID 1`] = `undefined`; exports[`Transaction FAAS_TRIGGER_TYPE 1`] = `undefined`; -exports[`Transaction FCP_FIELD 1`] = `undefined`; - -exports[`Transaction FID_FIELD 1`] = `undefined`; - exports[`Transaction HOST 1`] = ` Object { "hostname": "my hostname", @@ -607,8 +563,6 @@ Object { exports[`Transaction LABEL_NAME 1`] = `undefined`; -exports[`Transaction LCP_FIELD 1`] = `undefined`; - exports[`Transaction METRIC_CGROUP_MEMORY_LIMIT_BYTES 1`] = `undefined`; exports[`Transaction METRIC_CGROUP_MEMORY_USAGE_BYTES 1`] = `undefined`; @@ -657,8 +611,6 @@ exports[`Transaction PROFILE_ALLOC_SPACE 1`] = `undefined`; exports[`Transaction PROFILE_CPU_NS 1`] = `undefined`; -exports[`Transaction PROFILE_DURATION 1`] = `undefined`; - exports[`Transaction PROFILE_ID 1`] = `undefined`; exports[`Transaction PROFILE_INUSE_OBJECTS 1`] = `undefined`; @@ -729,12 +681,8 @@ exports[`Transaction SPAN_SUBTYPE 1`] = `undefined`; exports[`Transaction SPAN_TYPE 1`] = `undefined`; -exports[`Transaction TBT_FIELD 1`] = `undefined`; - exports[`Transaction TRACE_ID 1`] = `"trace id"`; -exports[`Transaction TRANSACTION_DOM_INTERACTIVE 1`] = `undefined`; - exports[`Transaction TRANSACTION_DURATION 1`] = `1337`; exports[`Transaction TRANSACTION_DURATION_HISTOGRAM 1`] = `undefined`; @@ -751,8 +699,6 @@ exports[`Transaction TRANSACTION_ROOT 1`] = `undefined`; exports[`Transaction TRANSACTION_SAMPLED 1`] = `true`; -exports[`Transaction TRANSACTION_TIME_TO_FIRST_BYTE 1`] = `undefined`; - exports[`Transaction TRANSACTION_TYPE 1`] = `"transaction type"`; exports[`Transaction TRANSACTION_URL 1`] = `"http://www.elastic.co"`; diff --git a/x-pack/plugins/apm/common/dependencies.ts b/x-pack/plugins/apm/common/dependencies.ts index 51f0d505d5df8..de7dc69639b6d 100644 --- a/x-pack/plugins/apm/common/dependencies.ts +++ b/x-pack/plugins/apm/common/dependencies.ts @@ -6,7 +6,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ProcessorEvent } from './processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { PROCESSOR_EVENT, SPAN_DESTINATION_SERVICE_RESOURCE, diff --git a/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts b/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts index e4970ea2ac067..43d58a6f60a98 100644 --- a/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts +++ b/x-pack/plugins/apm/common/elasticsearch_fieldnames.ts @@ -128,23 +128,10 @@ export const CLIENT_GEO_COUNTRY_ISO_CODE = 'client.geo.country_iso_code'; // RUM Labels export const TRANSACTION_URL = 'url.full'; -export const CLIENT_GEO = 'client.geo'; export const USER_AGENT_DEVICE = 'user_agent.device.name'; export const USER_AGENT_OS = 'user_agent.os.name'; -export const TRANSACTION_TIME_TO_FIRST_BYTE = - 'transaction.marks.agent.timeToFirstByte'; -export const TRANSACTION_DOM_INTERACTIVE = - 'transaction.marks.agent.domInteractive'; - -export const FCP_FIELD = 'transaction.marks.agent.firstContentfulPaint'; -export const LCP_FIELD = 'transaction.marks.agent.largestContentfulPaint'; -export const TBT_FIELD = 'transaction.experience.tbt'; -export const FID_FIELD = 'transaction.experience.fid'; -export const CLS_FIELD = 'transaction.experience.cls'; - export const PROFILE_ID = 'profile.id'; -export const PROFILE_DURATION = 'profile.duration'; export const PROFILE_TOP_ID = 'profile.top.id'; export const PROFILE_STACK = 'profile.stack'; diff --git a/x-pack/plugins/apm/common/processor_event.ts b/x-pack/plugins/apm/common/processor_event.ts index 38f9fd7838db0..ba4626e85ee2e 100644 --- a/x-pack/plugins/apm/common/processor_event.ts +++ b/x-pack/plugins/apm/common/processor_event.ts @@ -4,16 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import * as t from 'io-ts'; -export enum ProcessorEvent { - transaction = 'transaction', - error = 'error', - metric = 'metric', - span = 'span', - profile = 'profile', -} - export const processorEventRt = t.union([ t.literal(ProcessorEvent.transaction), t.literal(ProcessorEvent.error), diff --git a/x-pack/plugins/apm/public/components/app/correlations/failed_transactions_correlations.tsx b/x-pack/plugins/apm/public/components/app/correlations/failed_transactions_correlations.tsx index e9093a28cbab9..8ca7c096d994e 100644 --- a/x-pack/plugins/apm/public/components/app/correlations/failed_transactions_correlations.tsx +++ b/x-pack/plugins/apm/public/components/app/correlations/failed_transactions_correlations.tsx @@ -28,6 +28,7 @@ import { i18n } from '@kbn/i18n'; import { useUiTracker } from '@kbn/observability-plugin/public'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { asPercent, asPreciseDecimal, @@ -55,7 +56,6 @@ import { OnAddFilter } from './context_popover/top_values'; import { useFailedTransactionsCorrelations } from './use_failed_transactions_correlations'; import { getTransactionDistributionChartData } from './get_transaction_distribution_chart_data'; import { ChartTitleToolTip } from './chart_title_tool_tip'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { MIN_TAB_TITLE_HEIGHT } from '../../shared/charts/duration_distribution_chart_with_scrubber'; import { TotalDocCountLabel } from '../../shared/charts/duration_distribution_chart/total_doc_count_label'; diff --git a/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx b/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx index fde85387be4fa..35941d960d62e 100644 --- a/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx +++ b/x-pack/plugins/apm/public/components/app/correlations/latency_correlations.tsx @@ -27,6 +27,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { useUiTracker } from '@kbn/observability-plugin/public'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { asPreciseDecimal } from '../../../../common/utils/formatters'; import { LatencyCorrelation } from '../../../../common/correlations/latency_correlations/types'; import { FieldStats } from '../../../../common/correlations/field_stats_types'; @@ -51,7 +52,6 @@ import { getTransactionDistributionChartData } from './get_transaction_distribut import { useTheme } from '../../../hooks/use_theme'; import { ChartTitleToolTip } from './chart_title_tool_tip'; import { getLatencyCorrelationImpactLabel } from './utils/get_failed_transactions_correlation_impact_label'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { MIN_TAB_TITLE_HEIGHT } from '../../shared/charts/duration_distribution_chart_with_scrubber'; export function FallbackCorrelationBadge() { diff --git a/x-pack/plugins/apm/public/components/app/dependency_operation_detail_view/dependendecy_operation_distribution_chart.tsx b/x-pack/plugins/apm/public/components/app/dependency_operation_detail_view/dependendecy_operation_distribution_chart.tsx index be4a6f407ed7d..8d53c90887f01 100644 --- a/x-pack/plugins/apm/public/components/app/dependency_operation_detail_view/dependendecy_operation_distribution_chart.tsx +++ b/x-pack/plugins/apm/public/components/app/dependency_operation_detail_view/dependendecy_operation_distribution_chart.tsx @@ -5,9 +5,9 @@ * 2.0. */ import { i18n } from '@kbn/i18n'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import React from 'react'; import { DEFAULT_PERCENTILE_THRESHOLD } from '../../../../common/correlations/constants'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { useApmParams } from '../../../hooks/use_apm_params'; import { useFetcher } from '../../../hooks/use_fetcher'; import { useSampleChartSelection } from '../../../hooks/use_sample_chart_selection'; diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx index 495ecca256428..fcc70bed96e28 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/distribution/index.tsx @@ -10,6 +10,7 @@ import { EuiSpacer } from '@elastic/eui'; import React from 'react'; import { useHistory } from 'react-router-dom'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; @@ -17,7 +18,6 @@ import type { TabContentProps } from '../types'; import { useWaterfallFetcher } from '../use_waterfall_fetcher'; import { WaterfallWithSummary } from '../waterfall_with_summary'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { useApmParams } from '../../../../hooks/use_apm_params'; import { useTimeRange } from '../../../../hooks/use_time_range'; diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/index.tsx index 825da91c7d385..35329fe4bf17a 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/index.tsx @@ -21,6 +21,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { isEmpty } from 'lodash'; import React, { Fragment } from 'react'; import { Span } from '../../../../../../../../typings/es_schemas/ui/span'; @@ -40,7 +41,6 @@ import { ResponsiveFlyout } from '../responsive_flyout'; import { SpanLinksCount } from '../waterfall_helpers/waterfall_helpers'; import { SpanDatabase } from './span_db'; import { StickySpanProperties } from './sticky_span_properties'; -import { ProcessorEvent } from '../../../../../../../../common/processor_event'; function formatType(type: string) { switch (type) { diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/transaction_flyout/index.tsx b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/transaction_flyout/index.tsx index 9e8661fd523fb..b2b5539851a7e 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/transaction_flyout/index.tsx +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/transaction_flyout/index.tsx @@ -17,8 +17,8 @@ import { EuiTitle, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import React from 'react'; -import { ProcessorEvent } from '../../../../../../../../common/processor_event'; import { Transaction } from '../../../../../../../../typings/es_schemas/ui/transaction'; import { TransactionMetadata } from '../../../../../../shared/metadata_table/transaction_metadata'; import { getSpanLinksTabContent } from '../../../../../../shared/span_links/span_links_tab_content'; diff --git a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers.ts b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers.ts index cf53606afd9b4..e787f02aae4f8 100644 --- a/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers.ts +++ b/x-pack/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers.ts @@ -7,11 +7,11 @@ import { euiPaletteColorBlind } from '@elastic/eui'; import { first, flatten, groupBy, isEmpty, sortBy, uniq } from 'lodash'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import type { APIReturnType } from '../../../../../../../services/rest/create_call_apm_api'; import type { APMError } from '../../../../../../../../typings/es_schemas/ui/apm_error'; import type { Span } from '../../../../../../../../typings/es_schemas/ui/span'; import type { Transaction } from '../../../../../../../../typings/es_schemas/ui/transaction'; -import { ProcessorEvent } from '../../../../../../../../common/processor_event'; type TraceAPIResponse = APIReturnType<'GET /internal/apm/traces/{traceId}'>; diff --git a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx index 03e2af308a798..8e688832f7f36 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx @@ -31,6 +31,7 @@ import { i18n } from '@kbn/i18n'; import { useChartTheme } from '@kbn/observability-plugin/public'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getDurationFormatter } from '../../../../../common/utils/formatters'; import type { HistogramItem } from '../../../../../common/correlations/types'; import { DEFAULT_PERCENTILE_THRESHOLD } from '../../../../../common/correlations/constants'; @@ -39,7 +40,6 @@ import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; import { useTheme } from '../../../../hooks/use_theme'; import { ChartContainer } from '../chart_container'; -import { ProcessorEvent } from '../../../../../common/processor_event'; const NUMBER_OF_TRANSACTIONS_LABEL = i18n.translate( 'xpack.apm.durationDistribution.chart.numberOfTransactionsLabel', diff --git a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/total_doc_count_label.tsx b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/total_doc_count_label.tsx index 06b290afee8aa..ec601b77005e2 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/total_doc_count_label.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/total_doc_count_label.tsx @@ -9,7 +9,7 @@ import { useEuiTheme } from '@elastic/eui'; import { EuiText } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; -import { ProcessorEvent } from '../../../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; interface Props { eventType: ProcessorEvent.transaction | ProcessorEvent.span; diff --git a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart_with_scrubber/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart_with_scrubber/index.tsx index 25d10b7f60edf..0cd1c0f2b639a 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart_with_scrubber/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart_with_scrubber/index.tsx @@ -17,6 +17,7 @@ import { EuiText, EuiTitle, } from '@elastic/eui'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ChartTitleToolTip } from '../../../app/correlations/chart_title_tool_tip'; import { getDurationFormatter } from '../../../../../common/utils/formatters'; import { @@ -25,7 +26,6 @@ import { } from '../duration_distribution_chart'; import { TotalDocCountLabel } from '../duration_distribution_chart/total_doc_count_label'; import { FETCH_STATUS } from '../../../../hooks/use_fetcher'; -import { ProcessorEvent } from '../../../../../common/processor_event'; // Format the selected latency range for the "Clear selection" badge. // If the two values share the same unit, it will only displayed once. diff --git a/x-pack/plugins/apm/public/components/shared/kuery_bar/use_processor_event.ts b/x-pack/plugins/apm/public/components/shared/kuery_bar/use_processor_event.ts index 11098d014c83a..d8abb49e42277 100644 --- a/x-pack/plugins/apm/public/components/shared/kuery_bar/use_processor_event.ts +++ b/x-pack/plugins/apm/public/components/shared/kuery_bar/use_processor_event.ts @@ -5,11 +5,9 @@ * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { useLocation } from 'react-router-dom'; -import { - ProcessorEvent, - UIProcessorEvent, -} from '../../../../common/processor_event'; +import { UIProcessorEvent } from '../../../../common/processor_event'; /** * Infer the processor.event to used based on the route path diff --git a/x-pack/plugins/apm/public/components/shared/metadata_table/error_metadata/index.tsx b/x-pack/plugins/apm/public/components/shared/metadata_table/error_metadata/index.tsx index cfc15905dbe0b..95b19328367c9 100644 --- a/x-pack/plugins/apm/public/components/shared/metadata_table/error_metadata/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/metadata_table/error_metadata/index.tsx @@ -6,11 +6,11 @@ */ import React, { useMemo } from 'react'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { APMError } from '../../../../../typings/es_schemas/ui/apm_error'; import { getSectionsFromFields } from '../helper'; import { MetadataTable } from '..'; import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; -import { ProcessorEvent } from '../../../../../common/processor_event'; interface Props { error: APMError; diff --git a/x-pack/plugins/apm/public/components/shared/metadata_table/span_metadata/index.tsx b/x-pack/plugins/apm/public/components/shared/metadata_table/span_metadata/index.tsx index 922f83586805c..6b00d20b060e0 100644 --- a/x-pack/plugins/apm/public/components/shared/metadata_table/span_metadata/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/metadata_table/span_metadata/index.tsx @@ -6,11 +6,11 @@ */ import React, { useMemo } from 'react'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Span } from '../../../../../typings/es_schemas/ui/span'; import { getSectionsFromFields } from '../helper'; import { MetadataTable } from '..'; import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; -import { ProcessorEvent } from '../../../../../common/processor_event'; interface Props { span: Span; diff --git a/x-pack/plugins/apm/public/components/shared/metadata_table/transaction_metadata/index.tsx b/x-pack/plugins/apm/public/components/shared/metadata_table/transaction_metadata/index.tsx index bc2eb72a4f8ca..d24ac369e050d 100644 --- a/x-pack/plugins/apm/public/components/shared/metadata_table/transaction_metadata/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/metadata_table/transaction_metadata/index.tsx @@ -6,10 +6,10 @@ */ import React, { useMemo } from 'react'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Transaction } from '../../../../../typings/es_schemas/ui/transaction'; import { getSectionsFromFields } from '../helper'; import { MetadataTable } from '..'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { FETCH_STATUS, useFetcher } from '../../../../hooks/use_fetcher'; interface Props { diff --git a/x-pack/plugins/apm/public/components/shared/span_links/index.tsx b/x-pack/plugins/apm/public/components/shared/span_links/index.tsx index 0dc0213e92d44..77d0451adca55 100644 --- a/x-pack/plugins/apm/public/components/shared/span_links/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/span_links/index.tsx @@ -13,6 +13,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useMemo, useState } from 'react'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { useApmParams } from '../../../hooks/use_apm_params'; import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; import { useTimeRange } from '../../../hooks/use_time_range'; @@ -20,7 +21,6 @@ import { SpanLinksCount } from '../../app/transaction_details/waterfall_with_sum import { KueryBar } from '../kuery_bar'; import { SpanLinksCallout } from './span_links_callout'; import { SpanLinksTable } from './span_links_table'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { useLocalStorage } from '../../../hooks/use_local_storage'; interface Props { diff --git a/x-pack/plugins/apm/public/components/shared/span_links/span_links_tab_content.tsx b/x-pack/plugins/apm/public/components/shared/span_links/span_links_tab_content.tsx index c0e806f80b52f..21b404482e419 100644 --- a/x-pack/plugins/apm/public/components/shared/span_links/span_links_tab_content.tsx +++ b/x-pack/plugins/apm/public/components/shared/span_links/span_links_tab_content.tsx @@ -7,8 +7,8 @@ import { EuiNotificationBadge, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SpanLinks } from '.'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { SpanLinksCount } from '../../app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers'; import { TechnicalPreviewBadge } from '../technical_preview_badge'; diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index 5058b86249f2d..5dbee19cbf866 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -126,5 +126,3 @@ export type { APIEndpoint, } from './routes/apm_routes/get_global_apm_server_route_repository'; export type { APMRouteHandlerResources } from './routes/typings'; - -export type { ProcessorEvent } from '../common/processor_event'; diff --git a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts index 3be864fe8127e..fd369cd1328f2 100644 --- a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts +++ b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts @@ -10,13 +10,13 @@ import { Logger } from '@kbn/core/server'; import { snakeCase } from 'lodash'; import moment from 'moment'; import uuid from 'uuid/v4'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ML_ERRORS } from '../../../common/anomaly_detection'; import { METRICSET_NAME, PROCESSOR_EVENT, } from '../../../common/elasticsearch_fieldnames'; import { Environment } from '../../../common/environment_rt'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { withApmSpan } from '../../utils/with_apm_span'; import { Setup } from '../helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts index 838091a1ef657..f315c0a1ce521 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts @@ -7,8 +7,8 @@ import { fromKueryExpression } from '@kbn/es-query'; import { flatten, merge, sortBy, sum, pickBy } from 'lodash'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { asMutableArray } from '../../../../common/utils/as_mutable_array'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { TelemetryTask } from '.'; import { AGENT_NAMES, RUM_AGENT_NAMES } from '../../../../common/agent_name'; import { diff --git a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_destination_map.ts b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_destination_map.ts index bb3defa93ac0c..54b487ebf36e5 100644 --- a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_destination_map.ts +++ b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_destination_map.ts @@ -8,6 +8,7 @@ import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import objectHash from 'object-hash'; import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getOffsetInMs } from '../../../../common/utils/get_offset_in_ms'; import { ENVIRONMENT_NOT_DEFINED } from '../../../../common/environment_filter_values'; import { asMutableArray } from '../../../../common/utils/as_mutable_array'; @@ -23,7 +24,6 @@ import { SPAN_SUBTYPE, SPAN_TYPE, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { Setup } from '../../helpers/setup_request'; import { withApmSpan } from '../../../utils/with_apm_span'; import { Node, NodeType } from '../../../../common/connections'; diff --git a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts index 3f7fe3d168a9a..7057847c34c0c 100644 --- a/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts +++ b/x-pack/plugins/apm/server/lib/connections/get_connection_stats/get_stats.ts @@ -9,6 +9,7 @@ import { sum } from 'lodash'; import objectHash from 'object-hash'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AgentName } from '../../../../typings/es_schemas/ui/fields/agent'; import { getOffsetInMs } from '../../../../common/utils/get_offset_in_ms'; import { ENVIRONMENT_NOT_DEFINED } from '../../../../common/environment_filter_values'; @@ -24,7 +25,6 @@ import { SPAN_SUBTYPE, SPAN_TYPE, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { getBucketSize } from '../../helpers/get_bucket_size'; import { EventOutcome } from '../../../../common/event_outcome'; import { Setup } from '../../helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts index a3291aa1dd7e0..9488c993bc08b 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/index.ts @@ -20,9 +20,9 @@ import { } from '@kbn/core/types/elasticsearch'; import { unwrapEsResponse } from '@kbn/observability-plugin/server'; import { omit } from 'lodash'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Profile } from '../../../../../typings/es_schemas/ui/profile'; import { withApmSpan } from '../../../../utils/with_apm_span'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { APMError } from '../../../../../typings/es_schemas/ui/apm_error'; import { Metric } from '../../../../../typings/es_schemas/ui/metric'; import { Span } from '../../../../../typings/es_schemas/ui/span'; diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts index 3ef5a715e2c20..ea83728b64ac0 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts @@ -7,8 +7,8 @@ import { uniq, defaultsDeep, cloneDeep } from 'lodash'; import { ESSearchRequest, ESFilter } from '@kbn/core/types/elasticsearch'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { PROCESSOR_EVENT } from '../../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { ApmIndicesConfig } from '../../../../routes/settings/apm_indices/get_apm_indices'; const processorEventIndexMap = { diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index db4825680eae0..3b6ea992aa078 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -9,7 +9,7 @@ import { elasticsearchServiceMock } from '@kbn/core/server/mocks'; import { setupRequest } from './setup_request'; import { APMConfig } from '../..'; import { APMRouteHandlerResources } from '../../routes/typings'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getApmIndices } from '../../routes/settings/apm_indices/get_apm_indices'; jest.mock('../../routes/settings/apm_indices/get_apm_indices', () => ({ diff --git a/x-pack/plugins/apm/server/lib/helpers/spans/get_is_using_service_destination_metrics.ts b/x-pack/plugins/apm/server/lib/helpers/spans/get_is_using_service_destination_metrics.ts index c39ac6c8eb475..438f4b5d7eb5c 100644 --- a/x-pack/plugins/apm/server/lib/helpers/spans/get_is_using_service_destination_metrics.ts +++ b/x-pack/plugins/apm/server/lib/helpers/spans/get_is_using_service_destination_metrics.ts @@ -11,6 +11,7 @@ import { rangeQuery, termQuery, } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { METRICSET_NAME, SPAN_DESTINATION_SERVICE_RESPONSE_TIME_COUNT, @@ -18,7 +19,6 @@ import { SPAN_DURATION, SPAN_NAME, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { Setup } from '../setup_request'; export function getProcessorEventForServiceDestinationStatistics( diff --git a/x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.ts b/x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.ts index 7db898af4a810..6f28c966142fb 100644 --- a/x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/transactions/get_is_using_transaction_events.ts @@ -6,9 +6,9 @@ */ import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getSearchAggregatedTransactions } from '.'; import { Setup } from '../setup_request'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { APMEventClient } from '../create_es_client/create_apm_event_client'; import { SearchAggregatedTransactionSetting } from '../../../../common/aggregated_transactions'; diff --git a/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts b/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts index f98540a85b761..afaaf37c3362c 100644 --- a/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/transactions/index.ts @@ -6,8 +6,8 @@ */ import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SearchAggregatedTransactionSetting } from '../../../../common/aggregated_transactions'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { TRANSACTION_DURATION, TRANSACTION_DURATION_HISTOGRAM, diff --git a/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_count.ts b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_count.ts index f283a912bc3cd..1de9744914e27 100644 --- a/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_count.ts +++ b/x-pack/plugins/apm/server/routes/alerts/chart_preview/get_transaction_error_count.ts @@ -6,8 +6,8 @@ */ import { rangeQuery, termQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { AlertParams } from '../route'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { Setup } from '../../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/alerts/register_anomaly_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_anomaly_alert_type.ts index 7f978c4f61161..b63be80438189 100644 --- a/x-pack/plugins/apm/server/routes/alerts/register_anomaly_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_anomaly_alert_type.ts @@ -18,6 +18,7 @@ import { ESSearchResponse } from '@kbn/core/types/elasticsearch'; import { KibanaRequest } from '@kbn/core/server'; import { termQuery } from '@kbn/observability-plugin/server'; import { createLifecycleRuleTypeFactory } from '@kbn/rule-registry-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AlertType, ALERT_TYPES_CONFIG, @@ -40,7 +41,6 @@ import { getEnvironmentLabel, } from '../../../common/environment_filter_values'; import { ANOMALY_SEVERITY } from '../../../common/ml_constants'; -import { ProcessorEvent } from '../../../common/processor_event'; import { asMutableArray } from '../../../common/utils/as_mutable_array'; import { getAlertUrlTransaction } from '../../../common/utils/formatters'; import { getMLJobs } from '../service_map/get_service_anomalies'; diff --git a/x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.ts index 7c9422d34948d..3cf88aaac8d4e 100644 --- a/x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_error_count_alert_type.ts @@ -14,6 +14,7 @@ import { } from '@kbn/rule-data-utils'; import { createLifecycleRuleTypeFactory } from '@kbn/rule-registry-plugin/server'; import { termQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ENVIRONMENT_NOT_DEFINED, getEnvironmentEsField, @@ -31,7 +32,6 @@ import { SERVICE_ENVIRONMENT, SERVICE_NAME, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; import { apmActionVariables } from './action_variables'; diff --git a/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.ts index 58fd9323f8702..492feffb4dc94 100644 --- a/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_transaction_duration_alert_type.ts @@ -15,6 +15,7 @@ import { import { firstValueFrom } from 'rxjs'; import { asDuration } from '@kbn/observability-plugin/common/utils/formatters'; import { createLifecycleRuleTypeFactory } from '@kbn/rule-registry-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getAlertUrlTransaction } from '../../../common/utils/formatters'; import { SearchAggregatedTransactionSetting } from '../../../common/aggregated_transactions'; import { @@ -33,7 +34,6 @@ import { getEnvironmentEsField, getEnvironmentLabel, } from '../../../common/environment_filter_values'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { getDurationFormatter } from '../../../common/utils/formatters'; import { diff --git a/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts index ceecaeb961dd6..c6d80d70c4ef7 100644 --- a/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/routes/alerts/register_transaction_error_rate_alert_type.ts @@ -15,6 +15,7 @@ import { import { createLifecycleRuleTypeFactory } from '@kbn/rule-registry-plugin/server'; import { asPercent } from '@kbn/observability-plugin/common/utils/formatters'; import { termQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ENVIRONMENT_NOT_DEFINED, getEnvironmentEsField, @@ -35,7 +36,6 @@ import { TRANSACTION_TYPE, } from '../../../common/elasticsearch_fieldnames'; import { EventOutcome } from '../../../common/event_outcome'; -import { ProcessorEvent } from '../../../common/processor_event'; import { asDecimalOrInteger } from '../../../common/utils/formatters'; import { environmentQuery } from '../../../common/utils/environment_query'; import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_correlation.ts b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_correlation.ts index f076aec310c9c..4fb5f8da74c1c 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_correlation.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_correlation.ts @@ -6,6 +6,7 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SPAN_DURATION, TRANSACTION_DURATION, @@ -13,7 +14,6 @@ import { import type { CommonCorrelationsQueryParams } from '../../../../common/correlations/types'; import { Setup } from '../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { getCommonCorrelationsQuery } from './get_common_correlations_query'; export const fetchDurationCorrelation = async ({ diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_field_candidates.ts b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_field_candidates.ts index 323bb78806100..c73bea223635c 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_field_candidates.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_field_candidates.ts @@ -7,6 +7,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { ES_FIELD_TYPES } from '@kbn/field-types'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import type { CommonCorrelationsQueryParams } from '../../../../common/correlations/types'; import { FIELD_PREFIX_TO_EXCLUDE_AS_CANDIDATE, @@ -17,7 +18,6 @@ import { import { hasPrefixToInclude } from '../../../../common/correlations/utils'; import { Setup } from '../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { getCommonCorrelationsQuery } from './get_common_correlations_query'; const SUPPORTED_ES_FIELD_TYPES = [ diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_fractions.ts b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_fractions.ts index 5e0fe08f8bf4d..3a1aeae80c081 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_fractions.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_duration_fractions.ts @@ -7,12 +7,12 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { CommonCorrelationsQueryParams } from '../../../../common/correlations/types'; import { SPAN_DURATION, TRANSACTION_DURATION, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { Setup } from '../../../lib/helpers/setup_request'; import { getCommonCorrelationsQuery } from './get_common_correlations_query'; diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_field_value_pairs.ts b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_field_value_pairs.ts index e18f9d4f71e32..83f9e2cb3dbda 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/fetch_field_value_pairs.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/fetch_field_value_pairs.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import type { FieldValuePair, CommonCorrelationsQueryParams, @@ -13,7 +14,6 @@ import { TERMS_SIZE } from '../../../../common/correlations/constants'; import { splitAllSettledPromises } from '../utils'; import { Setup } from '../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { getCommonCorrelationsQuery } from './get_common_correlations_query'; export const fetchFieldValuePairs = async ({ diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_boolean_field_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_boolean_field_stats.ts index d479a10fda45e..0d03843fd2088 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_boolean_field_stats.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_boolean_field_stats.ts @@ -5,13 +5,13 @@ * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { CommonCorrelationsQueryParams, FieldValuePair, } from '../../../../../common/correlations/types'; import { BooleanFieldStats } from '../../../../../common/correlations/field_stats_types'; import { Setup } from '../../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { getCommonCorrelationsQuery } from '../get_common_correlations_query'; export const fetchBooleanFieldStats = async ({ diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_field_value_field_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_field_value_field_stats.ts index b7236b6a603c7..9208a8ad682d3 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_field_value_field_stats.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_field_value_field_stats.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { CommonCorrelationsQueryParams, FieldValuePair, @@ -14,7 +15,6 @@ import { TopValueBucket, } from '../../../../../common/correlations/field_stats_types'; import { Setup } from '../../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { getCommonCorrelationsQuery } from '../get_common_correlations_query'; export const fetchFieldValueFieldStats = async ({ diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_fields_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_fields_stats.ts index 05da7d77c281d..2cd1843c6d008 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_fields_stats.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_fields_stats.ts @@ -7,6 +7,7 @@ import { chunk } from 'lodash'; import { ES_FIELD_TYPES } from '@kbn/field-types'; import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { CommonCorrelationsQueryParams, FieldValuePair, @@ -16,7 +17,6 @@ import { fetchKeywordFieldStats } from './fetch_keyword_field_stats'; import { fetchNumericFieldStats } from './fetch_numeric_field_stats'; import { fetchBooleanFieldStats } from './fetch_boolean_field_stats'; import { Setup } from '../../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../../common/processor_event'; export const fetchFieldsStats = async ({ setup, diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_keyword_field_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_keyword_field_stats.ts index 6803f7a248f1f..30e88c0eb8efb 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_keyword_field_stats.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_keyword_field_stats.ts @@ -5,13 +5,13 @@ * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { CommonCorrelationsQueryParams, FieldValuePair, } from '../../../../../common/correlations/types'; import { KeywordFieldStats } from '../../../../../common/correlations/field_stats_types'; import { Setup } from '../../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { getCommonCorrelationsQuery } from '../get_common_correlations_query'; export const fetchKeywordFieldStats = async ({ diff --git a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_numeric_field_stats.ts b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_numeric_field_stats.ts index a2e512a30fda8..04b43e09d182a 100644 --- a/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_numeric_field_stats.ts +++ b/x-pack/plugins/apm/server/routes/correlations/queries/field_stats/fetch_numeric_field_stats.ts @@ -6,6 +6,7 @@ */ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { NumericFieldStats, TopValueBucket, @@ -15,7 +16,6 @@ import { FieldValuePair, } from '../../../../../common/correlations/types'; import { Setup } from '../../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { getCommonCorrelationsQuery } from '../get_common_correlations_query'; export const fetchNumericFieldStats = async ({ diff --git a/x-pack/plugins/apm/server/routes/correlations/route.ts b/x-pack/plugins/apm/server/routes/correlations/route.ts index 8d451c08647e0..4000dcb53676e 100644 --- a/x-pack/plugins/apm/server/routes/correlations/route.ts +++ b/x-pack/plugins/apm/server/routes/correlations/route.ts @@ -12,6 +12,7 @@ import { i18n } from '@kbn/i18n'; import { toNumberRt } from '@kbn/io-ts-utils'; import { termQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { isActivePlatinumLicense } from '../../../common/license_check'; import { setupRequest } from '../../lib/helpers/setup_request'; @@ -19,7 +20,6 @@ import { setupRequest } from '../../lib/helpers/setup_request'; import { createApmServerRoute } from '../apm_routes/create_apm_server_route'; import { environmentRt, kueryRt, rangeRt } from '../default_api_types'; import { fetchDurationFieldCandidates } from './queries/fetch_duration_field_candidates'; -import { ProcessorEvent } from '../../../common/processor_event'; import { SERVICE_NAME, TRANSACTION_NAME, diff --git a/x-pack/plugins/apm/server/routes/correlations/utils/get_event_type.ts b/x-pack/plugins/apm/server/routes/correlations/utils/get_event_type.ts index da6534beb353f..aa3afb27f6014 100644 --- a/x-pack/plugins/apm/server/routes/correlations/utils/get_event_type.ts +++ b/x-pack/plugins/apm/server/routes/correlations/utils/get_event_type.ts @@ -5,8 +5,8 @@ * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { LatencyDistributionChartType } from '../../../../common/latency_distribution_chart_types'; -import { ProcessorEvent } from '../../../../common/processor_event'; const { transactionLatency, diff --git a/x-pack/plugins/apm/server/routes/dependencies/get_metadata_for_dependency.ts b/x-pack/plugins/apm/server/routes/dependencies/get_metadata_for_dependency.ts index 5c18d57d11c49..610ad061eead4 100644 --- a/x-pack/plugins/apm/server/routes/dependencies/get_metadata_for_dependency.ts +++ b/x-pack/plugins/apm/server/routes/dependencies/get_metadata_for_dependency.ts @@ -6,8 +6,8 @@ */ import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { maybe } from '../../../common/utils/maybe'; -import { ProcessorEvent } from '../../../common/processor_event'; import { SPAN_DESTINATION_SERVICE_RESOURCE } from '../../../common/elasticsearch_fieldnames'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_operations.ts b/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_operations.ts index dcf9ce40515c0..5db5e3c40f997 100644 --- a/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_operations.ts +++ b/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_operations.ts @@ -10,6 +10,7 @@ import { rangeQuery, termQuery, } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { EVENT_OUTCOME, SPAN_DESTINATION_SERVICE_RESOURCE, @@ -18,7 +19,6 @@ import { } from '../../../common/elasticsearch_fieldnames'; import { Environment } from '../../../common/environment_rt'; import { EventOutcome } from '../../../common/event_outcome'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { getOffsetInMs } from '../../../common/utils/get_offset_in_ms'; import { diff --git a/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_spans.ts b/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_spans.ts index 86a6dfb0aaf8e..112c0d0a0dd46 100644 --- a/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_spans.ts +++ b/x-pack/plugins/apm/server/routes/dependencies/get_top_dependency_spans.ts @@ -12,6 +12,7 @@ import { termsQuery, } from '@kbn/observability-plugin/server'; import { compact, keyBy } from 'lodash'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AGENT_NAME, EVENT_OUTCOME, @@ -27,7 +28,6 @@ import { } from '../../../common/elasticsearch_fieldnames'; import { Environment } from '../../../common/environment_rt'; import { EventOutcome } from '../../../common/event_outcome'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { AgentName } from '../../../typings/es_schemas/ui/fields/agent'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/environments/get_all_environments.ts b/x-pack/plugins/apm/server/routes/environments/get_all_environments.ts index bbfb9071d3bc6..808138a07f43e 100644 --- a/x-pack/plugins/apm/server/routes/environments/get_all_environments.ts +++ b/x-pack/plugins/apm/server/routes/environments/get_all_environments.ts @@ -6,7 +6,7 @@ */ import { termQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Setup } from '../../lib/helpers/setup_request'; import { SERVICE_NAME, diff --git a/x-pack/plugins/apm/server/routes/environments/get_environments.ts b/x-pack/plugins/apm/server/routes/environments/get_environments.ts index 6676b8061c354..bbb99d873e81a 100644 --- a/x-pack/plugins/apm/server/routes/environments/get_environments.ts +++ b/x-pack/plugins/apm/server/routes/environments/get_environments.ts @@ -6,12 +6,12 @@ */ import { rangeQuery, termQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SERVICE_ENVIRONMENT, SERVICE_NAME, } from '../../../common/elasticsearch_fieldnames'; import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values'; -import { ProcessorEvent } from '../../../common/processor_event'; import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; import { Setup } from '../../lib/helpers/setup_request'; import { Environment } from '../../../common/environment_rt'; diff --git a/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.test.ts b/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.test.ts index 871df10d9bafa..6d460e5d42d7b 100644 --- a/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.test.ts +++ b/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.test.ts @@ -7,7 +7,7 @@ import { getBuckets } from './get_buckets'; import { APMConfig } from '../../..'; -import { ProcessorEvent } from '../../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; describe('get buckets', () => { let clientSpy: jest.Mock; diff --git a/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.ts b/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.ts index 34fd6be58a57d..9f2cf76b2cbce 100644 --- a/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.ts +++ b/x-pack/plugins/apm/server/routes/errors/distribution/get_buckets.ts @@ -10,11 +10,11 @@ import { kqlQuery, termQuery, } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ERROR_GROUP_ID, SERVICE_NAME, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { Setup } from '../../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/errors/erroneous_transactions/get_top_erroneous_transactions.ts b/x-pack/plugins/apm/server/routes/errors/erroneous_transactions/get_top_erroneous_transactions.ts index 6017ad75c1230..fa1c5372f8d4a 100644 --- a/x-pack/plugins/apm/server/routes/errors/erroneous_transactions/get_top_erroneous_transactions.ts +++ b/x-pack/plugins/apm/server/routes/errors/erroneous_transactions/get_top_erroneous_transactions.ts @@ -17,6 +17,7 @@ import { kqlQuery, termQuery, } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { keyBy } from 'lodash'; import { ERROR_GROUP_ID, @@ -24,7 +25,6 @@ import { TRANSACTION_NAME, TRANSACTION_TYPE, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { Setup } from '../../../lib/helpers/setup_request'; import { getBucketSize } from '../../../lib/helpers/get_bucket_size'; diff --git a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_detailed_statistics.ts b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_detailed_statistics.ts index 99fcf1a6c3f8a..4251dfeb02885 100644 --- a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_detailed_statistics.ts +++ b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_detailed_statistics.ts @@ -11,13 +11,13 @@ import { termQuery, termsQuery, } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { offsetPreviousPeriodCoordinates } from '../../../../common/utils/offset_previous_period_coordinate'; import { Coordinate } from '../../../../typings/timeseries'; import { ERROR_GROUP_ID, SERVICE_NAME, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { getBucketSize } from '../../../lib/helpers/get_bucket_size'; import { Setup } from '../../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts index 0b6fea5c4c6a4..d50650116c126 100644 --- a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts +++ b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts @@ -11,6 +11,7 @@ import { rangeQuery, termQuery, } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ERROR_CULPRIT, ERROR_EXC_HANDLED, @@ -22,7 +23,6 @@ import { TRANSACTION_NAME, TRANSACTION_TYPE, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { getErrorName } from '../../../lib/helpers/get_error_name'; import { Setup } from '../../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_sample.ts b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_sample.ts index 8df5235950cef..0fe37d8dc98db 100644 --- a/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_sample.ts +++ b/x-pack/plugins/apm/server/routes/errors/get_error_groups/get_error_group_sample.ts @@ -6,13 +6,13 @@ */ import { rangeQuery, kqlQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { asMutableArray } from '../../../../common/utils/as_mutable_array'; import { ERROR_GROUP_ID, SERVICE_NAME, TRANSACTION_SAMPLED, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { environmentQuery } from '../../../../common/utils/environment_query'; import { getTransaction } from '../../transactions/get_transaction'; import { Setup } from '../../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/event_metadata/get_event_metadata.ts b/x-pack/plugins/apm/server/routes/event_metadata/get_event_metadata.ts index 006c87a3dac20..09dba644a9a45 100644 --- a/x-pack/plugins/apm/server/routes/event_metadata/get_event_metadata.ts +++ b/x-pack/plugins/apm/server/routes/event_metadata/get_event_metadata.ts @@ -6,12 +6,12 @@ */ import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ERROR_ID, SPAN_ID, TRANSACTION_ID, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import type { APMEventClient } from '../../lib/helpers/create_es_client/create_apm_event_client'; export async function getEventMetadata({ diff --git a/x-pack/plugins/apm/server/routes/historical_data/has_historical_agent_data.ts b/x-pack/plugins/apm/server/routes/historical_data/has_historical_agent_data.ts index 54960c3e48b60..9d19822e96d41 100644 --- a/x-pack/plugins/apm/server/routes/historical_data/has_historical_agent_data.ts +++ b/x-pack/plugins/apm/server/routes/historical_data/has_historical_agent_data.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Setup } from '../../lib/helpers/setup_request'; // Note: this logic is duplicated in tutorials/apm/envs/on_prem diff --git a/x-pack/plugins/apm/server/routes/infrastructure/get_infrastructure_data.ts b/x-pack/plugins/apm/server/routes/infrastructure/get_infrastructure_data.ts index 96ae786b22b49..b1bf617ac7220 100644 --- a/x-pack/plugins/apm/server/routes/infrastructure/get_infrastructure_data.ts +++ b/x-pack/plugins/apm/server/routes/infrastructure/get_infrastructure_data.ts @@ -6,9 +6,9 @@ */ import { rangeQuery, kqlQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Setup } from '../../lib/helpers/setup_request'; import { environmentQuery } from '../../../common/utils/environment_query'; -import { ProcessorEvent } from '../../../common/processor_event'; import { SERVICE_NAME, CONTAINER_ID, diff --git a/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts index 8b199cc76085e..c527a64d5e1b9 100644 --- a/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts +++ b/x-pack/plugins/apm/server/routes/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts @@ -8,6 +8,7 @@ import { sum, round } from 'lodash'; import { euiLightVars as theme } from '@kbn/ui-theme'; import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { isFiniteNumber } from '../../../../../../common/utils/is_finite_number'; import { Setup } from '../../../../../lib/helpers/setup_request'; import { getMetricsDateHistogramParams } from '../../../../../lib/helpers/metrics'; @@ -27,7 +28,6 @@ import { environmentQuery, serviceNodeNameQuery, } from '../../../../../../common/utils/environment_query'; -import { ProcessorEvent } from '../../../../../../common/processor_event'; export async function fetchAndTransformGcMetrics({ environment, diff --git a/x-pack/plugins/apm/server/routes/metrics/fetch_and_transform_metrics.ts b/x-pack/plugins/apm/server/routes/metrics/fetch_and_transform_metrics.ts index f767fb71f15c6..a9da7c52c1470 100644 --- a/x-pack/plugins/apm/server/routes/metrics/fetch_and_transform_metrics.ts +++ b/x-pack/plugins/apm/server/routes/metrics/fetch_and_transform_metrics.ts @@ -10,6 +10,7 @@ import { euiLightVars as theme } from '@kbn/ui-theme'; import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; import { AggregationOptionsByType } from '@kbn/core/types/elasticsearch'; import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getVizColorForIndex } from '../../../common/viz_colors'; import { APMEventESSearchRequest } from '../../lib/helpers/create_es_client/create_apm_event_client'; import { getMetricsDateHistogramParams } from '../../lib/helpers/metrics'; @@ -19,7 +20,6 @@ import { environmentQuery, serviceNodeNameQuery, } from '../../../common/utils/environment_query'; -import { ProcessorEvent } from '../../../common/processor_event'; import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; type MetricsAggregationMap = Unionize<{ diff --git a/x-pack/plugins/apm/server/routes/observability_overview/get_service_count.ts b/x-pack/plugins/apm/server/routes/observability_overview/get_service_count.ts index 07bbdb4b348b5..5b76201d33e38 100644 --- a/x-pack/plugins/apm/server/routes/observability_overview/get_service_count.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview/get_service_count.ts @@ -6,7 +6,7 @@ */ import { rangeQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; import { Setup } from '../../lib/helpers/setup_request'; import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; diff --git a/x-pack/plugins/apm/server/routes/observability_overview/has_data.ts b/x-pack/plugins/apm/server/routes/observability_overview/has_data.ts index 9f98af055e696..9ef4594c1f0f1 100644 --- a/x-pack/plugins/apm/server/routes/observability_overview/has_data.ts +++ b/x-pack/plugins/apm/server/routes/observability_overview/has_data.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Setup } from '../../lib/helpers/setup_request'; export async function getHasData({ setup }: { setup: Setup }) { diff --git a/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts b/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts index 9a54b03e72b62..64c3b7e8e6f3b 100644 --- a/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts +++ b/x-pack/plugins/apm/server/routes/service_groups/lookup_services.ts @@ -6,13 +6,13 @@ */ import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AgentName } from '../../../typings/es_schemas/ui/fields/agent'; import { AGENT_NAME, SERVICE_ENVIRONMENT, SERVICE_NAME, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { Setup } from '../../lib/helpers/setup_request'; export async function lookupServices({ diff --git a/x-pack/plugins/apm/server/routes/service_map/fetch_service_paths_from_trace_ids.ts b/x-pack/plugins/apm/server/routes/service_map/fetch_service_paths_from_trace_ids.ts index 8c2254af1deb2..69fa91dec7cc9 100644 --- a/x-pack/plugins/apm/server/routes/service_map/fetch_service_paths_from_trace_ids.ts +++ b/x-pack/plugins/apm/server/routes/service_map/fetch_service_paths_from_trace_ids.ts @@ -6,7 +6,7 @@ */ import { rangeQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { TRACE_ID } from '../../../common/elasticsearch_fieldnames'; import { ConnectionNode, diff --git a/x-pack/plugins/apm/server/routes/service_map/get_service_map.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map.ts index c4ab0f12c8e69..245eeb3c1296a 100644 --- a/x-pack/plugins/apm/server/routes/service_map/get_service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map.ts @@ -8,7 +8,7 @@ import { Logger } from '@kbn/core/server'; import { chunk } from 'lodash'; import { rangeQuery, termsQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AGENT_NAME, SERVICE_ENVIRONMENT, diff --git a/x-pack/plugins/apm/server/routes/service_map/get_service_map_dependency_node_info.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_dependency_node_info.ts index a757203b1c87b..9ff2d4da4f77f 100644 --- a/x-pack/plugins/apm/server/routes/service_map/get_service_map_dependency_node_info.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map_dependency_node_info.ts @@ -6,6 +6,7 @@ */ import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { EVENT_OUTCOME, SPAN_DESTINATION_SERVICE_RESOURCE, @@ -13,7 +14,6 @@ import { SPAN_DESTINATION_SERVICE_RESPONSE_TIME_SUM, } from '../../../common/elasticsearch_fieldnames'; import { EventOutcome } from '../../../common/event_outcome'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { withApmSpan } from '../../utils/with_apm_span'; import { calculateThroughputWithRange } from '../../lib/helpers/calculate_throughput'; diff --git a/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts index 225c78bd89dcb..27d6de622c131 100644 --- a/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_service_map_service_node_info.ts @@ -7,6 +7,7 @@ import { sumBy } from 'lodash'; import { ESFilter } from '@kbn/core/types/elasticsearch'; import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { METRIC_CGROUP_MEMORY_USAGE_BYTES, METRIC_SYSTEM_CPU_PERCENT, @@ -15,7 +16,6 @@ import { SERVICE_NAME, TRANSACTION_TYPE, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { NodeStats } from '../../../common/service_map'; import { TRANSACTION_PAGE_LOAD, diff --git a/x-pack/plugins/apm/server/routes/service_map/get_trace_sample_ids.ts b/x-pack/plugins/apm/server/routes/service_map/get_trace_sample_ids.ts index 31710b253d07c..06db7354925f8 100644 --- a/x-pack/plugins/apm/server/routes/service_map/get_trace_sample_ids.ts +++ b/x-pack/plugins/apm/server/routes/service_map/get_trace_sample_ids.ts @@ -8,6 +8,7 @@ import Boom from '@hapi/boom'; import { sortBy, take, uniq } from 'lodash'; import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { asMutableArray } from '../../../common/utils/as_mutable_array'; import { SERVICE_ENVIRONMENT, @@ -15,7 +16,6 @@ import { SPAN_DESTINATION_SERVICE_RESOURCE, TRACE_ID, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { SERVICE_MAP_TIMEOUT_ERROR } from '../../../common/service_map'; import { environmentQuery } from '../../../common/utils/environment_query'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/service_nodes/get_service_nodes.ts b/x-pack/plugins/apm/server/routes/service_nodes/get_service_nodes.ts index f0b710069d244..34647f747cc43 100644 --- a/x-pack/plugins/apm/server/routes/service_nodes/get_service_nodes.ts +++ b/x-pack/plugins/apm/server/routes/service_nodes/get_service_nodes.ts @@ -6,6 +6,7 @@ */ import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { METRIC_JAVA_HEAP_MEMORY_USED, METRIC_JAVA_NON_HEAP_MEMORY_USED, @@ -19,7 +20,6 @@ import { SERVICE_NAME, SERVICE_NODE_NAME, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/services/get_service_agent.ts b/x-pack/plugins/apm/server/routes/services/get_service_agent.ts index e96dcdb6bf0fd..f6a33c543ea4d 100644 --- a/x-pack/plugins/apm/server/routes/services/get_service_agent.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_agent.ts @@ -6,7 +6,7 @@ */ import { rangeQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AGENT_NAME, SERVICE_NAME, diff --git a/x-pack/plugins/apm/server/routes/services/get_service_instance_metadata_details.ts b/x-pack/plugins/apm/server/routes/services/get_service_instance_metadata_details.ts index 1bc44bf2c2b77..965c4d6fc01d6 100644 --- a/x-pack/plugins/apm/server/routes/services/get_service_instance_metadata_details.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instance_metadata_details.ts @@ -6,7 +6,7 @@ */ import { merge } from 'lodash'; import { rangeQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { METRICSET_NAME, SERVICE_NAME, diff --git a/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_system_metric_statistics.ts b/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_system_metric_statistics.ts index 8a191228255a9..c64f1e3865238 100644 --- a/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_system_metric_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_instances/get_service_instances_system_metric_statistics.ts @@ -7,6 +7,7 @@ import { AggregationOptionsByType } from '@kbn/core/types/elasticsearch'; import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { METRIC_CGROUP_MEMORY_USAGE_BYTES, METRIC_PROCESS_CPU_PERCENT, @@ -15,7 +16,6 @@ import { SERVICE_NAME, SERVICE_NODE_NAME, } from '../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { SERVICE_NODE_NAME_MISSING } from '../../../../common/service_nodes'; import { Coordinate } from '../../../../typings/timeseries'; import { environmentQuery } from '../../../../common/utils/environment_query'; diff --git a/x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts b/x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts index 4769a1986ec43..588709e46e210 100644 --- a/x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_metadata_details.ts @@ -6,7 +6,7 @@ */ import { rangeQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AGENT, CLOUD, diff --git a/x-pack/plugins/apm/server/routes/services/get_service_metadata_icons.ts b/x-pack/plugins/apm/server/routes/services/get_service_metadata_icons.ts index b1724e2c07db6..a099b9821f961 100644 --- a/x-pack/plugins/apm/server/routes/services/get_service_metadata_icons.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_metadata_icons.ts @@ -6,7 +6,7 @@ */ import { rangeQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AGENT_NAME, CLOUD_PROVIDER, diff --git a/x-pack/plugins/apm/server/routes/services/get_service_node_metadata.ts b/x-pack/plugins/apm/server/routes/services/get_service_node_metadata.ts index e782a99201ccf..4d8b80068a284 100644 --- a/x-pack/plugins/apm/server/routes/services/get_service_node_metadata.ts +++ b/x-pack/plugins/apm/server/routes/services/get_service_node_metadata.ts @@ -6,6 +6,7 @@ */ import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Setup } from '../../lib/helpers/setup_request'; import { HOST_NAME, @@ -16,7 +17,6 @@ import { SERVICE_NAME, SERVICE_NODE_NAME, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery, serviceNodeNameQuery, diff --git a/x-pack/plugins/apm/server/routes/services/get_services/get_services_from_error_and_metric_documents.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_services_from_error_and_metric_documents.ts index dbc5a7f989152..4398825e30c63 100644 --- a/x-pack/plugins/apm/server/routes/services/get_services/get_services_from_error_and_metric_documents.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_services_from_error_and_metric_documents.ts @@ -6,6 +6,7 @@ */ import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AgentName } from '../../../../typings/es_schemas/ui/fields/agent'; import { AGENT_NAME, @@ -13,7 +14,6 @@ import { SERVICE_NAME, } from '../../../../common/elasticsearch_fieldnames'; import { environmentQuery } from '../../../../common/utils/environment_query'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { Setup } from '../../../lib/helpers/setup_request'; import { serviceGroupQuery } from '../../../../common/utils/service_group_query'; import { ServiceGroup } from '../../../../common/service_groups'; diff --git a/x-pack/plugins/apm/server/routes/services/get_services/get_sorted_and_filtered_services.ts b/x-pack/plugins/apm/server/routes/services/get_services/get_sorted_and_filtered_services.ts index c500782f4d002..a582a0a9b1d3b 100644 --- a/x-pack/plugins/apm/server/routes/services/get_services/get_sorted_and_filtered_services.ts +++ b/x-pack/plugins/apm/server/routes/services/get_services/get_sorted_and_filtered_services.ts @@ -6,10 +6,10 @@ */ import { Logger } from '@kbn/logging'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; import { Environment } from '../../../../common/environment_rt'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { joinByKey } from '../../../../common/utils/join_by_key'; import { ServiceGroup } from '../../../../common/service_groups'; import { Setup } from '../../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_statistics.ts b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_statistics.ts index aa65316e2a0c3..7599e67963e4a 100644 --- a/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_statistics.ts +++ b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_statistics.ts @@ -9,6 +9,7 @@ import { Logger } from '@kbn/core/server'; import util from 'util'; import { ESFilter } from '@kbn/core/types/elasticsearch'; import { rangeQuery, kqlQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { maybe } from '../../../../common/utils/maybe'; import { ProfileStackFrame } from '../../../../typings/es_schemas/ui/profile'; import { @@ -16,7 +17,6 @@ import { ProfileNode, getValueTypeConfig, } from '../../../../common/profiling'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { PROFILE_STACK, PROFILE_TOP_ID, diff --git a/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_timeline.ts b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_timeline.ts index 5a95b332e9ee9..371f17159beb0 100644 --- a/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_timeline.ts +++ b/x-pack/plugins/apm/server/routes/services/profiling/get_service_profiling_timeline.ts @@ -6,7 +6,7 @@ */ import { mapKeys, mapValues } from 'lodash'; import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { PROFILE_ID, SERVICE_NAME, diff --git a/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_agent_name_by_service.ts b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_agent_name_by_service.ts index d16af2d95d22a..c6f69793ba327 100644 --- a/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_agent_name_by_service.ts +++ b/x-pack/plugins/apm/server/routes/settings/agent_configuration/get_agent_name_by_service.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ProcessorEvent } from '../../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Setup } from '../../../lib/helpers/setup_request'; import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames'; import { AGENT_NAME } from '../../../../common/elasticsearch_fieldnames'; diff --git a/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.ts b/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.ts index d4e21f219f372..a0955912faa28 100644 --- a/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.ts +++ b/x-pack/plugins/apm/server/routes/settings/custom_link/get_transaction.ts @@ -7,8 +7,8 @@ import * as t from 'io-ts'; import { compact } from 'lodash'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Setup } from '../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { filterOptionsRt } from './custom_link_types'; import { splitFilterValueByComma } from './helper'; diff --git a/x-pack/plugins/apm/server/routes/span_links/get_linked_children.ts b/x-pack/plugins/apm/server/routes/span_links/get_linked_children.ts index 43b55d31503e4..de183a63af6a4 100644 --- a/x-pack/plugins/apm/server/routes/span_links/get_linked_children.ts +++ b/x-pack/plugins/apm/server/routes/span_links/get_linked_children.ts @@ -5,6 +5,7 @@ * 2.0. */ import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { isEmpty } from 'lodash'; import { PROCESSOR_EVENT, @@ -15,7 +16,6 @@ import { TRACE_ID, TRANSACTION_ID, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import type { SpanRaw } from '../../../typings/es_schemas/raw/span_raw'; import type { TransactionRaw } from '../../../typings/es_schemas/raw/transaction_raw'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/span_links/get_linked_parents.ts b/x-pack/plugins/apm/server/routes/span_links/get_linked_parents.ts index 876a0f3718642..037bbfd24d172 100644 --- a/x-pack/plugins/apm/server/routes/span_links/get_linked_parents.ts +++ b/x-pack/plugins/apm/server/routes/span_links/get_linked_parents.ts @@ -5,6 +5,7 @@ * 2.0. */ import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { SPAN_ID, SPAN_LINKS, @@ -12,7 +13,6 @@ import { TRANSACTION_ID, PROCESSOR_EVENT, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { SpanRaw } from '../../../typings/es_schemas/raw/span_raw'; import { TransactionRaw } from '../../../typings/es_schemas/raw/transaction_raw'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/span_links/get_span_links_details.ts b/x-pack/plugins/apm/server/routes/span_links/get_span_links_details.ts index cffd7ff826c88..f6d9682c6d893 100644 --- a/x-pack/plugins/apm/server/routes/span_links/get_span_links_details.ts +++ b/x-pack/plugins/apm/server/routes/span_links/get_span_links_details.ts @@ -5,6 +5,7 @@ * 2.0. */ import { kqlQuery, rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { chunk, compact, isEmpty, keyBy } from 'lodash'; import { SERVICE_NAME, @@ -21,7 +22,6 @@ import { AGENT_NAME, } from '../../../common/elasticsearch_fieldnames'; import { Environment } from '../../../common/environment_rt'; -import { ProcessorEvent } from '../../../common/processor_event'; import { SpanLinkDetails } from '../../../common/span_links'; import { SpanLink } from '../../../typings/es_schemas/raw/fields/span_links'; import { SpanRaw } from '../../../typings/es_schemas/raw/span_raw'; diff --git a/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts index f65a843ed95d0..dcab43ca26abc 100644 --- a/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts +++ b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts index 268bc4151efdd..390435d62ec6b 100644 --- a/x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts +++ b/x-pack/plugins/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts @@ -5,7 +5,7 @@ * 2.0. */ import { rangeQuery, termQuery } from '@kbn/observability-plugin/server'; -import { ProcessorEvent } from '../../../common/processor_event'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { getProcessorEventForTransactions } from '../../lib/helpers/transactions'; import { SERVICE_NAME } from '../../../common/elasticsearch_fieldnames'; import { Setup } from '../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts b/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts index 3f6146c713303..c9c4c5a595cf3 100644 --- a/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts +++ b/x-pack/plugins/apm/server/routes/traces/get_trace_items.ts @@ -10,6 +10,7 @@ import { Sort, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { rangeQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { ERROR_LOG_LEVEL, PARENT_ID, @@ -17,7 +18,6 @@ import { TRACE_ID, TRANSACTION_DURATION, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { Setup } from '../../lib/helpers/setup_request'; import { getLinkedChildrenCountBySpanId } from '../span_links/get_linked_children'; diff --git a/x-pack/plugins/apm/server/routes/traces/get_trace_samples_by_query.ts b/x-pack/plugins/apm/server/routes/traces/get_trace_samples_by_query.ts index 48ca80780d77f..fbf3b4f29cc4c 100644 --- a/x-pack/plugins/apm/server/routes/traces/get_trace_samples_by_query.ts +++ b/x-pack/plugins/apm/server/routes/traces/get_trace_samples_by_query.ts @@ -9,10 +9,10 @@ import { kqlQuery, termsQuery, } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { Environment } from '../../../common/environment_rt'; import { Setup } from '../../lib/helpers/setup_request'; import { TraceSearchType } from '../../../common/trace_explorer'; -import { ProcessorEvent } from '../../../common/processor_event'; import { environmentQuery } from '../../../common/utils/environment_query'; import { PARENT_ID, diff --git a/x-pack/plugins/apm/server/routes/transactions/breakdown/index.ts b/x-pack/plugins/apm/server/routes/transactions/breakdown/index.ts index 122a56e28ed61..6495b21e209d9 100644 --- a/x-pack/plugins/apm/server/routes/transactions/breakdown/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/breakdown/index.ts @@ -7,8 +7,8 @@ import { flatten, orderBy, last } from 'lodash'; import { rangeQuery, kqlQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { asPercent } from '../../../../common/utils/formatters'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { SERVICE_NAME, SPAN_SUBTYPE, diff --git a/x-pack/plugins/apm/server/routes/transactions/get_transaction/index.ts b/x-pack/plugins/apm/server/routes/transactions/get_transaction/index.ts index efbab5bf030f7..1238261ca2bba 100644 --- a/x-pack/plugins/apm/server/routes/transactions/get_transaction/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/get_transaction/index.ts @@ -6,12 +6,12 @@ */ import { rangeQuery, termQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { TRACE_ID, TRANSACTION_ID, } from '../../../../common/elasticsearch_fieldnames'; import { Setup } from '../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../common/processor_event'; import { asMutableArray } from '../../../../common/utils/as_mutable_array'; export async function getTransaction({ diff --git a/x-pack/plugins/apm/server/routes/transactions/get_transaction_by_trace/index.ts b/x-pack/plugins/apm/server/routes/transactions/get_transaction_by_trace/index.ts index d9c6a64bdbcc6..441a0b9119d8d 100644 --- a/x-pack/plugins/apm/server/routes/transactions/get_transaction_by_trace/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/get_transaction_by_trace/index.ts @@ -5,12 +5,12 @@ * 2.0. */ +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { TRACE_ID, PARENT_ID, } from '../../../../common/elasticsearch_fieldnames'; import { Setup } from '../../../lib/helpers/setup_request'; -import { ProcessorEvent } from '../../../../common/processor_event'; export async function getRootTransactionByTraceId( traceId: string, diff --git a/x-pack/plugins/apm/server/routes/transactions/trace_samples/get_trace_samples/index.ts b/x-pack/plugins/apm/server/routes/transactions/trace_samples/get_trace_samples/index.ts index 40ce7fbcbf047..3f66aaebd0555 100644 --- a/x-pack/plugins/apm/server/routes/transactions/trace_samples/get_trace_samples/index.ts +++ b/x-pack/plugins/apm/server/routes/transactions/trace_samples/get_trace_samples/index.ts @@ -6,6 +6,7 @@ */ import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { rangeQuery, kqlQuery } from '@kbn/observability-plugin/server'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { withApmSpan } from '../../../../utils/with_apm_span'; import { SERVICE_NAME, @@ -15,7 +16,6 @@ import { TRANSACTION_SAMPLED, TRANSACTION_TYPE, } from '../../../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../../../common/processor_event'; import { environmentQuery } from '../../../../../common/utils/environment_query'; import { Setup } from '../../../../lib/helpers/setup_request'; diff --git a/x-pack/plugins/observability/common/index.ts b/x-pack/plugins/observability/common/index.ts index 40b101f8fd4cb..794275c380c97 100644 --- a/x-pack/plugins/observability/common/index.ts +++ b/x-pack/plugins/observability/common/index.ts @@ -9,6 +9,8 @@ export type { AsDuration, AsPercent, TimeUnitChar } from './utils/formatters'; export { formatDurationFromTimeUnitChar } from './utils/formatters'; +export { ProcessorEvent } from './processor_event'; + export { enableInspectEsQueries, maxSuggestions, diff --git a/x-pack/plugins/ux/common/processor_event.ts b/x-pack/plugins/observability/common/processor_event.ts similarity index 100% rename from x-pack/plugins/ux/common/processor_event.ts rename to x-pack/plugins/observability/common/processor_event.ts diff --git a/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx index 3a24a48181192..35953b10d9e60 100644 --- a/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx +++ b/x-pack/plugins/ux/public/components/app/rum_dashboard/charts/visitor_breakdown_chart.tsx @@ -15,6 +15,7 @@ import { TypedLensByValueInput, } from '@kbn/lens-plugin/public'; import { EuiText } from '@elastic/eui'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { TRANSACTION_PAGE_LOAD } from '../../../../../common/transaction_types'; import { PROCESSOR_EVENT, @@ -23,7 +24,6 @@ import { import { getEsFilter } from '../../../../services/data/get_es_filter'; import { useKibanaServices } from '../../../../hooks/use_kibana_services'; import type { UxUIFilters } from '../../../../../typings/ui_filters'; -import { ProcessorEvent } from '../../../../../common/processor_event'; const BUCKET_SIZE = 9; diff --git a/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts b/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts index 0f832eff6a2bd..718b9ea47174e 100644 --- a/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts +++ b/x-pack/plugins/ux/public/services/data/core_web_vitals_query.ts @@ -80,7 +80,7 @@ export function coreWebVitalsQuery( uiFilters?: UxUIFilters, percentile = PERCENTILE_DEFAULT ) { - const setup: SetupUX = { uiFilters: uiFilters ? uiFilters : {} }; + const setup: SetupUX = { uiFilters: uiFilters ?? {} }; const projection = getRumPageLoadTransactionsProjection({ setup, diff --git a/x-pack/plugins/ux/public/services/data/projections.ts b/x-pack/plugins/ux/public/services/data/projections.ts index 582639321b868..bcb201434b41f 100644 --- a/x-pack/plugins/ux/public/services/data/projections.ts +++ b/x-pack/plugins/ux/public/services/data/projections.ts @@ -5,13 +5,13 @@ * 2.0. */ import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { AGENT_NAME, PROCESSOR_EVENT, SERVICE_LANGUAGE_NAME, TRANSACTION_TYPE, } from '../../../common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '../../../common/processor_event'; import { TRANSACTION_PAGE_LOAD } from '../../../common/transaction_types'; import { SetupUX } from '../../../typings/ui_filters'; import { getEsFilter } from './get_es_filter'; diff --git a/x-pack/test/apm_api_integration/tests/event_metadata/event_metadata.spec.ts b/x-pack/test/apm_api_integration/tests/event_metadata/event_metadata.spec.ts index 4e82dc3509823..85e9bc73aa0db 100644 --- a/x-pack/test/apm_api_integration/tests/event_metadata/event_metadata.spec.ts +++ b/x-pack/test/apm_api_integration/tests/event_metadata/event_metadata.spec.ts @@ -5,8 +5,8 @@ * 2.0. */ import expect from '@kbn/expect'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { PROCESSOR_EVENT } from '@kbn/apm-plugin/common/elasticsearch_fieldnames'; -import { ProcessorEvent } from '@kbn/apm-plugin/common/processor_event'; import { FtrProviderContext } from '../../common/ftr_provider_context'; export default function ApiTest({ getService }: FtrProviderContext) { diff --git a/x-pack/test/apm_api_integration/tests/span_links/span_links.spec.ts b/x-pack/test/apm_api_integration/tests/span_links/span_links.spec.ts index e42c9e0fb00cd..91bf356bbdedd 100644 --- a/x-pack/test/apm_api_integration/tests/span_links/span_links.spec.ts +++ b/x-pack/test/apm_api_integration/tests/span_links/span_links.spec.ts @@ -5,8 +5,8 @@ * 2.0. */ import { EntityArrayIterable } from '@elastic/apm-synthtrace'; -import { ProcessorEvent } from '@kbn/apm-plugin/common/processor_event'; import expect from '@kbn/expect'; +import { ProcessorEvent } from '@kbn/observability-plugin/common'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { generateSpanLinksData } from './data_generator'; From 241406a8df3a4b7ddd2ce01d889b88db403e7be0 Mon Sep 17 00:00:00 2001 From: Kristof C Date: Tue, 2 Aug 2022 14:36:58 -0500 Subject: [PATCH 19/21] 137539 add missing network details revamp (#137541) * update event tab to show both alerts and events with toggle. (#136540) * add test for SignasByCategory * modify external_alerts_filter to be more efficient * Update usage across explore views to only use EventsQueryTabBody * remove unused files and code related to external alerts and move old alerts files to events_tab folder * test fixes, and more removal of old usage * update failing snapshots * last bit of cleanup * Fix type error * fix type and translations issue Co-authored-by: Kristof-Pierre Cummings * update network details to match hosts, and users details pages * add events table to network pages * Fix minor bugs with network routeing and allow old route to reach new view * Fix failing tests * fix types and transltions * minor fixes before code review * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * update failing snapshot * re-add /ip/ and have :/flowTarget appear before :/tabName * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * remove unneeded import and update type * fix navigation issue * use constant for administration page, and add fallback route * Update links and redirect behaviour * fix dependency array Co-authored-by: Kristof-Pierre Cummings Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../security_solution/common/constants.ts | 3 +- .../ml/ml_conditional_links.spec.ts | 4 +- .../link_to/redirect_to_network.tsx | 6 +- .../common/components/links/index.test.tsx | 10 +- .../public/common/components/links/index.tsx | 39 ++--- .../matrix_histogram/index.test.tsx | 2 +- .../navigation/breadcrumbs/index.test.ts | 8 +- .../use_primary_navigation.tsx | 13 +- .../use_lens_attributes.tsx | 2 +- .../components/visualization_actions/utils.ts | 35 ++++ .../public/network/pages/constants.ts | 43 +++++ .../network/pages/details/details_tabs.tsx | 131 +++++++++++++++ .../network/pages/details/index.test.tsx | 22 ++- .../public/network/pages/details/index.tsx | 155 +++--------------- .../network/pages/details/nav_tabs.test.tsx | 62 +++++++ .../public/network/pages/details/nav_tabs.tsx | 69 ++++++++ .../public/network/pages/details/types.ts | 19 ++- .../public/network/pages/details/utils.ts | 16 +- .../public/network/pages/index.tsx | 29 +++- .../network/pages/navigation/nav_tabs.tsx | 6 +- .../pages/navigation/network_routes.tsx | 2 +- .../public/network/pages/navigation/types.ts | 17 +- .../public/network/pages/navigation/utils.ts | 22 +-- .../public/network/pages/network.tsx | 2 +- .../public/network/pages/translations.ts | 7 + .../netflow/__snapshots__/index.test.tsx.snap | 4 +- .../netflow_row_renderer.test.tsx.snap | 4 +- 27 files changed, 504 insertions(+), 228 deletions(-) create mode 100644 x-pack/plugins/security_solution/public/network/pages/constants.ts create mode 100644 x-pack/plugins/security_solution/public/network/pages/details/details_tabs.tsx create mode 100644 x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.test.tsx create mode 100644 x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.tsx diff --git a/x-pack/plugins/security_solution/common/constants.ts b/x-pack/plugins/security_solution/common/constants.ts index 9246e764800c4..222860e1a2d04 100644 --- a/x-pack/plugins/security_solution/common/constants.ts +++ b/x-pack/plugins/security_solution/common/constants.ts @@ -107,7 +107,7 @@ export enum SecurityPageName { network = 'network', networkAnomalies = 'network-anomalies', networkDns = 'network-dns', - networkExternalAlerts = 'network-external_alerts', + networkEvents = 'network-events', networkHttp = 'network-http', networkTls = 'network-tls', noPage = '', @@ -126,7 +126,6 @@ export enum SecurityPageName { usersAnomalies = 'users-anomalies', usersAuthentications = 'users-authentications', usersEvents = 'users-events', - usersExternalAlerts = 'users-external_alerts', usersRisk = 'users-risk', } diff --git a/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts b/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts index 8e2bd7ba2bb4d..5ab92be404c9d 100644 --- a/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/ml/ml_conditional_links.spec.ts @@ -97,7 +97,7 @@ describe('ml conditional links', () => { visitWithoutDateRange(mlNetworkSingleIpNullKqlQuery); cy.url().should( 'include', - 'app/security/network/ip/127.0.0.1/source?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)))' + 'app/security/network/ip/127.0.0.1/source/flows?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)))' ); }); @@ -105,7 +105,7 @@ describe('ml conditional links', () => { visitWithoutDateRange(mlNetworkSingleIpKqlQuery); cy.url().should( 'include', - '/app/security/network/ip/127.0.0.1/source?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&query=(language:kuery,query:%27(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)%27)&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)))' + '/app/security/network/ip/127.0.0.1/source/flows?sourcerer=(default:(id:security-solution-default,selectedPatterns:!(%27auditbeat-*%27)))&query=(language:kuery,query:%27(process.name:%20%22conhost.exe%22%20or%20process.name:%20%22sc.exe%22)%27)&timerange=(global:(linkTo:!(timeline),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)),timeline:(linkTo:!(global),timerange:(from:%272019-08-28T11:00:00.000Z%27,kind:absolute,to:%272019-08-28T13:59:59.999Z%27)))' ); }); diff --git a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_network.tsx b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_network.tsx index 42a04a8685e3b..a1702dc766f57 100644 --- a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_network.tsx +++ b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_network.tsx @@ -7,6 +7,7 @@ import type { FlowTargetSourceDest } from '../../../../common/search_strategy/security_solution/network'; import { FlowTarget } from '../../../../common/search_strategy/security_solution/network'; +import { NetworkDetailsRouteType } from '../../../network/pages/details/types'; import { appendSearch } from './helpers'; @@ -15,5 +16,6 @@ export const getNetworkUrl = (search?: string) => `${appendSearch(search)}`; export const getNetworkDetailsUrl = ( detailName: string, flowTarget?: FlowTarget | FlowTargetSourceDest, - search?: string -) => `/ip/${detailName}/${flowTarget || FlowTarget.source}${appendSearch(search)}`; + search?: string, + tabName = NetworkDetailsRouteType.flows +) => `/ip/${detailName}/${flowTarget || FlowTarget.source}/${tabName}${appendSearch(search)}`; diff --git a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx index f511d72bf49b2..13fdb96b86aeb 100644 --- a/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/links/index.test.tsx @@ -75,17 +75,17 @@ describe('Custom Links', () => { test('can handle array of ips', () => { const wrapper = mount(); expect(wrapper.find('EuiLink').first().prop('href')).toEqual( - `/ip/${encodeURIComponent(ipv4)}/source` + `/ip/${encodeURIComponent(ipv4)}/source/flows` ); expect(wrapper.text()).toEqual(`${ipv4}${ipv4a}`); expect(wrapper.find('EuiLink').last().prop('href')).toEqual( - `/ip/${encodeURIComponent(ipv4a)}/source` + `/ip/${encodeURIComponent(ipv4a)}/source/flows` ); }); test('should render valid link to IP Details with ipv4 as the display text', () => { const wrapper = mount(); expect(wrapper.find('EuiLink').prop('href')).toEqual( - `/ip/${encodeURIComponent(ipv4)}/source` + `/ip/${encodeURIComponent(ipv4)}/source/flows` ); expect(wrapper.text()).toEqual(ipv4); }); @@ -93,7 +93,7 @@ describe('Custom Links', () => { test('should render valid link to IP Details with child text as the display text', () => { const wrapper = mount({hostName}); expect(wrapper.find('EuiLink').prop('href')).toEqual( - `/ip/${encodeURIComponent(ipv4)}/source` + `/ip/${encodeURIComponent(ipv4)}/source/flows` ); expect(wrapper.text()).toEqual(hostName); }); @@ -101,7 +101,7 @@ describe('Custom Links', () => { test('should render valid link to IP Details with ipv6 as the display text', () => { const wrapper = mount(); expect(wrapper.find('EuiLink').prop('href')).toEqual( - `/ip/${encodeURIComponent(ipv6Encoded)}/source` + `/ip/${encodeURIComponent(ipv6Encoded)}/source/flows` ); expect(wrapper.text()).toEqual(ipv6); }); diff --git a/x-pack/plugins/security_solution/public/common/components/links/index.tsx b/x-pack/plugins/security_solution/public/common/components/links/index.tsx index 016243b370126..7e7c33a2bebdf 100644 --- a/x-pack/plugins/security_solution/public/common/components/links/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/links/index.tsx @@ -213,32 +213,24 @@ const NetworkDetailsLinkComponent: React.FC<{ onClick?: (e: SyntheticEvent) => void | undefined; title?: string; }> = ({ Component, children, ip, flowTarget = FlowTarget.source, isButton, onClick, title }) => { - const { formatUrl, search } = useFormatUrl(SecurityPageName.network); - const { navigateToApp } = useKibana().services.application; - const goToNetworkDetails = useCallback( - (ev, cIp: string) => { - ev.preventDefault(); - navigateToApp(APP_UI_ID, { + const getSecuritySolutionLinkProps = useGetSecuritySolutionLinkProps(); + + const getLink = useCallback( + (cIp: string, i: number) => { + const { onClick: onClickNavigation, href } = getSecuritySolutionLinkProps({ deepLinkId: SecurityPageName.network, - path: getNetworkDetailsUrl(encodeURIComponent(encodeIpv6(cIp)), flowTarget, search), + path: getNetworkDetailsUrl(encodeURIComponent(encodeIpv6(cIp)), flowTarget), }); - }, - [flowTarget, navigateToApp, search] - ); - const getHref = useCallback( - (cIp: string) => formatUrl(getNetworkDetailsUrl(encodeURIComponent(encodeIpv6(cIp)))), - [formatUrl] - ); - const getLink = useCallback( - (cIp: string, i: number) => - isButton ? ( + const onLinkClick = onClick ?? ((e: SyntheticEvent) => onClickNavigation(e as MouseEvent)); + + return isButton ? ( goToNetworkDetails(e, cIp))} - href={getHref(cIp)} + onClick={onLinkClick} + href={href} title={title ?? cIp} > {children} @@ -246,14 +238,15 @@ const NetworkDetailsLinkComponent: React.FC<{ ) : ( goToNetworkDetails(e, cIp))} - href={getHref(cIp)} + onClick={onLinkClick} + href={href} data-test-subj="network-details" > {children ? children : cIp} - ), - [Component, children, getHref, goToNetworkDetails, isButton, onClick, title] + ); + }, + [children, Component, flowTarget, getSecuritySolutionLinkProps, onClick, isButton, title] ); return isArray(ip) ? <>{ip.map(getLink)} : getLink(ip, 0); }; diff --git a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx index 49eb8fc3681d6..61efd3c906543 100644 --- a/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/matrix_histogram/index.test.tsx @@ -262,7 +262,7 @@ describe('Matrix Histogram Component', () => { { detailName: undefined, pageName: 'network', - tabName: 'external-alerts', + tabName: 'events', }, ]); diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts index 674a609e7f71a..43ed208148caa 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/index.test.ts @@ -257,7 +257,7 @@ describe('Navigation Breadcrumbs', () => { networkBreadcrumb, { text: ipv4, - href: `securitySolutionUI/network/ip/${ipv4}/source`, + href: `securitySolutionUI/network/ip/${ipv4}/source/flows`, }, { text: 'Flows', href: '' }, ]); @@ -274,7 +274,7 @@ describe('Navigation Breadcrumbs', () => { networkBreadcrumb, { text: ipv6, - href: `securitySolutionUI/network/ip/${ipv6Encoded}/source`, + href: `securitySolutionUI/network/ip/${ipv6Encoded}/source/flows`, }, { text: 'Flows', href: '' }, ]); @@ -574,7 +574,7 @@ describe('Navigation Breadcrumbs', () => { networkBreadcrumb, { text: ipv4, - href: `securitySolutionUI/network/ip/${ipv4}/source`, + href: `securitySolutionUI/network/ip/${ipv4}/source/flows`, }, { text: 'Flows', href: '' }, ]); @@ -592,7 +592,7 @@ describe('Navigation Breadcrumbs', () => { networkBreadcrumb, { text: ipv6, - href: `securitySolutionUI/network/ip/${ipv6Encoded}/source`, + href: `securitySolutionUI/network/ip/${ipv6Encoded}/source/flows`, }, { text: 'Flows', href: '' }, ]); diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_primary_navigation.tsx b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_primary_navigation.tsx index 66a4aef3618bb..947a651117777 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_primary_navigation.tsx +++ b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_primary_navigation.tsx @@ -9,6 +9,7 @@ import React, { useEffect, useState, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import type { KibanaPageTemplateProps } from '@kbn/shared-ux-components'; +import { SecurityPageName } from '../../../../../common/constants'; import type { PrimaryNavigationProps } from './types'; import { usePrimaryNavigationItems } from './use_navigation_items'; import { useIsGroupedNavigationEnabled } from '../helpers'; @@ -25,10 +26,14 @@ export const usePrimaryNavigation = ({ tabName, }: PrimaryNavigationProps): KibanaPageTemplateProps['solutionNav'] => { const isGroupedNavigationEnabled = useIsGroupedNavigationEnabled(); - const mapLocationToTab = useCallback( - (): string => ((tabName && navTabs[tabName]) || navTabs[pageName])?.id ?? '', - [pageName, tabName, navTabs] - ); + const mapLocationToTab = useCallback((): string => { + if (pageName === SecurityPageName.administration) { + // revist with ticket #137625. consider using tab Ids instead of tab Name for matching + return ((tabName && navTabs[tabName]) || navTabs[pageName])?.id ?? ''; + } else { + return (navTabs[pageName] || (tabName && navTabs[tabName]))?.id ?? ''; + } + }, [pageName, tabName, navTabs]); const [selectedTabId, setSelectedTabId] = useState(mapLocationToTab()); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.tsx index 58220d34e6717..2cb8710aac45c 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.tsx +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.tsx @@ -45,7 +45,7 @@ export const useLensAttributes = ({ return hostNameExistsFilter; } - if (pageName === SecurityPageName.network && tabName === NetworkRouteType.alerts) { + if (pageName === SecurityPageName.network && tabName === NetworkRouteType.events) { return filterNetworkExternalAlertData; } diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/utils.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/utils.ts index 81fe999961ee1..c66a608ecd989 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/utils.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/utils.ts @@ -62,6 +62,41 @@ export const hostNameExistsFilter: Filter[] = [ }, ]; +export const getNetworkDetailsPageFilter = (ipAddress?: string): Filter[] => + ipAddress + ? [ + { + meta: { + alias: null, + negate: false, + disabled: false, + type: 'phrase', + key: 'source.ip', + params: { + query: ipAddress, + }, + }, + query: { + bool: { + should: [ + { + match_phrase: { + 'source.ip': ipAddress, + }, + }, + { + match_phrase: { + 'destination.ip': ipAddress, + }, + }, + ], + minimum_should_match: 1, + }, + }, + }, + ] + : []; + export const filterNetworkExternalAlertData: Filter[] = [ { query: { diff --git a/x-pack/plugins/security_solution/public/network/pages/constants.ts b/x-pack/plugins/security_solution/public/network/pages/constants.ts new file mode 100644 index 0000000000000..3ddfe713db1f2 --- /dev/null +++ b/x-pack/plugins/security_solution/public/network/pages/constants.ts @@ -0,0 +1,43 @@ +/* + * 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 { NETWORK_PATH } from '../../../common/constants'; +import { FlowTargetSourceDest } from '../../../common/search_strategy'; +import { NetworkDetailsRouteType } from './details/types'; +import { NetworkRouteType } from './navigation/types'; + +const NETWORK_TABS = [ + NetworkRouteType.flows, + NetworkRouteType.dns, + NetworkRouteType.http, + NetworkRouteType.tls, + NetworkRouteType.events, +]; + +const NETWORK_WITHOUT_ANOMALIES_TAB_PARAM = NETWORK_TABS.join('|'); +const NETWORK_WITH_ANOMALIES_TAB_PARAM = [...NETWORK_TABS, NetworkRouteType.anomalies].join('|'); + +export const NETWORK_PATH_WITH_ANOMALIES = `${NETWORK_PATH}/:tabName(${NETWORK_WITH_ANOMALIES_TAB_PARAM})`; +export const NETWORK_PATH_WITHOUT_ANOMALIES = `${NETWORK_PATH}/:tabName(${NETWORK_WITHOUT_ANOMALIES_TAB_PARAM})`; + +const DETAIL_TABS_PARAM = [ + NetworkDetailsRouteType.flows, + NetworkDetailsRouteType.http, + NetworkDetailsRouteType.tls, + NetworkDetailsRouteType.anomalies, + NetworkDetailsRouteType.events, + NetworkDetailsRouteType.users, +].join('|'); + +export const FLOW_TARGET_PARAM = [ + FlowTargetSourceDest.source, + FlowTargetSourceDest.destination, +].join('|'); + +export const NETWORK_DETAILS_PAGE_PATH = `${NETWORK_PATH}/ip/:detailName`; + +export const NETWORK_DETAILS_TAB_PATH = `${NETWORK_DETAILS_PAGE_PATH}/:flowTarget(${FLOW_TARGET_PARAM})/:tabName(${DETAIL_TABS_PARAM})`; diff --git a/x-pack/plugins/security_solution/public/network/pages/details/details_tabs.tsx b/x-pack/plugins/security_solution/public/network/pages/details/details_tabs.tsx new file mode 100644 index 0000000000000..82e206ce66f93 --- /dev/null +++ b/x-pack/plugins/security_solution/public/network/pages/details/details_tabs.tsx @@ -0,0 +1,131 @@ +/* + * 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, { useMemo } from 'react'; +import { Switch } from 'react-router-dom'; + +import { EuiFlexItem, EuiSpacer } from '@elastic/eui'; +import type { DataViewBase, Filter } from '@kbn/es-query'; +import { Route } from '@kbn/kibana-react-plugin/public'; +import { TimelineId } from '@kbn/timelines-plugin/common'; +import { getNetworkDetailsPageFilter } from '../../../common/components/visualization_actions/utils'; +import { AnomaliesNetworkTable } from '../../../common/components/ml/tables/anomalies_network_table'; +import { FlowTargetSourceDest } from '../../../../common/search_strategy/security_solution/network'; +import { EventsQueryTabBody } from '../../../common/components/events_tab/events_query_tab_body'; +import type { GlobalTimeArgs } from '../../../common/containers/use_global_time'; + +import { AnomaliesQueryTabBody } from '../../../common/containers/anomalies/anomalies_query_tab_body'; + +import { NETWORK_DETAILS_PAGE_PATH } from '../constants'; + +import { + CountriesQueryTabBody, + HttpQueryTabBody, + IPsQueryTabBody, + TlsQueryTabBody, + UsersQueryTabBody, +} from '../navigation'; +import { ConditionalFlexGroup } from '../navigation/conditional_flex_group'; +import { networkModel } from '../../store'; +import { NetworkDetailsRouteType } from './types'; + +interface NetworkDetailTabsProps { + ip: string; + endDate: string; + startDate: string; + filterQuery: string | undefined; + indexNames: string[]; + skip: boolean; + setQuery: GlobalTimeArgs['setQuery']; + narrowDateRange: (score: unknown, interval: unknown) => void; + indexPattern: DataViewBase; + flowTarget: FlowTargetSourceDest; +} + +export const NetworkDetailsTabs = React.memo( + ({ narrowDateRange, indexPattern, flowTarget, ...rest }) => { + const type = networkModel.NetworkType.details; + + const commonProps = { ...rest, type }; + const flowTabProps = { ...commonProps, indexPattern }; + const commonPropsWithFlowTarget = { ...commonProps, flowTarget }; + + const networkDetailsPageFilters: Filter[] = useMemo( + () => getNetworkDetailsPageFilter(rest.ip), + [rest.ip] + ); + + return ( + + + <> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); + } +); + +NetworkDetailsTabs.displayName = 'UsersDetailsTabs'; diff --git a/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx b/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx index 363a9de3d9633..23dc45a47a60d 100644 --- a/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/details/index.test.tsx @@ -64,7 +64,6 @@ jest.mock('react-router-dom', () => { jest.mock('../../containers/details', () => ({ useNetworkDetails: jest.fn().mockReturnValue([true, { networkDetails: {} }]), })); -jest.mock('../../../common/lib/kibana'); jest.mock('../../../common/containers/sourcerer'); jest.mock('../../../common/containers/use_global_time', () => ({ useGlobalTime: jest.fn().mockReturnValue({ @@ -75,6 +74,27 @@ jest.mock('../../../common/containers/use_global_time', () => ({ }), })); +jest.mock('../../../common/lib/kibana', () => { + const original = jest.requireActual('../../../common/lib/kibana'); + return { + ...original, + useNavigation: () => ({ + getAppUrl: jest.fn, + }), + useKibana: () => ({ + services: { + ...original.useKibana().services, + timelines: { + getUseDraggableKeyboardWrapper: () => () => ({ + onBlur: jest.fn, + onKeyDown: jest.fn, + }), + }, + }, + }), + }; +}); + // Test will fail because we will to need to mock some core services to make the test work // For now let's forget about SiemSearchBar and QueryBar jest.mock('../../../common/components/search_bar', () => ({ diff --git a/x-pack/plugins/security_solution/public/network/pages/details/index.tsx b/x-pack/plugins/security_solution/public/network/pages/details/index.tsx index 809a4cfdb8ef5..082f8e7d4529e 100644 --- a/x-pack/plugins/security_solution/public/network/pages/details/index.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/details/index.tsx @@ -5,21 +5,16 @@ * 2.0. */ -import { EuiHorizontalRule, EuiSpacer, EuiFlexItem } from '@elastic/eui'; +import { EuiHorizontalRule, EuiSpacer } from '@elastic/eui'; import React, { useCallback, useEffect, useMemo } from 'react'; import { useDispatch } from 'react-redux'; import { useParams } from 'react-router-dom'; import { getEsQueryConfig } from '@kbn/data-plugin/common'; -import { - CountriesQueryTabBody, - HttpQueryTabBody, - IPsQueryTabBody, - TlsQueryTabBody, - UsersQueryTabBody, -} from '../navigation'; + import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; -import { FlowTargetSourceDest, LastEventIndexKey } from '../../../../common/search_strategy'; +import { LastEventIndexKey } from '../../../../common/search_strategy'; +import type { FlowTargetSourceDest } from '../../../../common/search_strategy'; import { useGlobalTime } from '../../../common/containers/use_global_time'; import { FiltersGlobal } from '../../../common/components/filters_global'; import { HeaderPage } from '../../../common/components/header_page'; @@ -27,7 +22,6 @@ import { LastEventTime } from '../../../common/components/last_event_time'; import { useAnomaliesTableData } from '../../../common/components/ml/anomaly/use_anomalies_table_data'; import { networkToCriteria } from '../../../common/components/ml/criteria/network_to_criteria'; import { scoreIntervalToDateTime } from '../../../common/components/ml/score/score_interval_to_datetime'; -import { AnomaliesNetworkTable } from '../../../common/components/ml/tables/anomalies_network_table'; import { manageQuery } from '../../../common/components/page/manage_query'; import { FlowTargetSelectConnected } from '../../components/flow_target_select_connected'; import { IpOverview } from '../../components/details'; @@ -37,23 +31,29 @@ import { useNetworkDetails, ID } from '../../containers/details'; import { useKibana } from '../../../common/lib/kibana'; import { decodeIpv6 } from '../../../common/lib/helpers'; import { convertToBuildEsQuery } from '../../../common/lib/keury'; -import { ConditionalFlexGroup } from '../navigation/conditional_flex_group'; import { inputsSelectors } from '../../../common/store'; import { setAbsoluteRangeDatePicker } from '../../../common/store/inputs/actions'; import { setNetworkDetailsTablesActivePageToZero } from '../../store/actions'; import { SpyRoute } from '../../../common/utils/route/spy_routes'; -import { AnomaliesQueryTabBody } from '../../../common/containers/anomalies/anomalies_query_tab_body'; import { networkModel } from '../../store'; import { SecurityPageName } from '../../../app/types'; import { useSourcererDataView } from '../../../common/containers/sourcerer'; import { useInvalidFilterQuery } from '../../../common/hooks/use_invalid_filter_query'; import { LandingPageComponent } from '../../../common/components/landing_page'; +import { SecuritySolutionTabNavigation } from '../../../common/components/navigation'; +import { getNetworkDetailsPageFilter } from '../../../common/components/visualization_actions/utils'; +import { hasMlUserPermissions } from '../../../../common/machine_learning/has_ml_user_permissions'; +import { useMlCapabilities } from '../../../common/components/ml/hooks/use_ml_capabilities'; +import { navTabsNetworkDetails } from './nav_tabs'; +import { NetworkDetailsTabs } from './details_tabs'; + export { getTrailingBreadcrumbs } from './utils'; const NetworkDetailsManage = manageQuery(IpOverview); const NetworkDetailsComponent: React.FC = () => { const dispatch = useDispatch(); + const capabilities = useMlCapabilities(); const { to, from, setQuery, isInitializing } = useGlobalTime(); const { detailName, flowTarget } = useParams<{ detailName: string; @@ -92,11 +92,17 @@ const NetworkDetailsComponent: React.FC = () => { const { indicesExist, indexPattern, selectedPatterns } = useSourcererDataView(); const ip = decodeIpv6(detailName); + + const queryFilters = useMemo( + () => [...getNetworkDetailsPageFilter(ip), ...filters], + [filters, ip] + ); + const [filterQuery, kqlError] = convertToBuildEsQuery({ config: getEsQueryConfig(uiSettings), indexPattern, queries: [query], - filters, + filters: queryFilters, }); useInvalidFilterQuery({ id: ID, filterQuery, kqlError, query, startDate: from, endDate: to }); @@ -150,7 +156,6 @@ const NetworkDetailsComponent: React.FC = () => { > - { narrowDateRange={narrowDateRange} indexPatterns={selectedPatterns} /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.test.tsx b/x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.test.tsx new file mode 100644 index 0000000000000..25572e2f954e7 --- /dev/null +++ b/x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.test.tsx @@ -0,0 +1,62 @@ +/* + * 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 { FlowTargetSourceDest } from '../../../../common/search_strategy'; +import { navTabsNetworkDetails } from './nav_tabs'; +import { NetworkDetailsRouteType } from './types'; + +describe('navTabsNetworkDetails', () => { + test('it should return all tabs if user has ML capabilities', () => { + const tabs = navTabsNetworkDetails('', true, FlowTargetSourceDest.source); + expect(tabs).toEqual(mockTabs); + }); + + test('it should not display anomalies tab if user has no ml permission', () => { + const tabs = navTabsNetworkDetails('', false, FlowTargetSourceDest.source); + + expect(tabs).not.toHaveProperty(NetworkDetailsRouteType.anomalies); + }); +}); + +const mockTabs = { + flows: { + id: 'flows', + name: 'Flows', + href: '/network/ip//source/flows', + disabled: false, + }, + users: { + id: 'users', + name: 'Users', + href: '/network/ip//source/users', + disabled: false, + }, + http: { + id: 'http', + name: 'HTTP', + href: '/network/ip//source/http', + disabled: false, + }, + tls: { + id: 'tls', + name: 'TLS', + href: '/network/ip//source/tls', + disabled: false, + }, + anomalies: { + id: 'anomalies', + name: 'Anomalies', + href: '/network/ip//source/anomalies', + disabled: false, + }, + events: { + id: 'events', + name: 'Events', + href: '/network/ip//source/events', + disabled: false, + }, +}; diff --git a/x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.tsx b/x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.tsx new file mode 100644 index 0000000000000..6569b68815040 --- /dev/null +++ b/x-pack/plugins/security_solution/public/network/pages/details/nav_tabs.tsx @@ -0,0 +1,69 @@ +/* + * 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 { FlowTargetSourceDest } from '../../../../common/search_strategy'; +import { NETWORK_PATH } from '../../../../common/constants'; +import * as i18n from '../translations'; +import type { NetworkDetailsNavTabs } from './types'; +import { NetworkDetailsRouteType } from './types'; + +const getTabsOnNetworkDetailsUrl = ( + ipAddress: string, + tabName: NetworkDetailsRouteType, + flowTarget: FlowTargetSourceDest +) => `${NETWORK_PATH}/ip/${ipAddress}/${flowTarget}/${tabName}`; + +export const navTabsNetworkDetails = ( + ipAddress: string, + hasMlUserPermissions: boolean, + flowTarget: FlowTargetSourceDest +): NetworkDetailsNavTabs => { + const networkDetailsNavTabs: NetworkDetailsNavTabs = { + [NetworkDetailsRouteType.flows]: { + id: NetworkDetailsRouteType.flows, + name: i18n.NAVIGATION_FLOWS_TITLE, + href: getTabsOnNetworkDetailsUrl(ipAddress, NetworkDetailsRouteType.flows, flowTarget), + disabled: false, + }, + [NetworkDetailsRouteType.users]: { + id: NetworkDetailsRouteType.users, + name: i18n.NAVIGATION_USERS_TITLE, + href: getTabsOnNetworkDetailsUrl(ipAddress, NetworkDetailsRouteType.users, flowTarget), + disabled: false, + }, + [NetworkDetailsRouteType.http]: { + id: NetworkDetailsRouteType.http, + name: i18n.NAVIGATION_HTTP_TITLE, + href: getTabsOnNetworkDetailsUrl(ipAddress, NetworkDetailsRouteType.http, flowTarget), + disabled: false, + }, + [NetworkDetailsRouteType.tls]: { + id: NetworkDetailsRouteType.tls, + name: i18n.NAVIGATION_TLS_TITLE, + href: getTabsOnNetworkDetailsUrl(ipAddress, NetworkDetailsRouteType.tls, flowTarget), + disabled: false, + }, + [NetworkDetailsRouteType.anomalies]: { + id: NetworkDetailsRouteType.anomalies, + name: i18n.NAVIGATION_ANOMALIES_TITLE, + href: getTabsOnNetworkDetailsUrl(ipAddress, NetworkDetailsRouteType.anomalies, flowTarget), + disabled: false, + }, + [NetworkDetailsRouteType.events]: { + id: NetworkDetailsRouteType.events, + name: i18n.NAVIGATION_EVENTS_TITLE, + href: getTabsOnNetworkDetailsUrl(ipAddress, NetworkDetailsRouteType.events, flowTarget), + disabled: false, + }, + }; + + if (!hasMlUserPermissions) { + delete networkDetailsNavTabs.anomalies; + } + + return networkDetailsNavTabs; +}; diff --git a/x-pack/plugins/security_solution/public/network/pages/details/types.ts b/x-pack/plugins/security_solution/public/network/pages/details/types.ts index 26d27f26415f8..726232aed3068 100644 --- a/x-pack/plugins/security_solution/public/network/pages/details/types.ts +++ b/x-pack/plugins/security_solution/public/network/pages/details/types.ts @@ -5,9 +5,12 @@ * 2.0. */ +import type { Optional } from '@kbn/utility-types'; + import type { ESTermQuery } from '../../../../common/typed_json'; -import { NetworkType } from '../../store/model'; +import type { NavTab } from '../../../common/components/navigation/types'; import type { GlobalTimeArgs } from '../../../common/containers/use_global_time'; +import { NetworkType } from '../../store/model'; export const type = NetworkType.details; @@ -21,3 +24,17 @@ export interface OwnProps { skip: boolean; setQuery: GlobalTimeArgs['setQuery']; } + +export enum NetworkDetailsRouteType { + anomalies = 'anomalies', + flows = 'flows', + tls = 'tls', + http = 'http', + events = 'events', + users = 'users', +} + +export type NetworkDetailsNavTabs = Optional< + Record<`${NetworkDetailsRouteType}`, NavTab>, + 'anomalies' +>; diff --git a/x-pack/plugins/security_solution/public/network/pages/details/utils.ts b/x-pack/plugins/security_solution/public/network/pages/details/utils.ts index ff8d44a07ef17..54bb1720d2d5d 100644 --- a/x-pack/plugins/security_solution/public/network/pages/details/utils.ts +++ b/x-pack/plugins/security_solution/public/network/pages/details/utils.ts @@ -12,19 +12,21 @@ import { decodeIpv6 } from '../../../common/lib/helpers'; import { getNetworkDetailsUrl } from '../../../common/components/link_to/redirect_to_network'; import { networkModel } from '../../store'; import * as i18n from '../translations'; -import { NetworkRouteType } from '../navigation/types'; +import { NetworkDetailsRouteType } from './types'; import type { NetworkRouteSpyState } from '../../../common/utils/route/types'; import { SecurityPageName } from '../../../app/types'; import type { GetSecuritySolutionUrl } from '../../../common/components/link_to'; +import { NetworkRouteType } from '../navigation/types'; export const type = networkModel.NetworkType.details; -const TabNameMappedToI18nKey: Record = { - [NetworkRouteType.alerts]: i18n.NAVIGATION_EVENTS_TITLE, - [NetworkRouteType.anomalies]: i18n.NAVIGATION_ANOMALIES_TITLE, - [NetworkRouteType.flows]: i18n.NAVIGATION_FLOWS_TITLE, +const TabNameMappedToI18nKey: Record = { + [NetworkDetailsRouteType.events]: i18n.NAVIGATION_EVENTS_TITLE, + [NetworkDetailsRouteType.anomalies]: i18n.NAVIGATION_ANOMALIES_TITLE, + [NetworkDetailsRouteType.flows]: i18n.NAVIGATION_FLOWS_TITLE, + [NetworkDetailsRouteType.users]: i18n.NAVIGATION_USERS_TITLE, + [NetworkDetailsRouteType.http]: i18n.NAVIGATION_HTTP_TITLE, + [NetworkDetailsRouteType.tls]: i18n.NAVIGATION_TLS_TITLE, [NetworkRouteType.dns]: i18n.NAVIGATION_DNS_TITLE, - [NetworkRouteType.http]: i18n.NAVIGATION_HTTP_TITLE, - [NetworkRouteType.tls]: i18n.NAVIGATION_TLS_TITLE, }; export const getTrailingBreadcrumbs = ( diff --git a/x-pack/plugins/security_solution/public/network/pages/index.tsx b/x-pack/plugins/security_solution/public/network/pages/index.tsx index 30510e3269f5c..e55e501a17176 100644 --- a/x-pack/plugins/security_solution/public/network/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/index.tsx @@ -17,10 +17,18 @@ import { Network } from './network'; import { getNetworkRoutePath } from './navigation'; import { NetworkRouteType } from './navigation/types'; import { MlNetworkConditionalContainer } from '../../common/components/ml/conditional_links/ml_network_conditional_container'; -import { FlowTarget } from '../../../common/search_strategy'; import { NETWORK_PATH } from '../../../common/constants'; +import { FlowTargetSourceDest } from '../../../common/search_strategy'; +import { + FLOW_TARGET_PARAM, + NETWORK_DETAILS_PAGE_PATH, + NETWORK_DETAILS_TAB_PATH, +} from './constants'; -const ipDetailsPageBasePath = `${NETWORK_PATH}/ip/:detailName`; +const getPathWithFlowType = (detailName: string, flowTarget?: FlowTargetSourceDest) => + `${NETWORK_PATH}/ip/${detailName}/${flowTarget || FlowTargetSourceDest.source}/${ + NetworkRouteType.flows + }`; const NetworkContainerComponent = () => { const capabilities = useMlCapabilities(); @@ -53,25 +61,32 @@ const NetworkContainerComponent = () => { hasMlUserPermissions={userHasMlUserPermissions} /> - + ( )} /> + + + ); }; diff --git a/x-pack/plugins/security_solution/public/network/pages/navigation/nav_tabs.tsx b/x-pack/plugins/security_solution/public/network/pages/navigation/nav_tabs.tsx index d1992c756cc67..9097bb10a1c58 100644 --- a/x-pack/plugins/security_solution/public/network/pages/navigation/nav_tabs.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/navigation/nav_tabs.tsx @@ -45,10 +45,10 @@ export const navTabsNetwork = (hasMlUserPermissions: boolean): NetworkNavTab => href: getTabsOnNetworkUrl(NetworkRouteType.anomalies), disabled: false, }, - [NetworkRouteType.alerts]: { - id: NetworkRouteType.alerts, + [NetworkRouteType.events]: { + id: NetworkRouteType.events, name: i18n.NAVIGATION_EVENTS_TITLE, - href: getTabsOnNetworkUrl(NetworkRouteType.alerts), + href: getTabsOnNetworkUrl(NetworkRouteType.events), disabled: false, }, }; diff --git a/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx b/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx index c98ddacb6122b..0e7d55b4af10f 100644 --- a/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/navigation/network_routes.tsx @@ -155,7 +155,7 @@ export const NetworkRoutes = React.memo( AnomaliesTableComponent={AnomaliesNetworkTable} /> - + ; +export type NetworkNavTab = Optional, 'anomalies'>; export type GetNetworkRoutePath = ( capabilitiesFetched: boolean, diff --git a/x-pack/plugins/security_solution/public/network/pages/navigation/utils.ts b/x-pack/plugins/security_solution/public/network/pages/navigation/utils.ts index 5eb469e22297d..17611998cefde 100644 --- a/x-pack/plugins/security_solution/public/network/pages/navigation/utils.ts +++ b/x-pack/plugins/security_solution/public/network/pages/navigation/utils.ts @@ -5,25 +5,13 @@ * 2.0. */ -import { NETWORK_PATH } from '../../../../common/constants'; +import { NETWORK_PATH_WITH_ANOMALIES, NETWORK_PATH_WITHOUT_ANOMALIES } from '../constants'; import type { GetNetworkRoutePath } from './types'; -import { NetworkRouteType } from './types'; export const getNetworkRoutePath: GetNetworkRoutePath = ( capabilitiesFetched, hasMlUserPermission -) => { - if (capabilitiesFetched && !hasMlUserPermission) { - return `${NETWORK_PATH}/:tabName(${NetworkRouteType.flows}|${NetworkRouteType.dns}|${NetworkRouteType.http}|${NetworkRouteType.tls}|${NetworkRouteType.alerts})`; - } - - return ( - `${NETWORK_PATH}/:tabName(` + - `${NetworkRouteType.flows}|` + - `${NetworkRouteType.dns}|` + - `${NetworkRouteType.anomalies}|` + - `${NetworkRouteType.http}|` + - `${NetworkRouteType.tls}|` + - `${NetworkRouteType.alerts})` - ); -}; +) => + capabilitiesFetched && !hasMlUserPermission + ? NETWORK_PATH_WITHOUT_ANOMALIES + : NETWORK_PATH_WITH_ANOMALIES; diff --git a/x-pack/plugins/security_solution/public/network/pages/network.tsx b/x-pack/plugins/security_solution/public/network/pages/network.tsx index b117624782af8..4ff93aa701f04 100644 --- a/x-pack/plugins/security_solution/public/network/pages/network.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/network.tsx @@ -87,7 +87,7 @@ const NetworkComponent = React.memo( const canUseMaps = kibana.services.application.capabilities.maps.show; const tabsFilters = useMemo(() => { - if (tabName === NetworkRouteType.alerts) { + if (tabName === NetworkRouteType.events) { return filters.length > 0 ? [...filters, ...filterNetworkExternalAlertData] : filterNetworkExternalAlertData; diff --git a/x-pack/plugins/security_solution/public/network/pages/translations.ts b/x-pack/plugins/security_solution/public/network/pages/translations.ts index 550afe94f811f..52d787a5fc56e 100644 --- a/x-pack/plugins/security_solution/public/network/pages/translations.ts +++ b/x-pack/plugins/security_solution/public/network/pages/translations.ts @@ -25,6 +25,13 @@ export const NAVIGATION_DNS_TITLE = i18n.translate( } ); +export const NAVIGATION_USERS_TITLE = i18n.translate( + 'xpack.securitySolution.network.navigation.usersTitle', + { + defaultMessage: 'Users', + } +); + export const NAVIGATION_TLS_TITLE = i18n.translate( 'xpack.securitySolution.network.navigation.tlsTitle', { diff --git a/x-pack/plugins/security_solution/public/timelines/components/netflow/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/netflow/__snapshots__/index.test.tsx.snap index bcfd01077cca0..7df27ab863446 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/netflow/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/netflow/__snapshots__/index.test.tsx.snap @@ -1123,7 +1123,7 @@ tr:hover .c3:focus::before { 192.168.1.2 @@ -2002,7 +2002,7 @@ tr:hover .c3:focus::before { 10.1.2.3 diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap index 88b357b355a2b..d551b5ed3bae6 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap @@ -1261,7 +1261,7 @@ tr:hover .c5:focus::before { 192.168.1.2 @@ -2305,7 +2305,7 @@ tr:hover .c5:focus::before { 10.1.2.3 From a74c3fab9647ab0f0f54ff7ab9eaab84d9ecb03c Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Tue, 2 Aug 2022 15:39:02 -0400 Subject: [PATCH 20/21] [CI] Enable kibana build reuse where possible (#136653) --- .buildkite/pipeline-utils/ci-stats/on_complete.ts | 7 ++++++- .buildkite/pull_requests.json | 3 +-- .buildkite/scripts/lifecycle/pre_build.sh | 8 ++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipeline-utils/ci-stats/on_complete.ts b/.buildkite/pipeline-utils/ci-stats/on_complete.ts index 0b93fd6b0673f..e0ef78a2f61c2 100644 --- a/.buildkite/pipeline-utils/ci-stats/on_complete.ts +++ b/.buildkite/pipeline-utils/ci-stats/on_complete.ts @@ -26,7 +26,12 @@ export async function onComplete() { return; } - const report = await ciStats.getPrReport(process.env.CI_STATS_BUILD_ID); + const backfillJobIds: string[] = []; + if (process.env.KIBANA_REUSABLE_BUILD_JOB_ID) { + backfillJobIds.push(process.env.KIBANA_REUSABLE_BUILD_JOB_ID); + } + + const report = await ciStats.getPrReport(process.env.CI_STATS_BUILD_ID, backfillJobIds); if (report?.md) { buildkite.setMetadata('pr_comment:ci_stats_report:body', report.md); diff --git a/.buildkite/pull_requests.json b/.buildkite/pull_requests.json index 0391c20304e25..93c1d834118df 100644 --- a/.buildkite/pull_requests.json +++ b/.buildkite/pull_requests.json @@ -38,8 +38,7 @@ "kibana_versions_check": true, "kibana_build_reuse": true, "kibana_build_reuse_pipeline_slugs": ["kibana-pull-request", "kibana-on-merge"], - "kibana_build_reuse_regexes": ["^test/", "^x-pack/test/"], - "kibana_build_reuse_label": "ci:reuse-kibana-build" + "kibana_build_reuse_regexes": ["^test/", "^x-pack/test/"] } ] } diff --git a/.buildkite/scripts/lifecycle/pre_build.sh b/.buildkite/scripts/lifecycle/pre_build.sh index 107e555a430c9..62f94dd493fa8 100755 --- a/.buildkite/scripts/lifecycle/pre_build.sh +++ b/.buildkite/scripts/lifecycle/pre_build.sh @@ -20,3 +20,11 @@ if [[ ! "${ES_SNAPSHOT_MANIFEST:-}" ]]; then ES_SNAPSHOT_MANIFEST_DEFAULT="https://storage.googleapis.com/$BUCKET/manifest.json" buildkite-agent meta-data set ES_SNAPSHOT_MANIFEST_DEFAULT "$ES_SNAPSHOT_MANIFEST_DEFAULT" fi + +if [[ "${KIBANA_BUILD_ID:-}" && "${KIBANA_REUSABLE_BUILD_JOB_URL:-}" ]]; then + cat << EOF | buildkite-agent annotate --style default --context kibana-reusable-build + This build is using the Kibana distributable built from a different job, as the changes since this build do not seem to require a rebuild. + + See job here: $KIBANA_REUSABLE_BUILD_JOB_URL +EOF +fi From 5b1e073e2f15c8a8f308201451426d3782edd5ec Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Tue, 2 Aug 2022 15:41:26 -0400 Subject: [PATCH 21/21] Re-add kibana_build_reuse_label to PR config temporarily --- .buildkite/pull_requests.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/pull_requests.json b/.buildkite/pull_requests.json index 93c1d834118df..0391c20304e25 100644 --- a/.buildkite/pull_requests.json +++ b/.buildkite/pull_requests.json @@ -38,7 +38,8 @@ "kibana_versions_check": true, "kibana_build_reuse": true, "kibana_build_reuse_pipeline_slugs": ["kibana-pull-request", "kibana-on-merge"], - "kibana_build_reuse_regexes": ["^test/", "^x-pack/test/"] + "kibana_build_reuse_regexes": ["^test/", "^x-pack/test/"], + "kibana_build_reuse_label": "ci:reuse-kibana-build" } ] }