Skip to content

Commit

Permalink
MDS Support for trace analytics (opensearch-project#1752)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
sumukhswamy authored May 1, 2024
1 parent cb845f2 commit da7d54e
Show file tree
Hide file tree
Showing 37 changed files with 825 additions and 275 deletions.
2 changes: 1 addition & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"urlForwarding",
"visualizations"
],
"optionalPlugins": ["managementOverview", "assistantDashboards", "securityDashboards"],
"optionalPlugins": ["managementOverview", "assistantDashboards", "securityDashboards", "dataSource", "dataSourceManagement"],
"configPath": ["observability"]
}
19 changes: 16 additions & 3 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ import { I18nProvider } from '@osd/i18n/react';
import { QueryManager } from 'common/query_manager';
import React from 'react';
import { Provider } from 'react-redux';
import { CoreStart } from '../../../../src/core/public';
import { CoreStart, MountPoint } from '../../../../src/core/public';
import { DataSourceManagementPluginSetup } from '../../../../src/plugins/data_source_management/public';
import { observabilityID, observabilityTitle } from '../../common/constants/shared';
import { store } from '../framework/redux/store';
import { AppPluginStartDependencies } from '../types';
import { Home as ApplicationAnalyticsHome } from './application_analytics/home';
import { Home as IntegrationsHome } from './integrations/home';
import { MetricsListener } from './common/metrics_listener';
import { Home as CustomPanelsHome } from './custom_panels/home';
import { Home as DataConnectionsHome } from './datasources/home';
import { EventAnalytics } from './event_analytics';
import { Home as IntegrationsHome } from './integrations/home';
import { Home as MetricsHome } from './metrics/index';
import { Main as NotebooksHome } from './notebooks/components/main';
import { Home as TraceAnalyticsHome } from './trace_analytics/home';
import { Home as DataConnectionsHome } from './datasources/home';

interface ObservabilityAppDeps {
CoreStartProp: CoreStart;
Expand All @@ -30,6 +31,10 @@ interface ObservabilityAppDeps {
timestampUtils: any;
queryManager: QueryManager;
startPage: string;
dataSourceEnabled: boolean;
dataSourceManagement: DataSourceManagementPluginSetup;
setActionMenu: (menuMount: MountPoint | undefined) => void;
savedObjectsMDSClient: CoreStart['savedObjects'];
}

// for cypress to test redux store
Expand Down Expand Up @@ -58,6 +63,10 @@ export const App = ({
queryManager,
startPage,
dataSourcePluggables,
dataSourceManagement,
setActionMenu,
dataSourceEnabled,
savedObjectsMDSClient,
}: ObservabilityAppDeps) => {
const { chrome, http, notifications, savedObjects: coreSavedObjects } = CoreStartProp;
const parentBreadcrumb = {
Expand Down Expand Up @@ -89,6 +98,10 @@ export const App = ({
parentBreadcrumbs={[parentBreadcrumb]}
setBreadcrumbs={chrome.setBreadcrumbs}
dataSourcePluggables={dataSourcePluggables}
dataSourceManagement={dataSourceManagement}
dataSourceEnabled={dataSourceEnabled}
setActionMenu={setActionMenu}
savedObjectsMDSClient={savedObjectsMDSClient}
/>
</MetricsListener>
</I18nProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ import {
EuiText,
} from '@elastic/eui';
import DSLService from 'public/services/requests/dsl';
import React, { useState } from 'react';
import { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { OptionType } from '../../../../../common/types/application_analytics';
import { FilterType } from '../../../trace_analytics/components/common/filters/filters';
import { ServiceObject } from '../../../trace_analytics/components/common/plots/service_map';
import { ServiceMap } from '../../../trace_analytics/components/services';
import { handleServiceMapRequest } from '../../../trace_analytics/requests/services_request_handler';
import { AppAnalyticsComponentDeps } from '../../home';
import { OptionType } from '../../../../../common/types/application_analytics';
import { getClearModal } from '../../helpers/modal_containers';
import { AppAnalyticsComponentDeps } from '../../home';

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

useEffect(() => {
handleServiceMapRequest(http, dslService, mode, setServiceMap);
handleServiceMapRequest(http, dslService, mode, '', setServiceMap);
}, []);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
/* eslint-disable react-hooks/exhaustive-deps */

import _ from 'lodash';
import {
EuiFlyout,
EuiFlyoutBody,
Expand All @@ -14,19 +13,20 @@ import {
EuiText,
EuiTitle,
} from '@elastic/eui';
import _ from 'lodash';
import React, { useEffect, useMemo, useState } from 'react';
import {
handleServiceMapRequest,
handleServiceViewRequest,
} from '../../../../../public/components/trace_analytics/requests/services_request_handler';
import {
filtersToDsl,
processTimeStamp,
} from '../../../../../public/components/trace_analytics/components/common/helper_functions';
import { ServiceMap } from '../../../../../public/components/trace_analytics/components/services';
import { ServiceObject } from '../../../../../public/components/trace_analytics/components/common/plots/service_map';
import { ServiceMap } from '../../../../../public/components/trace_analytics/components/services';
import { SpanDetailTable } from '../../../../../public/components/trace_analytics/components/traces/span_detail_table';
import { TraceAnalyticsComponentDeps } from '../../../../../public/components/trace_analytics/home';
import {
handleServiceMapRequest,
handleServiceViewRequest,
} from '../../../../../public/components/trace_analytics/requests/services_request_handler';
import { getListItem } from '../../helpers/utils';

interface ServiceFlyoutProps extends TraceAnalyticsComponentDeps {
Expand Down Expand Up @@ -131,7 +131,7 @@ export function ServiceDetailFlyout(props: ServiceFlyoutProps) {
appConfigs
);
handleServiceViewRequest(serviceName, http, serviceDSL, setFields, mode);
handleServiceMapRequest(http, serviceDSL, mode, setServiceMap, serviceName);
handleServiceMapRequest(http, serviceDSL, mode, '', setServiceMap, serviceName);
const spanDSL = filtersToDsl(mode, filters, query, startTime, endTime, 'app', appConfigs);
spanDSL.query.bool.must.push({
term: {
Expand Down
15 changes: 12 additions & 3 deletions public/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { QueryManager } from 'common/query_manager';
import React from 'react';
import ReactDOM from 'react-dom';
import { QueryManager } from 'common/query_manager';
import { AppMountParameters, CoreStart } from '../../../../src/core/public';
import { AppPluginStartDependencies, SetupDependencies } from '../types';
import { DataSourceManagementPluginSetup } from '../../../../src/plugins/data_source_management/public';
import { AppPluginStartDependencies } from '../types';
import { App } from './app';

export const Observability = (
Expand All @@ -20,8 +21,12 @@ export const Observability = (
timestampUtils: any,
queryManager: QueryManager,
startPage: string,
dataSourcePluggables
dataSourcePluggables,
dataSourceManagement: DataSourceManagementPluginSetup,
savedObjectsMDSClient: CoreStart['savedObjects']
) => {
const { setHeaderActionMenu } = AppMountParametersProp;
const { dataSource } = DepsStart;
ReactDOM.render(
<App
CoreStartProp={CoreStartProp}
Expand All @@ -33,6 +38,10 @@ export const Observability = (
queryManager={queryManager}
startPage={startPage}
dataSourcePluggables={dataSourcePluggables}
dataSourceManagement={dataSourceManagement}
setActionMenu={setHeaderActionMenu}
dataSourceEnabled={!!dataSource}
savedObjectsMDSClient={savedObjectsMDSClient}
/>,
AppMountParametersProp.element
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ exports[`Dashboard component renders dashboard 1`] = `
}
}
dataPrepperIndicesExist={true}
dataSourceMDSId={
Array [
Object {
"id": "",
"label": "",
},
]
}
endTime="now"
filters={Array []}
http={[MockFunction]}
Expand Down Expand Up @@ -479,6 +487,14 @@ exports[`Dashboard component renders dashboard 1`] = `
}
}
dataPrepperIndicesExist={true}
dataSourceMDSId={
Array [
Object {
"id": "",
"label": "",
},
]
}
endTime="now"
filters={Array []}
http={[MockFunction]}
Expand Down Expand Up @@ -1261,6 +1277,14 @@ exports[`Dashboard component renders empty dashboard 1`] = `
}
}
dataPrepperIndicesExist={true}
dataSourceMDSId={
Array [
Object {
"id": "",
"label": "",
},
]
}
endTime="now"
filters={Array []}
http={[MockFunction]}
Expand Down Expand Up @@ -1590,6 +1614,14 @@ exports[`Dashboard component renders empty dashboard 1`] = `
}
}
dataPrepperIndicesExist={true}
dataSourceMDSId={
Array [
Object {
"id": "",
"label": "",
},
]
}
endTime="now"
filters={Array []}
http={[MockFunction]}
Expand Down Expand Up @@ -2372,6 +2404,14 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = `
}
}
dataPrepperIndicesExist={false}
dataSourceMDSId={
Array [
Object {
"id": "",
"label": "",
},
]
}
endTime="now"
filters={Array []}
http={[MockFunction]}
Expand Down Expand Up @@ -2703,6 +2743,14 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = `
}
}
dataPrepperIndicesExist={false}
dataSourceMDSId={
Array [
Object {
"id": "",
"label": "",
},
]
}
endTime="now"
filters={Array []}
http={[MockFunction]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { Dashboard } from '..';
import { CoreStart } from '../../../../../../../../src/core/public';
import { coreStartMock } from '../../../../../../test/__mocks__/coreMocks';

describe('Dashboard component', () => {
Expand Down Expand Up @@ -56,6 +55,7 @@ describe('Dashboard component', () => {
mode="data_prepper"
dataPrepperIndicesExist={true}
modes={modes}
dataSourceMDSId={[{ id: '', label: '' }]}
/>
);

Expand Down Expand Up @@ -102,6 +102,7 @@ describe('Dashboard component', () => {
dataPrepperIndicesExist={false}
jaegerIndicesExist={true}
modes={modes}
dataSourceMDSId={[{ id: '', label: '' }]}
/>
);

Expand Down Expand Up @@ -147,6 +148,7 @@ describe('Dashboard component', () => {
mode="data_prepper"
dataPrepperIndicesExist={true}
modes={modes}
dataSourceMDSId={[{ id: '', label: '' }]}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import { EuiBreadcrumb, EuiTitle } from '@elastic/eui';
import { Toast } from '@elastic/eui/src/components/toast/global_toast_list';
import React from 'react';
import { TraceAnalyticsComponentDeps, TraceAnalyticsMode } from '../../home';
import { DataSourceOption } from '../../../../../../../src/plugins/data_source_management/public/components/data_source_menu/types';
import { TraceAnalyticsComponentDeps } from '../../home';
import { DashboardContent } from './dashboard_content';
import { DataSourcePicker } from './mode_picker';

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

export function Dashboard(props: DashboardProps) {
Expand Down
Loading

0 comments on commit da7d54e

Please sign in to comment.