diff --git a/public/components/app.tsx b/public/components/app.tsx index e496105d42..1b7150a8cf 100644 --- a/public/components/app.tsx +++ b/public/components/app.tsx @@ -34,7 +34,7 @@ interface ObservabilityAppDeps { dataSourceEnabled: boolean; dataSourceManagement: DataSourceManagementPluginSetup; setActionMenu: (menuMount: MountPoint | undefined) => void; - savedObjectsMDSClient: CoreStart['savedObjects'] + savedObjectsMDSClient: CoreStart['savedObjects']; } // for cypress to test redux store @@ -66,7 +66,7 @@ export const App = ({ dataSourceManagement, setActionMenu, dataSourceEnabled, - savedObjectsMDSClient + savedObjectsMDSClient, }: ObservabilityAppDeps) => { const { chrome, http, notifications, savedObjects: coreSavedObjects } = CoreStartProp; const parentBreadcrumb = { diff --git a/public/components/index.tsx b/public/components/index.tsx index 5d9b295424..b1ebf1211b 100644 --- a/public/components/index.tsx +++ b/public/components/index.tsx @@ -11,7 +11,6 @@ import { DataSourceManagementPluginSetup } from '../../../../src/plugins/data_so import { AppPluginStartDependencies } from '../types'; import { App } from './app'; - export const Observability = ( CoreStartProp: CoreStart, DepsStart: AppPluginStartDependencies, @@ -26,7 +25,7 @@ export const Observability = ( dataSourceManagement: DataSourceManagementPluginSetup, savedObjectsMDSClient: CoreStart['savedObjects'] ) => { - const { setHeaderActionMenu } = AppMountParametersProp + const { setHeaderActionMenu } = AppMountParametersProp; const { dataSource } = DepsStart; ReactDOM.render( void; - dataSourceMDSId: DataSourceOption[] + dataSourceMDSId: DataSourceOption[]; } export function Dashboard(props: DashboardProps) { diff --git a/public/components/trace_analytics/components/dashboard/dashboard_content.tsx b/public/components/trace_analytics/components/dashboard/dashboard_content.tsx index a9373e8c38..521ad0ccc7 100644 --- a/public/components/trace_analytics/components/dashboard/dashboard_content.tsx +++ b/public/components/trace_analytics/components/dashboard/dashboard_content.tsx @@ -192,6 +192,7 @@ export function DashboardContent(props: DashboardProps) { setPercentileMap ).finally(() => setLoading(false)); } else if (mode === 'data_prepper') { + console.log(dataSourceMDSId, 'traces page'); handleDashboardRequest( http, DSL, diff --git a/public/components/trace_analytics/components/traces/span_detail_panel.tsx b/public/components/trace_analytics/components/traces/span_detail_panel.tsx index 6321b6487d..ba24c78bc7 100644 --- a/public/components/trace_analytics/components/traces/span_detail_panel.tsx +++ b/public/components/trace_analytics/components/traces/span_detail_panel.tsx @@ -27,7 +27,7 @@ export function SpanDetailPanel(props: { http: HttpSetup; traceId: string; colorMap: any; - mode: TraceAnalyticsMode + mode: TraceAnalyticsMode; dataSourceMDSId: string; page?: string; openSpanFlyout?: any; @@ -82,41 +82,52 @@ export function SpanDetailPanel(props: { if (_.isEmpty(props.colorMap)) return; const refreshDSL = spanFiltersToDSL(); setDSL(refreshDSL); - handleSpansGanttRequest(props.traceId, props.http, setData, props.colorMap, refreshDSL, mode, props.dataSourceMDSId); + handleSpansGanttRequest( + props.traceId, + props.http, + setData, + props.colorMap, + refreshDSL, + mode, + props.dataSourceMDSId + ); }, 150); const spanFiltersToDSL = () => { - const spanDSL: any = mode === 'jaeger' ? { - query: { - bool: { - must: [ - { - term: { - traceID: props.traceId, + const spanDSL: any = + mode === 'jaeger' + ? { + query: { + bool: { + must: [ + { + term: { + traceID: props.traceId, + }, + }, + ], + filter: [], + should: [], + must_not: [], }, }, - ], - filter: [], - should: [], - must_not: [], - }, - }, - } : { - query: { - bool: { - must: [ - { - term: { - traceId: props.traceId, + } + : { + query: { + bool: { + must: [ + { + term: { + traceId: props.traceId, + }, + }, + ], + filter: [], + should: [], + must_not: [], }, }, - ], - filter: [], - should: [], - must_not: [], - }, - }, - }; + }; spanFilters.map(({ field, value }) => { if (value != null) { spanDSL.query.bool.must.push({ @@ -165,10 +176,10 @@ export function SpanDetailPanel(props: { }; }; - const layout = useMemo( - () => getSpanDetailLayout(data.gantt, data.ganttMaxX), - [data.gantt, data.ganttMaxX] - ); + const layout = useMemo(() => getSpanDetailLayout(data.gantt, data.ganttMaxX), [ + data.gantt, + data.ganttMaxX, + ]); const [currentSpan, setCurrentSpan] = useState(''); @@ -240,7 +251,7 @@ export function SpanDetailPanel(props: { return ( <> - + diff --git a/public/components/trace_analytics/components/traces/span_detail_table.tsx b/public/components/trace_analytics/components/traces/span_detail_table.tsx index 7fe6b6d3f7..90a0e0e80f 100644 --- a/public/components/trace_analytics/components/traces/span_detail_table.tsx +++ b/public/components/trace_analytics/components/traces/span_detail_table.tsx @@ -51,7 +51,15 @@ export function SpanDetailTable(props: SpanDetailTableProps) { size: tableParams.size, sortingColumns: tableParams.sortingColumns.map(({ id, direction }) => ({ [id]: direction })), }; - handleSpansRequest(props.http, setItems, setTotal, spanSearchParams, props.DSL, mode, props.dataSourceMDSId); + handleSpansRequest( + props.http, + setItems, + setTotal, + spanSearchParams, + props.DSL, + mode, + props.dataSourceMDSId + ); }, [tableParams, props.DSL]); useEffect(() => { diff --git a/public/components/trace_analytics/components/traces/traces_content.tsx b/public/components/trace_analytics/components/traces/traces_content.tsx index 63f3face83..7478fb5299 100644 --- a/public/components/trace_analytics/components/traces/traces_content.tsx +++ b/public/components/trace_analytics/components/traces/traces_content.tsx @@ -34,7 +34,6 @@ export function TracesContent(props: TracesProps) { mode, dataPrepperIndicesExist, jaegerIndicesExist, - notifications, dataSourceManagement, dataSourceMDSId, } = props; diff --git a/public/components/trace_analytics/home.tsx b/public/components/trace_analytics/home.tsx index 9dd6a2c4c2..231c1e6f83 100644 --- a/public/components/trace_analytics/home.tsx +++ b/public/components/trace_analytics/home.tsx @@ -97,7 +97,7 @@ export const Home = (props: HomeProps) => { setToasts([...toasts, { id: new Date().toISOString(), title, text, color } as Toast]); }; - let [dataSourceMDSId, setDataSourceMDSId] = useState([{ id: '', label: '' }]); + const [dataSourceMDSId, setDataSourceMDSId] = useState([{ id: '', label: '' }]); useEffect(() => { handleDataPrepperIndicesExistRequest( diff --git a/public/components/trace_analytics/requests/request_handler.ts b/public/components/trace_analytics/requests/request_handler.ts index 17ef0d7c4c..5babe0a33a 100644 --- a/public/components/trace_analytics/requests/request_handler.ts +++ b/public/components/trace_analytics/requests/request_handler.ts @@ -19,7 +19,7 @@ export async function handleDslRequest( bodyQuery: any, mode: TraceAnalyticsMode, dataSourceMDSId?: string, - setShowTimeoutToast?: () => void, + setShowTimeoutToast?: () => void ) { if (DSL?.query) { bodyQuery.query.bool.must.push(...DSL.query.bool.must); @@ -33,11 +33,10 @@ export async function handleDslRequest( if (!bodyQuery.index) { body = { ...bodyQuery, index: mode === 'jaeger' ? JAEGER_INDEX_NAME : DATA_PREPPER_INDEX_NAME }; } - let query = { - dataSourceMDSId: dataSourceMDSId - } + const query = { + dataSourceMDSId: dataSourceMDSId, + }; if (setShowTimeoutToast) { - const id = setTimeout(() => setShowTimeoutToast(), 25000); // 25 seconds try { @@ -51,7 +50,6 @@ export async function handleDslRequest( clearTimeout(id); } } else { - try { return await http.post(TRACE_ANALYTICS_DSL_ROUTE, { body: JSON.stringify(body), @@ -66,14 +64,14 @@ export async function handleDslRequest( export async function handleJaegerIndicesExistRequest( http: CoreStart['http'], setJaegerIndicesExist, - dataSourceMDSId? : string + dataSourceMDSId?: string ) { - let query = { - dataSourceMDSId: dataSourceMDSId - } + const query = { + dataSourceMDSId: dataSourceMDSId, + }; http - .post(TRACE_ANALYTICS_JAEGER_INDICES_ROUTE,{ - query + .post(TRACE_ANALYTICS_JAEGER_INDICES_ROUTE, { + query, }) .then((exists) => setJaegerIndicesExist(exists)) .catch(() => setJaegerIndicesExist(false)); @@ -82,14 +80,14 @@ export async function handleJaegerIndicesExistRequest( export async function handleDataPrepperIndicesExistRequest( http: CoreStart['http'], setDataPrepperIndicesExist, - dataSourceMDSId? : string + dataSourceMDSId?: string ) { - let query = { - dataSourceMDSId: dataSourceMDSId - } + const query = { + dataSourceMDSId: dataSourceMDSId, + }; http - .post(TRACE_ANALYTICS_DATA_PREPPER_INDICES_ROUTE,{ - query + .post(TRACE_ANALYTICS_DATA_PREPPER_INDICES_ROUTE, { + query, }) .then((exists) => setDataPrepperIndicesExist(exists)) .catch(() => setDataPrepperIndicesExist(false)); diff --git a/public/framework/core_refs.ts b/public/framework/core_refs.ts index 38e115f2e6..b78240e01b 100644 --- a/public/framework/core_refs.ts +++ b/public/framework/core_refs.ts @@ -33,7 +33,7 @@ class CoreRefs { public dashboard?: DashboardStart; public dashboardProviders?: unknown; public overlays?: OverlayStart; - public dataSource?: DataSourcePluginStart + public dataSource?: DataSourcePluginStart; private constructor() { // ... } diff --git a/public/types.ts b/public/types.ts index 683e62b677..d65e31a7af 100644 --- a/public/types.ts +++ b/public/types.ts @@ -6,7 +6,10 @@ import { SavedObjectsClient } from '../../../src/core/server'; import { DashboardStart } from '../../../src/plugins/dashboard/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../src/plugins/data/public'; -import { DataSourcePluginSetup, DataSourcePluginStart } from '../../../src/plugins/data_source/public'; +import { + DataSourcePluginSetup, + DataSourcePluginStart, +} from '../../../src/plugins/data_source/public'; import { DataSourceManagementPluginSetup } from '../../../src/plugins/data_source_management/public'; import { EmbeddableSetup, EmbeddableStart } from '../../../src/plugins/embeddable/public'; import { ManagementOverViewPluginSetup } from '../../../src/plugins/management_overview/public'; @@ -39,7 +42,7 @@ export interface SetupDependencies { managementOverview?: ManagementOverViewPluginSetup; assistantDashboards?: AssistantSetup; dataSource: DataSourcePluginSetup; - dataSourceManagement: DataSourceManagementPluginSetup + dataSourceManagement: DataSourceManagementPluginSetup; } // eslint-disable-next-line @typescript-eslint/no-empty-interface diff --git a/server/routes/index.ts b/server/routes/index.ts index 832cbbe1bb..bc06a00851 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -25,7 +25,15 @@ import { registerPplRoute } from './ppl'; import { registerQueryAssistRoutes } from './query_assist/routes'; import { registerTraceAnalyticsDslRouter } from './trace_analytics_dsl_router'; -export function setupRoutes({ router, client, dataSourceEnabled }: { router: IRouter; client: ILegacyClusterClient, dataSourceEnabled: boolean }) { +export function setupRoutes({ + router, + client, + dataSourceEnabled, +}: { + router: IRouter; + client: ILegacyClusterClient; + dataSourceEnabled: boolean; +}) { PanelsRouter(router); VisualizationsRouter(router); registerPplRoute({ router, facet: new PPLFacet(client) });