Skip to content

Commit

Permalink
Update links to Exploratory View in APM app to use new Exploratory Vi…
Browse files Browse the repository at this point in the history
…ew app (elastic#153922)
  • Loading branch information
CoenWarmer authored and jgowdyelastic committed Mar 30, 2023
1 parent cbcd1b3 commit 5d3dee2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/apm/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"inspector",
"licensing",
"observability",
"exploratoryView",
"ruleRegistry",
"triggersActionsUi",
"share",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('AnalyzeDataButton', () => {
render(<Example agentName="rum-js" />);

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)))'
);
});
});
Expand All @@ -48,7 +48,7 @@ describe('AnalyzeDataButton', () => {
render(<Example agentName="iOS/swift" />);

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)))'
);
});
});
Expand All @@ -58,7 +58,7 @@ describe('AnalyzeDataButton', () => {
render(<Example environment={ENVIRONMENT_NOT_DEFINED.value} />);

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)))'
);
});
});
Expand All @@ -68,7 +68,7 @@ describe('AnalyzeDataButton', () => {
render(<Example environment={ENVIRONMENT_ALL.value} />);

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)))'
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions x-pack/plugins/apm/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -72,6 +73,7 @@ export type ApmPluginStart = void;
export interface ApmPluginSetupDeps {
alerting?: AlertingPluginPublicSetup;
data: DataPublicPluginSetup;
exploratoryView: ExploratoryViewPublicSetup;
unifiedSearch: UnifiedSearchPublicPluginStart;
features: FeaturesPluginSetup;
home?: HomePublicPluginSetup;
Expand Down Expand Up @@ -271,6 +273,18 @@ export class ApmPlugin implements Plugin<ApmPluginSetup, ApmPluginStart> {
},
});

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({
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"@kbn/safer-lodash-set",
"@kbn/shared-ux-router",
"@kbn/alerts-as-data-utils",
"@kbn/exploratory-view-plugin",
],
"exclude": [
"target/**/*",
Expand Down

0 comments on commit 5d3dee2

Please sign in to comment.