Skip to content

Commit da7d54e

Browse files
authored
MDS Support for trace analytics (#1752)
* added changes for datasourcemds- ids Signed-off-by: sumukhswamy <[email protected]> * added trace analytics support for MDS Signed-off-by: sumukhswamy <[email protected]> * added trace analytics support for MDS Signed-off-by: sumukhswamy <[email protected]> * added changes Signed-off-by: sumukhswamy <[email protected]> * addressed PR comments Signed-off-by: sumukhswamy <[email protected]> * addressed linter issues Signed-off-by: sumukhswamy <[email protected]> --------- Signed-off-by: sumukhswamy <[email protected]> Signed-off-by: Sumukh Swamy <[email protected]>
1 parent cb845f2 commit da7d54e

37 files changed

+825
-275
lines changed

opensearch_dashboards.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"urlForwarding",
1919
"visualizations"
2020
],
21-
"optionalPlugins": ["managementOverview", "assistantDashboards", "securityDashboards"],
21+
"optionalPlugins": ["managementOverview", "assistantDashboards", "securityDashboards", "dataSource", "dataSourceManagement"],
2222
"configPath": ["observability"]
2323
}

public/components/app.tsx

+16-3
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ import { I18nProvider } from '@osd/i18n/react';
77
import { QueryManager } from 'common/query_manager';
88
import React from 'react';
99
import { Provider } from 'react-redux';
10-
import { CoreStart } from '../../../../src/core/public';
10+
import { CoreStart, MountPoint } from '../../../../src/core/public';
11+
import { DataSourceManagementPluginSetup } from '../../../../src/plugins/data_source_management/public';
1112
import { observabilityID, observabilityTitle } from '../../common/constants/shared';
1213
import { store } from '../framework/redux/store';
1314
import { AppPluginStartDependencies } from '../types';
1415
import { Home as ApplicationAnalyticsHome } from './application_analytics/home';
15-
import { Home as IntegrationsHome } from './integrations/home';
1616
import { MetricsListener } from './common/metrics_listener';
1717
import { Home as CustomPanelsHome } from './custom_panels/home';
18+
import { Home as DataConnectionsHome } from './datasources/home';
1819
import { EventAnalytics } from './event_analytics';
20+
import { Home as IntegrationsHome } from './integrations/home';
1921
import { Home as MetricsHome } from './metrics/index';
2022
import { Main as NotebooksHome } from './notebooks/components/main';
2123
import { Home as TraceAnalyticsHome } from './trace_analytics/home';
22-
import { Home as DataConnectionsHome } from './datasources/home';
2324

2425
interface ObservabilityAppDeps {
2526
CoreStartProp: CoreStart;
@@ -30,6 +31,10 @@ interface ObservabilityAppDeps {
3031
timestampUtils: any;
3132
queryManager: QueryManager;
3233
startPage: string;
34+
dataSourceEnabled: boolean;
35+
dataSourceManagement: DataSourceManagementPluginSetup;
36+
setActionMenu: (menuMount: MountPoint | undefined) => void;
37+
savedObjectsMDSClient: CoreStart['savedObjects'];
3338
}
3439

3540
// for cypress to test redux store
@@ -58,6 +63,10 @@ export const App = ({
5863
queryManager,
5964
startPage,
6065
dataSourcePluggables,
66+
dataSourceManagement,
67+
setActionMenu,
68+
dataSourceEnabled,
69+
savedObjectsMDSClient,
6170
}: ObservabilityAppDeps) => {
6271
const { chrome, http, notifications, savedObjects: coreSavedObjects } = CoreStartProp;
6372
const parentBreadcrumb = {
@@ -89,6 +98,10 @@ export const App = ({
8998
parentBreadcrumbs={[parentBreadcrumb]}
9099
setBreadcrumbs={chrome.setBreadcrumbs}
91100
dataSourcePluggables={dataSourcePluggables}
101+
dataSourceManagement={dataSourceManagement}
102+
dataSourceEnabled={dataSourceEnabled}
103+
setActionMenu={setActionMenu}
104+
savedObjectsMDSClient={savedObjectsMDSClient}
92105
/>
93106
</MetricsListener>
94107
</I18nProvider>

public/components/application_analytics/components/config_components/service_config.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ import {
1515
EuiText,
1616
} from '@elastic/eui';
1717
import DSLService from 'public/services/requests/dsl';
18-
import React, { useState } from 'react';
19-
import { useEffect } from 'react';
18+
import React, { useEffect, useState } from 'react';
19+
import { OptionType } from '../../../../../common/types/application_analytics';
2020
import { FilterType } from '../../../trace_analytics/components/common/filters/filters';
2121
import { ServiceObject } from '../../../trace_analytics/components/common/plots/service_map';
2222
import { ServiceMap } from '../../../trace_analytics/components/services';
2323
import { handleServiceMapRequest } from '../../../trace_analytics/requests/services_request_handler';
24-
import { AppAnalyticsComponentDeps } from '../../home';
25-
import { OptionType } from '../../../../../common/types/application_analytics';
2624
import { getClearModal } from '../../helpers/modal_containers';
25+
import { AppAnalyticsComponentDeps } from '../../home';
2726

2827
interface ServiceConfigProps extends AppAnalyticsComponentDeps {
2928
dslService: DSLService;
@@ -50,7 +49,7 @@ export const ServiceConfig = (props: ServiceConfigProps) => {
5049
const [modalLayout, setModalLayout] = useState(<EuiOverlayMask />);
5150

5251
useEffect(() => {
53-
handleServiceMapRequest(http, dslService, mode, setServiceMap);
52+
handleServiceMapRequest(http, dslService, mode, '', setServiceMap);
5453
}, []);
5554

5655
useEffect(() => {

public/components/application_analytics/components/flyout_components/service_detail_flyout.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55
/* eslint-disable react-hooks/exhaustive-deps */
66

7-
import _ from 'lodash';
87
import {
98
EuiFlyout,
109
EuiFlyoutBody,
@@ -14,19 +13,20 @@ import {
1413
EuiText,
1514
EuiTitle,
1615
} from '@elastic/eui';
16+
import _ from 'lodash';
1717
import React, { useEffect, useMemo, useState } from 'react';
18-
import {
19-
handleServiceMapRequest,
20-
handleServiceViewRequest,
21-
} from '../../../../../public/components/trace_analytics/requests/services_request_handler';
2218
import {
2319
filtersToDsl,
2420
processTimeStamp,
2521
} from '../../../../../public/components/trace_analytics/components/common/helper_functions';
26-
import { ServiceMap } from '../../../../../public/components/trace_analytics/components/services';
2722
import { ServiceObject } from '../../../../../public/components/trace_analytics/components/common/plots/service_map';
23+
import { ServiceMap } from '../../../../../public/components/trace_analytics/components/services';
2824
import { SpanDetailTable } from '../../../../../public/components/trace_analytics/components/traces/span_detail_table';
2925
import { TraceAnalyticsComponentDeps } from '../../../../../public/components/trace_analytics/home';
26+
import {
27+
handleServiceMapRequest,
28+
handleServiceViewRequest,
29+
} from '../../../../../public/components/trace_analytics/requests/services_request_handler';
3030
import { getListItem } from '../../helpers/utils';
3131

3232
interface ServiceFlyoutProps extends TraceAnalyticsComponentDeps {
@@ -131,7 +131,7 @@ export function ServiceDetailFlyout(props: ServiceFlyoutProps) {
131131
appConfigs
132132
);
133133
handleServiceViewRequest(serviceName, http, serviceDSL, setFields, mode);
134-
handleServiceMapRequest(http, serviceDSL, mode, setServiceMap, serviceName);
134+
handleServiceMapRequest(http, serviceDSL, mode, '', setServiceMap, serviceName);
135135
const spanDSL = filtersToDsl(mode, filters, query, startTime, endTime, 'app', appConfigs);
136136
spanDSL.query.bool.must.push({
137137
term: {

public/components/index.tsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
import { QueryManager } from 'common/query_manager';
67
import React from 'react';
78
import ReactDOM from 'react-dom';
8-
import { QueryManager } from 'common/query_manager';
99
import { AppMountParameters, CoreStart } from '../../../../src/core/public';
10-
import { AppPluginStartDependencies, SetupDependencies } from '../types';
10+
import { DataSourceManagementPluginSetup } from '../../../../src/plugins/data_source_management/public';
11+
import { AppPluginStartDependencies } from '../types';
1112
import { App } from './app';
1213

1314
export const Observability = (
@@ -20,8 +21,12 @@ export const Observability = (
2021
timestampUtils: any,
2122
queryManager: QueryManager,
2223
startPage: string,
23-
dataSourcePluggables
24+
dataSourcePluggables,
25+
dataSourceManagement: DataSourceManagementPluginSetup,
26+
savedObjectsMDSClient: CoreStart['savedObjects']
2427
) => {
28+
const { setHeaderActionMenu } = AppMountParametersProp;
29+
const { dataSource } = DepsStart;
2530
ReactDOM.render(
2631
<App
2732
CoreStartProp={CoreStartProp}
@@ -33,6 +38,10 @@ export const Observability = (
3338
queryManager={queryManager}
3439
startPage={startPage}
3540
dataSourcePluggables={dataSourcePluggables}
41+
dataSourceManagement={dataSourceManagement}
42+
setActionMenu={setHeaderActionMenu}
43+
dataSourceEnabled={!!dataSource}
44+
savedObjectsMDSClient={savedObjectsMDSClient}
3645
/>,
3746
AppMountParametersProp.element
3847
);

public/components/trace_analytics/components/dashboard/__tests__/__snapshots__/dashboard.test.tsx.snap

+48
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ exports[`Dashboard component renders dashboard 1`] = `
149149
}
150150
}
151151
dataPrepperIndicesExist={true}
152+
dataSourceMDSId={
153+
Array [
154+
Object {
155+
"id": "",
156+
"label": "",
157+
},
158+
]
159+
}
152160
endTime="now"
153161
filters={Array []}
154162
http={[MockFunction]}
@@ -479,6 +487,14 @@ exports[`Dashboard component renders dashboard 1`] = `
479487
}
480488
}
481489
dataPrepperIndicesExist={true}
490+
dataSourceMDSId={
491+
Array [
492+
Object {
493+
"id": "",
494+
"label": "",
495+
},
496+
]
497+
}
482498
endTime="now"
483499
filters={Array []}
484500
http={[MockFunction]}
@@ -1261,6 +1277,14 @@ exports[`Dashboard component renders empty dashboard 1`] = `
12611277
}
12621278
}
12631279
dataPrepperIndicesExist={true}
1280+
dataSourceMDSId={
1281+
Array [
1282+
Object {
1283+
"id": "",
1284+
"label": "",
1285+
},
1286+
]
1287+
}
12641288
endTime="now"
12651289
filters={Array []}
12661290
http={[MockFunction]}
@@ -1590,6 +1614,14 @@ exports[`Dashboard component renders empty dashboard 1`] = `
15901614
}
15911615
}
15921616
dataPrepperIndicesExist={true}
1617+
dataSourceMDSId={
1618+
Array [
1619+
Object {
1620+
"id": "",
1621+
"label": "",
1622+
},
1623+
]
1624+
}
15931625
endTime="now"
15941626
filters={Array []}
15951627
http={[MockFunction]}
@@ -2372,6 +2404,14 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = `
23722404
}
23732405
}
23742406
dataPrepperIndicesExist={false}
2407+
dataSourceMDSId={
2408+
Array [
2409+
Object {
2410+
"id": "",
2411+
"label": "",
2412+
},
2413+
]
2414+
}
23752415
endTime="now"
23762416
filters={Array []}
23772417
http={[MockFunction]}
@@ -2703,6 +2743,14 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = `
27032743
}
27042744
}
27052745
dataPrepperIndicesExist={false}
2746+
dataSourceMDSId={
2747+
Array [
2748+
Object {
2749+
"id": "",
2750+
"label": "",
2751+
},
2752+
]
2753+
}
27062754
endTime="now"
27072755
filters={Array []}
27082756
http={[MockFunction]}

public/components/trace_analytics/components/dashboard/__tests__/dashboard.test.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { configure, mount } from 'enzyme';
77
import Adapter from 'enzyme-adapter-react-16';
88
import React from 'react';
99
import { Dashboard } from '..';
10-
import { CoreStart } from '../../../../../../../../src/core/public';
1110
import { coreStartMock } from '../../../../../../test/__mocks__/coreMocks';
1211

1312
describe('Dashboard component', () => {
@@ -56,6 +55,7 @@ describe('Dashboard component', () => {
5655
mode="data_prepper"
5756
dataPrepperIndicesExist={true}
5857
modes={modes}
58+
dataSourceMDSId={[{ id: '', label: '' }]}
5959
/>
6060
);
6161

@@ -102,6 +102,7 @@ describe('Dashboard component', () => {
102102
dataPrepperIndicesExist={false}
103103
jaegerIndicesExist={true}
104104
modes={modes}
105+
dataSourceMDSId={[{ id: '', label: '' }]}
105106
/>
106107
);
107108

@@ -147,6 +148,7 @@ describe('Dashboard component', () => {
147148
mode="data_prepper"
148149
dataPrepperIndicesExist={true}
149150
modes={modes}
151+
dataSourceMDSId={[{ id: '', label: '' }]}
150152
/>
151153
);
152154

public/components/trace_analytics/components/dashboard/dashboard.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import { EuiBreadcrumb, EuiTitle } from '@elastic/eui';
77
import { Toast } from '@elastic/eui/src/components/toast/global_toast_list';
88
import React from 'react';
9-
import { TraceAnalyticsComponentDeps, TraceAnalyticsMode } from '../../home';
9+
import { DataSourceOption } from '../../../../../../../src/plugins/data_source_management/public/components/data_source_menu/types';
10+
import { TraceAnalyticsComponentDeps } from '../../home';
1011
import { DashboardContent } from './dashboard_content';
1112
import { DataSourcePicker } from './mode_picker';
1213

@@ -20,6 +21,7 @@ export interface DashboardProps extends TraceAnalyticsComponentDeps {
2021
text?: React.ReactChild | undefined,
2122
side?: string | undefined
2223
) => void;
24+
dataSourceMDSId: DataSourceOption[];
2325
}
2426

2527
export function Dashboard(props: DashboardProps) {

0 commit comments

Comments
 (0)