Skip to content
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

Traces jaeger #150

Merged
merged 67 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
97c12d6
get traces page working with queries
derek-ho Oct 27, 2022
5fcb2ca
get trace individual page partially working
derek-ho Oct 27, 2022
71ac297
get service page working initially
derek-ho Oct 27, 2022
8bf4747
get services page mainly working
derek-ho Oct 27, 2022
c361298
get most things working except for dashboards
derek-ho Oct 27, 2022
d79bc9c
something is broken
derek-ho Oct 27, 2022
29b8552
get time working on traces query
derek-ho Oct 27, 2022
7bf6374
last commit for today
derek-ho Oct 27, 2022
75fd5f5
done for today for real
derek-ho Oct 27, 2022
0d6a4be
fix date filter
derek-ho Oct 28, 2022
58d1088
trying to fix span table
derek-ho Oct 28, 2022
5abd7d3
save work
derek-ho Oct 31, 2022
5a99cb4
mostly fix trace page
derek-ho Nov 3, 2022
2cb7d9f
services working and traces working
derek-ho Nov 3, 2022
555319b
fix some more stuff
derek-ho Nov 3, 2022
b848af9
fix error shown on span detail chart
derek-ho Nov 3, 2022
283fd1d
fix
derek-ho Nov 30, 2022
041d38f
make general
derek-ho Nov 30, 2022
676f082
make everything more general and get traces and services top level pa…
derek-ho Dec 8, 2022
58a3a0e
get subpages working and get rid of servicemap when in jaeger mode
derek-ho Dec 8, 2022
a3d87ec
make most work on both
derek-ho Dec 8, 2022
fc6bbd7
pushing work
derek-ho Dec 8, 2022
6750c6f
fix service map for data prepper
derek-ho Dec 8, 2022
7237845
get more things to work
derek-ho Dec 8, 2022
1e7bad3
push work
derek-ho Dec 8, 2022
08a0bff
get almost everything working
derek-ho Dec 9, 2022
0742d80
everything on parity - new features and UX fixes only needed from her…
derek-ho Dec 9, 2022
81d3abf
fix service flyout pannel
derek-ho Dec 12, 2022
9ec8533
fix app analytics
derek-ho Dec 12, 2022
5dba245
default to data prepper for app analytics
derek-ho Dec 12, 2022
cabf24f
try to fix failing tests
derek-ho Dec 16, 2022
3342e38
try to fix some more syntax and test issues
derek-ho Dec 16, 2022
4728600
fix a few more things
derek-ho Dec 16, 2022
3ee2db8
replace with union
derek-ho Dec 16, 2022
128d0b5
fix a few more tests
derek-ho Dec 16, 2022
b94c935
all test pass!
derek-ho Dec 16, 2022
ccdae0f
try to get mode picker
derek-ho Dec 16, 2022
76ae15a
get it hooked up - still need to iron out a few things
derek-ho Dec 19, 2022
cf43a6a
get it working
derek-ho Dec 19, 2022
72b0a73
fix a few things
derek-ho Dec 20, 2022
46dc547
some more work to get plots in
derek-ho Dec 20, 2022
2189386
fix filters
derek-ho Dec 23, 2022
8aa676b
add code to get to demo point
derek-ho Dec 28, 2022
5e4fbe8
implement toggle on dashboard
derek-ho Dec 28, 2022
440ea14
remove package lock
derek-ho Dec 28, 2022
03e25a1
fix everything and get ui working well
derek-ho Dec 29, 2022
90bde2f
add lisence headers and remove imports and unecessary mode type
derek-ho Jan 4, 2023
324e000
run prettier
derek-ho Jan 4, 2023
2321b24
add it to all pages
derek-ho Jan 5, 2023
cce6504
some pr fixes
derek-ho Jan 5, 2023
390e77f
pushing work
derek-ho Jan 6, 2023
2e15987
fix UX navigation final
derek-ho Jan 6, 2023
f8711bb
move service map call into data prepper mode only
derek-ho Jan 8, 2023
ba9c898
fix tests
derek-ho Jan 9, 2023
5c6091c
fix gantt chart
derek-ho Jan 9, 2023
c5504ca
add tests
derek-ho Jan 9, 2023
d637471
add integration with event analytics
derek-ho Jan 9, 2023
1812f83
guards
derek-ho Jan 9, 2023
f98c516
pushing up changes to queries
derek-ho Jan 9, 2023
9624733
fix tests
derek-ho Jan 9, 2023
f3a871f
pr comments
derek-ho Jan 10, 2023
57cd03f
add timeout
derek-ho Jan 10, 2023
ab65109
revert version
derek-ho Jan 10, 2023
5f7dbe2
fix timeout
derek-ho Jan 10, 2023
4a06925
test fixes and message fix
derek-ho Jan 10, 2023
3dd96c5
fix toast into a single one
derek-ho Jan 10, 2023
45cdc1e
address pr comments
derek-ho Jan 10, 2023
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
2 changes: 1 addition & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "observabilityDashboards",
"version": "2.5.0.0",
"opensearchDashboardsVersion": "2.5.0",
"opensearchDashboardsVersion": "2.4.2",
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
"server": true,
"ui": true,
"requiredPlugins": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import { DataSourcePicker } from './mode_picker';
export interface DashboardProps extends TraceAnalyticsComponentDeps {
childBreadcrumbs: EuiBreadcrumb[];
page: 'dashboard' | 'app';
setToast?: (
title: string,
color?: string,
text?: React.ReactChild | undefined,
side?: string | undefined
) => void;
}

export function Dashboard(props: DashboardProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function DashboardContent(props: DashboardProps) {
mode,
dataPrepperIndicesExist,
jaegerIndicesExist,
setToast,
} = props;
const [tableItems, setTableItems] = useState([]);
const [jaegerTableItems, setJaegerTableItems] = useState([]);
Expand Down Expand Up @@ -83,14 +84,21 @@ export function DashboardContent(props: DashboardProps) {
useEffect(() => {
let newFilteredService = '';
for (const filter of filters) {
if (filter.field === 'serviceName') {
newFilteredService = filter.value;
break;
if (mode === 'data_prepper') {
if (filter.field === 'serviceName') {
newFilteredService = filter.value;
break;
}
} else if (mode === 'jaeger') {
if (filter.field === 'process.serviceName') {
newFilteredService = filter.value;
break;
}
}
}
setFilteredService(newFilteredService);
if (!redirect && ((mode === 'data_prepper' && dataPrepperIndicesExist) || (mode === 'jaeger' && jaegerIndicesExist))) refresh(newFilteredService);
}, [filters, startTime, endTime, appConfigs]);
}, [filters, startTime, endTime, redirect, mode, dataPrepperIndicesExist, jaegerIndicesExist]);
derek-ho marked this conversation as resolved.
Show resolved Hide resolved

const refresh = async (currService?: string) => {
setLoading(true);
Expand Down Expand Up @@ -135,8 +143,9 @@ export function DashboardContent(props: DashboardProps) {
tableItems,
setJaegerTableItems,
mode,
setToast!,
setPercentileMap
).then(() => setLoading(false));
).finally(() => setLoading(false))
handleJaegerErrorDashboardRequest(
http,
DSL,
Expand All @@ -146,7 +155,7 @@ export function DashboardContent(props: DashboardProps) {
setJaegerErrorTableItems,
mode,
setPercentileMap
).then(() => setLoading(false));
).finally(() => setLoading(false));
} else if (mode === 'data_prepper') {
handleDashboardRequest(
http,
Expand Down
20 changes: 18 additions & 2 deletions public/components/trace_analytics/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React, { useEffect, useState } from 'react';
import { EuiGlobalToastList } from '@elastic/eui';
import { Toast } from '@elastic/eui/src/components/toast/global_toast_list';
import React, { ReactChild, useEffect, useState } from 'react';
import { Route, RouteComponentProps } from 'react-router-dom';
import {
ChromeBreadcrumb,
Expand Down Expand Up @@ -71,12 +73,19 @@ export const Home = (props: HomeProps) => {
setEndTime(newEndTime);
sessionStorage.setItem('TraceAnalyticsEndTime', newEndTime);
};
const [toasts, setToasts] = useState<Toast[]>([]);

const setToast = (title: string, color = 'success', text?: ReactChild, side?: string) => {
if (!text) text = '';
setToasts([...toasts, { id: new Date().toISOString(), title, text, color } as Toast]);
};

useEffect(() => {
handleDataPrepperIndicesExistRequest(props.http, setDataPrepperIndicesExist)
handleJaegerIndicesExistRequest(props.http, setJaegerIndicesExist);
}, []);


const modes = [
{ id: 'jaeger', title: 'Jaeger' },
{ id: 'data_prepper', title: 'Data Prepper' },
Expand Down Expand Up @@ -153,12 +162,19 @@ export const Home = (props: HomeProps) => {

return (
<>
<EuiGlobalToastList
toasts={toasts}
dismissToast={(removedToast) => {
setToasts(toasts.filter((toast) => toast.id !== removedToast.id));
}}
toastLifeTimeMs={6000}
/>
<Route
exact
path={['/trace_analytics', '/trace_analytics/home']}
render={(routerProps) => (
<ObservabilitySideBar>
<Dashboard page="dashboard" childBreadcrumbs={dashboardBreadcrumbs} {...commonProps} />
<Dashboard page="dashboard" childBreadcrumbs={dashboardBreadcrumbs} {...commonProps} setToast={setToast} />
</ObservabilitySideBar>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ export const handleJaegerDashboardRequest = async (
items,
setItems,
mode,
setToast,
setPercentileMap?
) => {
const latencyTrends = await handleDslRequest(http, latencyTrendDSL, getJaegerLatencyTrendQuery(), mode)
const latencyTrends = await handleDslRequest(http, latencyTrendDSL, getJaegerLatencyTrendQuery(), mode, true)
.then((response) => {
const map: any = {};
response.aggregations.trace_group_name.buckets.map((bucket) => {
Expand Down Expand Up @@ -189,7 +190,12 @@ export const handleJaegerDashboardRequest = async (
});
return map;
})
.catch((error) => console.error(error));
.catch((error) => {
console.log("error here")
console.error(error)

setToast('hello')
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
});

await handleDslRequest(http, DSL, getJaegerDashboardQuery(), mode)
.then((response) => {
Expand Down
20 changes: 19 additions & 1 deletion public/components/trace_analytics/requests/request_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '../../../../common/constants/trace_analytics';
import { TraceAnalyticsMode } from '../home';

export function handleDslRequest(http: CoreStart['http'], DSL: any, bodyQuery: any, mode: TraceAnalyticsMode) {
export function handleDslRequest(http: CoreStart['http'], DSL: any, bodyQuery: any, mode: TraceAnalyticsMode, timeout: boolean = false) {
if (DSL?.query) {
bodyQuery.query.bool.must.push(...DSL.query.bool.must);
bodyQuery.query.bool.filter.push(...DSL.query.bool.filter);
Expand All @@ -27,6 +27,24 @@ export function handleDslRequest(http: CoreStart['http'], DSL: any, bodyQuery: a
if (!bodyQuery.index) {
body = {...bodyQuery, index: ((mode === 'jaeger' ? JAEGER_INDEX_NAME : DATA_PREPPER_INDEX_NAME)) }
}
if (mode === 'jaeger' && timeout) {
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), 20000);
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
return http
.post(TRACE_ANALYTICS_DSL_ROUTE, {
body: JSON.stringify(body),
signal: controller.signal
}).then((res) => {
clearTimeout(id);
return res;
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
})
.catch((error) => {
console.log(error)
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
clearTimeout(id)
})
.finally(() => clearTimeout(id));
}

return http
.post(TRACE_ANALYTICS_DSL_ROUTE, {
body: JSON.stringify(body),
Expand Down