Skip to content

version-dec for Obeservability #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: move-notebooks
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"visualizations"
],
"optionalPlugins": ["managementOverview", "assistantDashboards", "securityDashboards", "dataSource", "dataSourceManagement"],
"configPath": ["observability"]
"configPath": ["observability"],
"supportedOSDataSourceVersions": ">=2.9.0"
}
11 changes: 10 additions & 1 deletion public/components/metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,34 @@
import React, { useEffect, useMemo, useState } from 'react';
import { useDispatch } from 'react-redux';
import { HashRouter, Route, RouteComponentProps, StaticContext } from 'react-router-dom';
import semver from 'semver';
import {
ChromeBreadcrumb,
MountPoint,
NotificationsStart,
SavedObject,
SavedObjectsStart,
} from '../../../../../src/core/public';
import { DataSourceAttributes } from '../../../../../src/plugins/data_source/common/data_sources';
import {
DataSourceManagementPluginSetup,
DataSourceSelectableConfig,
} from '../../../../../src/plugins/data_source_management/public';
import { DataSourceOption } from '../../../../../src/plugins/data_source_management/public/components/data_source_menu/types';
import { OptionType } from '../../../common/types/metrics';
import { setNavBreadCrumbs } from '../../../common/utils/set_nav_bread_crumbs';
import * as pluginManifest from '../../../opensearch_dashboards.json';
import PPLService from '../../services/requests/ppl';
import SavedObjects from '../../services/saved_objects/event_analytics/saved_objects';
import './index.scss';
import { setSelectedDataSourceMDSId } from './redux/slices/metrics_slice';
import { Sidebar } from './sidebar/sidebar';
import { TopMenu } from './top_menu/top_menu';
import { MetricsGrid } from './view/metrics_grid';
import { setNavBreadCrumbs } from '../../../common/utils/set_nav_bread_crumbs';

interface MetricsProps {
parentBreadcrumb: ChromeBreadcrumb;
renderProps: RouteComponentProps<any, StaticContext, any>;

Check warning on line 38 in public/components/metrics/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

Check warning on line 38 in public/components/metrics/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
pplService: PPLService;
savedObjects: SavedObjects;
setBreadcrumbs: (newBreadcrumbs: ChromeBreadcrumb[]) => void;
Expand Down Expand Up @@ -82,6 +86,10 @@
dispatch(setSelectedDataSourceMDSId(id));
}, 300);
};
const dataSourceFilterFn = (dataSource: SavedObject<DataSourceAttributes>) => {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
return semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions);
};
const DataSourceMenu = dataSourceManagement?.ui?.getDataSourceMenu<DataSourceSelectableConfig>();
const dataSourceMenuComponent = useMemo(() => {
return (
Expand All @@ -94,10 +102,11 @@
fullWidth: true,
// activeOption: dataSourceMDSId,
onSelectedDataSources: onSelectedDataSource,
dataSourceFilter: dataSourceFilterFn,
}}
/>
);
}, [setActionMenu, savedObjectsMDSClient.client, notifications]);

Check warning on line 109 in public/components/metrics/index.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useMemo has a missing dependency: 'onSelectedDataSource'. Either include it or remove the dependency array

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@
import filter from 'lodash/filter';
import moment from 'moment';
import React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
import { CoreStart, MountPoint, SavedObjectsStart } from '../../../../../../../src/core/public';
import semver from 'semver';
import {
CoreStart,
MountPoint,
SavedObject,
SavedObjectsStart,
} from '../../../../../../../src/core/public';
import {
DashboardContainerInput,
DashboardStart,
} from '../../../../../../../src/plugins/dashboard/public';
import { DataSourceAttributes } from '../../../../../../../src/plugins/data_source/common/data_sources';
import { DataSourceManagementPluginSetup } from '../../../../../../../src/plugins/data_source_management/public';
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
import { NOTEBOOKS_API_PREFIX } from '../../../../../common/constants/notebooks';
Expand All @@ -39,6 +46,7 @@
} from '../../../../../common/constants/shared';
import { ParaType } from '../../../../../common/types/notebooks';
import { uiSettingsService } from '../../../../../common/utils';
import * as pluginManifest from '../../../../../opensearch_dashboards.json';
import PPLService from '../../../../services/requests/ppl';
import { SavedObjectsActions } from '../../../../services/saved_objects/saved_object_client/saved_objects_actions';
import { ObservabilitySavedVisualization } from '../../../../services/saved_objects/saved_object_client/types';
Expand Down Expand Up @@ -206,7 +214,7 @@
if (para.visSavedObjId !== '') setVisInput(JSON.parse(para.vizObjectInput));
fetchVisualizations();
}
}, [dataSourceMDSId]);

Check warning on line 217 in public/components/notebooks/components/paragraph_components/paragraphs.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useEffect has missing dependencies: 'fetchVisualizations', 'para.isVizualisation', 'para.visSavedObjId', and 'para.vizObjectInput'. Either include them or remove the dependency array

const createDashboardVizObject = (objectId: string) => {
const vizUniqueId = htmlIdGenerator()();
Expand Down Expand Up @@ -549,6 +557,11 @@
setDataSourceMDSId(dataConnectionId);
handleSelectedDataSourceChange(dataConnectionId, dataConnectionLabel);
};
const dataSourceFilterFn = (dataSource: SavedObject<DataSourceAttributes>) => {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
return semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions);
};

if (dataSourceEnabled) {
DataSourceSelector = dataSourceManagement.ui.DataSourceSelector;
}
Expand All @@ -564,11 +577,13 @@
disabled={false}
fullWidth={false}
removePrepend={true}
dataSourceFilter={dataSourceFilterFn}
defaultOption={
paradataSourceMDSId !== undefined && [
{ id: paradataSourceMDSId, label: dataSourceMDSLabel },
]
}
filter
/>
)}
<EuiSpacer size="s" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
} from '@elastic/eui';
import round from 'lodash/round';
import React, { useEffect, useMemo, useState } from 'react';
import semver from 'semver';
import { SavedObject } from '../../../../../../../src/core/public';
import { DataSourceAttributes } from '../../../../../../../src/plugins/data_source/common/data_sources';
import {
DataSourceManagementPluginSetup,
DataSourceViewConfig,
Expand All @@ -37,6 +40,8 @@
DEFAULT_DATA_SOURCE_TYPE,
} from '../../../../../common/constants/data_sources';
import { observabilityLogsID } from '../../../../../common/constants/shared';
import { setNavBreadCrumbs } from '../../../../../common/utils/set_nav_bread_crumbs';
import * as pluginManifest from '../../../../../opensearch_dashboards.json';
import { coreRefs } from '../../../../framework/core_refs';
import { TraceAnalyticsComponentDeps } from '../../home';
import {
Expand All @@ -50,7 +55,6 @@
import { SpanDetailFlyout } from '../traces/span_detail_flyout';
import { SpanDetailTable } from '../traces/span_detail_table';
import { ServiceMetrics } from './service_metrics';
import { setNavBreadCrumbs } from '../../../../../common/utils/set_nav_bread_crumbs';

interface ServiceViewProps extends TraceAnalyticsComponentDeps {
serviceName: string;
Expand All @@ -64,7 +68,7 @@

export function ServiceView(props: ServiceViewProps) {
const { mode, page, setCurrentSelectedService } = props;
const [fields, setFields] = useState<any>({});

Check warning on line 71 in public/components/trace_analytics/components/services/service_view.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const [serviceMap, setServiceMap] = useState<ServiceObject>({});
const [serviceMapIdSelected, setServiceMapIdSelected] = useState<
'latency' | 'error_rate' | 'throughput'
Expand Down Expand Up @@ -121,6 +125,10 @@
);
}, [props.serviceName]);

const dataSourceFilterFn = (dataSource: SavedObject<DataSourceAttributes>) => {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
return semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions);
};
const DataSourceMenu = props.dataSourceManagement?.ui?.getDataSourceMenu<DataSourceViewConfig>();

const redirectToServicePage = (service: string) => {
Expand Down Expand Up @@ -260,6 +268,7 @@
componentConfig={{
activeOption: props.dataSourceMDSId,
fullWidth: true,
dataSourceFilter: dataSourceFilterFn,
}}
/>
)}
Expand Down Expand Up @@ -382,12 +391,12 @@

const [currentSpan, setCurrentSpan] = useState('');
const storedFilters = sessionStorage.getItem('TraceAnalyticsSpanFilters');
const [spanFilters, setSpanFilters] = useState<Array<{ field: string; value: any }>>(

Check warning on line 394 in public/components/trace_analytics/components/services/service_view.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
storedFilters ? JSON.parse(storedFilters) : []
);
const [DSL, setDSL] = useState<any>({});

Check warning on line 397 in public/components/trace_analytics/components/services/service_view.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

const setSpanFiltersWithStorage = (newFilters: Array<{ field: string; value: any }>) => {

Check warning on line 399 in public/components/trace_analytics/components/services/service_view.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
setSpanFilters(newFilters);
sessionStorage.setItem('TraceAnalyticsSpanFilters', JSON.stringify(newFilters));
};
Expand Down Expand Up @@ -425,7 +434,7 @@
setDSL(spanDSL);
}, [props.startTime, props.endTime, props.serviceName, spanFilters]);

const addSpanFilter = (field: string, value: any) => {

Check warning on line 437 in public/components/trace_analytics/components/services/service_view.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const newFilters = [...spanFilters];
const index = newFilters.findIndex(({ field: filterField }) => field === filterField);
if (index === -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,27 @@ exports[`Traces component renders empty traces page 1`] = `
},
"navGroup": Object {
"getCurrentNavGroup$": [MockFunction],
"getNavGroupEnabled": [MockFunction],
"getNavGroupEnabled": [MockFunction] {
"calls": Array [
Array [],
Array [],
Array [],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
],
},
"getNavGroupsMap$": [MockFunction],
"setCurrentNavGroup": [MockFunction],
},
Expand Down Expand Up @@ -440,7 +460,27 @@ exports[`Traces component renders empty traces page 1`] = `
},
"navGroup": Object {
"getCurrentNavGroup$": [MockFunction],
"getNavGroupEnabled": [MockFunction],
"getNavGroupEnabled": [MockFunction] {
"calls": Array [
Array [],
Array [],
Array [],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
],
},
"getNavGroupsMap$": [MockFunction],
"setCurrentNavGroup": [MockFunction],
},
Expand Down Expand Up @@ -1739,7 +1779,27 @@ exports[`Traces component renders jaeger traces page 1`] = `
},
"navGroup": Object {
"getCurrentNavGroup$": [MockFunction],
"getNavGroupEnabled": [MockFunction],
"getNavGroupEnabled": [MockFunction] {
"calls": Array [
Array [],
Array [],
Array [],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
],
},
"getNavGroupsMap$": [MockFunction],
"setCurrentNavGroup": [MockFunction],
},
Expand Down Expand Up @@ -2074,7 +2134,27 @@ exports[`Traces component renders jaeger traces page 1`] = `
},
"navGroup": Object {
"getCurrentNavGroup$": [MockFunction],
"getNavGroupEnabled": [MockFunction],
"getNavGroupEnabled": [MockFunction] {
"calls": Array [
Array [],
Array [],
Array [],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
],
},
"getNavGroupsMap$": [MockFunction],
"setCurrentNavGroup": [MockFunction],
},
Expand Down Expand Up @@ -3378,7 +3458,27 @@ exports[`Traces component renders traces page 1`] = `
},
"navGroup": Object {
"getCurrentNavGroup$": [MockFunction],
"getNavGroupEnabled": [MockFunction],
"getNavGroupEnabled": [MockFunction] {
"calls": Array [
Array [],
Array [],
Array [],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
],
},
"getNavGroupsMap$": [MockFunction],
"setCurrentNavGroup": [MockFunction],
},
Expand Down Expand Up @@ -3712,7 +3812,27 @@ exports[`Traces component renders traces page 1`] = `
},
"navGroup": Object {
"getCurrentNavGroup$": [MockFunction],
"getNavGroupEnabled": [MockFunction],
"getNavGroupEnabled": [MockFunction] {
"calls": Array [
Array [],
Array [],
Array [],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
Object {
"type": "return",
"value": undefined,
},
],
},
"getNavGroupsMap$": [MockFunction],
"setCurrentNavGroup": [MockFunction],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@
} from '@elastic/eui';
import round from 'lodash/round';
import React, { useEffect, useState } from 'react';
import { MountPoint } from '../../../../../../../src/core/public';
import semver from 'semver';
import { MountPoint, SavedObject } from '../../../../../../../src/core/public';
import { DataSourceAttributes } from '../../../../../../../src/plugins/data_source/common/data_sources/types';
import {
DataSourceManagementPluginSetup,
DataSourceViewConfig,
} from '../../../../../../../src/plugins/data_source_management/public';
import { DataSourceOption } from '../../../../../../../src/plugins/data_source_management/public/components/data_source_menu/types';
import { setNavBreadCrumbs } from '../../../../../common/utils/set_nav_bread_crumbs';
import * as pluginManifest from '../../../../../opensearch_dashboards.json';
import { TraceAnalyticsCoreDeps, TraceAnalyticsMode } from '../../home';
import { handleServiceMapRequest } from '../../requests/services_request_handler';
import {
Expand All @@ -37,7 +41,6 @@
import { ServiceMap, ServiceObject } from '../common/plots/service_map';
import { ServiceBreakdownPanel } from './service_breakdown_panel';
import { SpanDetailPanel } from './span_detail_panel';
import { setNavBreadCrumbs } from '../../../../../common/utils/set_nav_bread_crumbs';

interface TraceViewProps extends TraceAnalyticsCoreDeps {
traceId: string;
Expand All @@ -62,8 +65,12 @@
);
};
const DataSourceMenu = props.dataSourceManagement?.ui?.getDataSourceMenu<DataSourceViewConfig>();
const dataSourceFilterFn = (dataSource: SavedObject<DataSourceAttributes>) => {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
return semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions);
};

const renderOverview = (fields: any) => {

Check warning on line 73 in public/components/trace_analytics/components/traces/trace_view.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
return (
<EuiPanel>
<PanelTitle title="Overview" />
Expand Down Expand Up @@ -260,6 +267,7 @@
componentConfig={{
activeOption: props.dataSourceMDSId,
fullWidth: true,
dataSourceFilter: dataSourceFilterFn,
}}
/>
)}
Expand Down
Loading
Loading