From b99a4a38f7df8bbc7eb79b7822c8d5b67292f4b2 Mon Sep 17 00:00:00 2001 From: Coen Warmer Date: Wed, 29 Mar 2023 10:51:24 +0200 Subject: [PATCH] Update links to Exploratory View in APM app to use new Exploratory View app --- x-pack/plugins/apm/kibana.jsonc | 1 + .../analyze_data_button.test.tsx | 8 ++++---- .../apm_service_template/analyze_data_button.tsx | 4 ++-- x-pack/plugins/apm/public/plugin.ts | 14 ++++++++++++++ x-pack/plugins/apm/tsconfig.json | 1 + 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/apm/kibana.jsonc b/x-pack/plugins/apm/kibana.jsonc index 9d77d00b21be..02ca85e30f0a 100644 --- a/x-pack/plugins/apm/kibana.jsonc +++ b/x-pack/plugins/apm/kibana.jsonc @@ -19,6 +19,7 @@ "inspector", "licensing", "observability", + "exploratoryView", "ruleRegistry", "triggersActionsUi", "share", diff --git a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.test.tsx b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.test.tsx index f499cf88ecdb..4f0a02e1705a 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.test.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.test.tsx @@ -38,7 +38,7 @@ describe('AnalyzeDataButton', () => { render(); expect((screen.getByRole('link') as HTMLAnchorElement).href).toEqual( - 'http://localhost/app/observability/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:ux,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(testEnvironment),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' + 'http://localhost/app/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:ux,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(testEnvironment),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' ); }); }); @@ -48,7 +48,7 @@ describe('AnalyzeDataButton', () => { render(); expect((screen.getByRole('link') as HTMLAnchorElement).href).toEqual( - 'http://localhost/app/observability/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:mobile,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(testEnvironment),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' + 'http://localhost/app/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:mobile,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(testEnvironment),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' ); }); }); @@ -58,7 +58,7 @@ describe('AnalyzeDataButton', () => { render(); expect((screen.getByRole('link') as HTMLAnchorElement).href).toEqual( - 'http://localhost/app/observability/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:mobile,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(ENVIRONMENT_NOT_DEFINED),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' + 'http://localhost/app/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:mobile,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(ENVIRONMENT_NOT_DEFINED),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' ); }); }); @@ -68,7 +68,7 @@ describe('AnalyzeDataButton', () => { render(); expect((screen.getByRole('link') as HTMLAnchorElement).href).toEqual( - 'http://localhost/app/observability/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:mobile,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(ALL_VALUES),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' + 'http://localhost/app/exploratory-view/#?reportType=kpi-over-time&sr=!((dt:mobile,mt:transaction.duration.us,n:testServiceName-response-latency,op:average,rdf:(service.environment:!(ALL_VALUES),service.name:!(testServiceName)),time:(from:now-15m,to:now)))' ); }); }); diff --git a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.tsx b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.tsx index 0c1e86aa5fa2..abeb6cb8fc96 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/apm_service_template/analyze_data_button.tsx @@ -9,8 +9,8 @@ import { EuiButtonEmpty, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { createExploratoryViewUrl } from '@kbn/observability-plugin/public'; -import { ALL_VALUES_SELECTED } from '@kbn/observability-plugin/public'; +import { createExploratoryViewUrl } from '@kbn/exploratory-view-plugin/public'; +import { ALL_VALUES_SELECTED } from '@kbn/exploratory-view-plugin/public'; import { isMobileAgentName, isRumAgentName, diff --git a/x-pack/plugins/apm/public/plugin.ts b/x-pack/plugins/apm/public/plugin.ts index 89f17be8d471..ba7b455c05bb 100644 --- a/x-pack/plugins/apm/public/plugin.ts +++ b/x-pack/plugins/apm/public/plugin.ts @@ -23,6 +23,7 @@ import type { } from '@kbn/data-plugin/public'; import { LensPublicStart } from '@kbn/lens-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { ExploratoryViewPublicSetup } from '@kbn/exploratory-view-plugin/public'; import type { EmbeddableStart } from '@kbn/embeddable-plugin/public'; import type { HomePublicPluginSetup } from '@kbn/home-plugin/public'; import { Start as InspectorPluginStart } from '@kbn/inspector-plugin/public'; @@ -72,6 +73,7 @@ export type ApmPluginStart = void; export interface ApmPluginSetupDeps { alerting?: AlertingPluginPublicSetup; data: DataPublicPluginSetup; + exploratoryView: ExploratoryViewPublicSetup; unifiedSearch: UnifiedSearchPublicPluginStart; features: FeaturesPluginSetup; home?: HomePublicPluginSetup; @@ -271,6 +273,18 @@ export class ApmPlugin implements Plugin { }, }); + plugins.exploratoryView.register({ + appName: 'apm', + hasData: async () => { + const dataHelper = await getApmDataHelper(); + return await dataHelper.getHasData(); + }, + fetchData: async (params: FetchDataParams) => { + const dataHelper = await getApmDataHelper(); + return await dataHelper.fetchObservabilityOverviewPageData(params); + }, + }); + const { observabilityRuleTypeRegistry } = plugins.observability; core.application.register({ diff --git a/x-pack/plugins/apm/tsconfig.json b/x-pack/plugins/apm/tsconfig.json index 149b43ebc648..d4d263af763a 100644 --- a/x-pack/plugins/apm/tsconfig.json +++ b/x-pack/plugins/apm/tsconfig.json @@ -81,6 +81,7 @@ "@kbn/safer-lodash-set", "@kbn/shared-ux-router", "@kbn/alerts-as-data-utils", + "@kbn/exploratory-view-plugin", ], "exclude": [ "target/**/*",