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

[FEAT] Enable limited trace analytics feature on raw jaeger indices #1336

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
cdaace3
get traces page working with queries
derek-ho Oct 27, 2022
9a6dd99
get trace individual page partially working
derek-ho Oct 27, 2022
2d01f9e
get service page working initially
derek-ho Oct 27, 2022
b71bf9e
get services page mainly working
derek-ho Oct 27, 2022
74f1884
get most things working except for dashboards
derek-ho Oct 27, 2022
5a027e8
something is broken
derek-ho Oct 27, 2022
a62374e
get time working on traces query
derek-ho Oct 27, 2022
e89e17b
last commit for today
derek-ho Oct 27, 2022
03f33f9
done for today for real
derek-ho Oct 27, 2022
a2abf61
fix date filter
derek-ho Oct 28, 2022
b94d6d1
trying to fix span table
derek-ho Oct 28, 2022
97da4e6
save work
derek-ho Oct 31, 2022
a40e873
mostly fix trace page
derek-ho Nov 3, 2022
f75269e
services working and traces working
derek-ho Nov 3, 2022
551401e
fix some more stuff
derek-ho Nov 3, 2022
7e7e1fe
fix error shown on span detail chart
derek-ho Nov 3, 2022
2659e8b
fix
derek-ho Nov 30, 2022
2de9ca7
make general
derek-ho Nov 30, 2022
16da197
Merge branch '2.x' of github.com:opensearch-project/observability int…
derek-ho Dec 7, 2022
25a5bf1
make everything more general and get traces and services top level pa…
derek-ho Dec 8, 2022
3e2e580
get subpages working and get rid of servicemap when in jaeger mode
derek-ho Dec 8, 2022
a762cc9
make most work on both
derek-ho Dec 8, 2022
bc54a21
pushing work
derek-ho Dec 8, 2022
20d1f51
fix service map for data prepper
derek-ho Dec 8, 2022
c25f9e3
get more things to work
derek-ho Dec 8, 2022
e2eef1d
push work
derek-ho Dec 8, 2022
3470115
get almost everything working
derek-ho Dec 9, 2022
a0484d9
everything on parity - new features and UX fixes only needed from her…
derek-ho Dec 9, 2022
8cc7811
fix service flyout pannel
derek-ho Dec 12, 2022
be7e915
fix app analytics
derek-ho Dec 12, 2022
3c10379
default to data prepper for app analytics
derek-ho Dec 12, 2022
a5c1724
try to fix failing tests
derek-ho Dec 16, 2022
018080f
try to fix some more syntax and test issues
derek-ho Dec 16, 2022
58acf11
fix a few more things
derek-ho Dec 16, 2022
eaf2a51
replace with union
derek-ho Dec 16, 2022
33ebf81
fix a few more tests
derek-ho Dec 16, 2022
dd3039c
all test pass!
derek-ho Dec 16, 2022
7a406b8
try to get mode picker
derek-ho Dec 16, 2022
dbd8958
get it hooked up - still need to iron out a few things
derek-ho Dec 19, 2022
d048eda
get it working
derek-ho Dec 19, 2022
7070a37
fix a few things
derek-ho Dec 20, 2022
3b9cbc6
some more work to get plots in
derek-ho Dec 20, 2022
21098ad
fix filters
derek-ho Dec 23, 2022
e7cc6fa
add code to get to demo point
derek-ho Dec 28, 2022
3eae13f
implement toggle on dashboard
derek-ho Dec 28, 2022
0168e1f
remove package lock
derek-ho Dec 28, 2022
f8f6bee
fix everything and get ui working well
derek-ho Dec 29, 2022
fe362aa
Merge branch '2.x' of github.com:derek-ho/observability into enable-j…
derek-ho Jan 3, 2023
d7a18f9
add json files
derek-ho Jan 4, 2023
89db6ea
update file
derek-ho Jan 4, 2023
15ee222
fix mapping files
derek-ho Jan 4, 2023
8ef057e
fix file
derek-ho Jan 5, 2023
398f6f5
remote dynamic templates
derek-ho Jan 5, 2023
9909947
fix
derek-ho Jan 5, 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
5 changes: 4 additions & 1 deletion dashboards-observability/common/constants/trace_analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

export const JAEGER_INDEX_NAME = '*jaeger-span-*';
export const JAEGER_SERVICE_INDEX_NAME = '*jaeger-service*';
export const DATA_PREPPER_INDEX_NAME = 'otel-v1-apm-span-*';
export const DATA_PREPPER_SERVICE_INDEX_NAME = 'otel-v1-apm-service-map*';
export const TRACE_ANALYTICS_DATE_FORMAT = 'MM/DD/YYYY HH:mm:ss';
Expand All @@ -13,5 +15,6 @@ export const SERVICE_MAP_MAX_EDGES = 1000;
export const TRACES_MAX_NUM = 3000;
export const TRACE_ANALYTICS_DOCUMENTATION_LINK = 'https://opensearch.org/docs/latest/observability-plugin/trace/index/';

export const TRACE_ANALYTICS_INDICES_ROUTE = '/api/observability/trace_analytics/indices';
export const TRACE_ANALYTICS_JAEGER_INDICES_ROUTE = '/api/observability/trace_analytics/jaegerindices';
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
export const TRACE_ANALYTICS_DATA_PREPPER_INDICES_ROUTE = '/api/observability/trace_analytics/data_prepper_indices';
export const TRACE_ANALYTICS_DSL_ROUTE = '/api/observability/trace_analytics/query';
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`Service Config component renders empty service config 1`] = `
endTime="now"
filters={Array []}
http={[MockFunction]}
indicesExist={true}
mode="data_prepper"
name=""
parentBreadcrumb={
Object {
Expand Down Expand Up @@ -1101,7 +1101,7 @@ exports[`Service Config component renders with one service selected 1`] = `
]
}
http={[MockFunction]}
indicesExist={true}
mode="data_prepper"
name=""
parentBreadcrumb={
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name=""
description=""
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down Expand Up @@ -120,9 +120,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name="Chic Application"
description="This is my chic application."
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down Expand Up @@ -184,9 +184,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name=""
description=""
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down Expand Up @@ -251,9 +251,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name=""
description=""
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down Expand Up @@ -327,9 +327,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name=""
description=""
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down Expand Up @@ -403,9 +403,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name=""
description=""
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down Expand Up @@ -479,9 +479,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name=""
description=""
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down Expand Up @@ -555,9 +555,9 @@ describe('Create Page', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
name=""
description=""
mode='data_prepper'
setNameWithStorage={setNameWithStorage}
setDescriptionWithStorage={setDescriptionWithStorage}
setQueryWithStorage={setQueryWithStorage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Service Config component', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
mode='data_prepper'
dslService={dslService}
selectedServices={[]}
setSelectedServices={setSelectedServices}
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('Service Config component', () => {
setStartTime={setStartTime}
endTime="now"
setEndTime={setEndTime}
indicesExist={true}
mode='data_prepper'
dslService={dslService}
selectedServices={[]}
setSelectedServices={setSelectedServices}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export function Application(props: AppDetailProps) {
setFilters,
callback,
queryManager,
mode,
} = props;
const [application, setApplication] = useState<ApplicationType>({
id: '',
Expand Down Expand Up @@ -230,7 +231,7 @@ export function Application(props: AppDetailProps) {
}, [appId, application.name]);

useEffect(() => {
const DSL = filtersToDsl(filters, query, appStartTime, appEndTime, 'app', appConfigs);
const DSL = filtersToDsl(mode, filters, query, appStartTime, appEndTime, 'app', appConfigs);
setSpanDSL(DSL);
}, [filters, appConfigs, query, appStartTime, appEndTime]);

Expand Down Expand Up @@ -350,6 +351,7 @@ export function Application(props: AppDetailProps) {
openFlyout={setSpanFlyoutId}
DSL={spanDSL}
setTotal={setTotalSpans}
mode='data_prepper'
/>
</EuiPanel>
</>
Expand Down Expand Up @@ -563,6 +565,7 @@ export function Application(props: AppDetailProps) {
isFlyoutVisible={!!spanFlyoutId}
closeFlyout={closeSpanFlyout}
addSpanFilter={addSpanFilter}
mode="data_prepper"
/>
)}
{traceFlyoutId && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ServiceConfig = (props: ServiceConfigProps) => {
selectedServices,
setSelectedServices,
} = props;
const { mode } = props;
const [servicesOpen, setServicesOpen] = useState(false);
const [serviceMap, setServiceMap] = useState<ServiceObject>({});
const [serviceMapIdSelected, setServiceMapIdSelected] = useState<
Expand All @@ -49,7 +50,7 @@ export const ServiceConfig = (props: ServiceConfigProps) => {
const [modalLayout, setModalLayout] = useState(<EuiOverlayMask />);

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

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@elastic/eui';
import DSLService from 'public/services/requests/dsl';
import React, { useEffect, useState } from 'react';
import { FilterType } from 'public/components/trace_analytics/components/common/filters/filters';
import { FilterType } from '../../../../../public/components/trace_analytics/components/common/filters/filters';
import { OptionType } from '../../../../../common/types/application_analytics';
import { filtersToDsl } from '../../../trace_analytics/components/common/helper_functions';
import { handleDashboardRequest } from '../../../trace_analytics/requests/dashboard_request_handler';
Expand All @@ -42,6 +42,7 @@ export const TraceConfig = (props: TraceConfigProps) => {
endTime,
selectedTraces,
setSelectedTraces,
mode
} = props;
const [traceOpen, setTraceOpen] = useState(false);
const [loading, setLoading] = useState(false);
Expand All @@ -54,16 +55,17 @@ export const TraceConfig = (props: TraceConfigProps) => {

useEffect(() => {
setLoading(true);
const timeFilterDSL = filtersToDsl([], '', startTime, endTime);
const timeFilterDSL = filtersToDsl(mode, [], '', startTime, endTime);
const latencyTrendStartTime = dateMath.parse(endTime, { roundUp: true })?.subtract(24, 'hours').toISOString()!;
const latencyTrendDSL = filtersToDsl(filters, query, latencyTrendStartTime, endTime);
const latencyTrendDSL = filtersToDsl(mode, filters, query, latencyTrendStartTime, endTime);
handleDashboardRequest(
http,
dslService,
timeFilterDSL,
latencyTrendDSL,
traceItems,
setTraceItems,
mode,
setPercentileMap
).then(() => setLoading(false));
setRedirect(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
handleServiceMapRequest,
handleServiceViewRequest,
} from '../../../../../public/components/trace_analytics/requests/services_request_handler';
import { filtersToDsl } from '../../../../../public/components/trace_analytics/components/common/helper_functions';
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 { SpanDetailTable } from '../../../../../public/components/trace_analytics/components/traces/span_detail_table';
Expand All @@ -44,6 +44,7 @@ export function ServiceDetailFlyout(props: ServiceFlyoutProps) {
query,
closeServiceFlyout,
openSpanFlyout,
mode,
} = props;
const [fields, setFields] = useState<any>({});
const [serviceMap, setServiceMap] = useState<ServiceObject>({});
Expand Down Expand Up @@ -110,16 +111,17 @@ export function ServiceDetailFlyout(props: ServiceFlyoutProps) {
DSL={DSL}
openFlyout={openSpanFlyout}
setTotal={setTotal}
mode={mode}
/>
</>
);
}, [serviceName, fields, serviceMap, DSL, serviceMapIdSelected]);

useEffect(() => {
const serviceDSL = filtersToDsl(filters, query, startTime, endTime, 'app', appConfigs);
handleServiceViewRequest(serviceName, http, serviceDSL, setFields);
handleServiceMapRequest(http, serviceDSL, setServiceMap, serviceName);
const spanDSL = filtersToDsl(filters, query, startTime, endTime, 'app', appConfigs);
const serviceDSL = filtersToDsl(mode, filters, query, processTimeStamp(startTime, mode), processTimeStamp(endTime, mode), 'app', appConfigs);
handleServiceViewRequest(serviceName, http, serviceDSL, setFields, mode);
handleServiceMapRequest(http, serviceDSL, mode, setServiceMap, serviceName);
const spanDSL = filtersToDsl(mode, filters, query, startTime, endTime, 'app', appConfigs);
spanDSL.query.bool.must.push({
term: {
serviceName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface TraceFlyoutProps extends TraceAnalyticsComponentDeps {
export function TraceDetailFlyout(props: TraceFlyoutProps) {
const { traceId, http, closeTraceFlyout, openSpanFlyout } = props;
const renderContent = (
<TraceDetailRender traceId={traceId} http={http} openSpanFlyout={openSpanFlyout} />
<TraceDetailRender traceId={traceId} http={http} openSpanFlyout={openSpanFlyout} mode='data_prepper'/>
);
return (
<EuiFlyout data-test-subj="traceDetailFlyout" onClose={closeTraceFlyout} size="m">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ import {
} from '../../../trace_analytics/requests/traces_request_handler';
import { HttpStart } from '../../../../../../../src/core/public';
import { getListItem } from '../../helpers/utils';
import { TraceAnalyticsMode } from '../../../../../public/components/trace_analytics/home';

interface TraceDetailRenderProps {
traceId: string;
http: HttpStart;
openSpanFlyout: (spanId: string) => void;
mode : TraceAnalyticsMode
}

export const TraceDetailRender = ({ traceId, http, openSpanFlyout }: TraceDetailRenderProps) => {
export const TraceDetailRender = ({ traceId, http, openSpanFlyout, mode }: TraceDetailRenderProps) => {
const [fields, setFields] = useState<any>({});
const [serviceBreakdownData, setServiceBreakdownData] = useState([]);
const [payloadData, setPayloadData] = useState('');
Expand Down Expand Up @@ -66,6 +68,7 @@ export const TraceDetailRender = ({ traceId, http, openSpanFlyout }: TraceDetail
colorMap={colorMap}
page="app"
openSpanFlyout={openSpanFlyout}
mode={mode}
/>
<EuiSpacer size="xs" />
<EuiHorizontalRule margin="s" />
Expand All @@ -83,9 +86,9 @@ export const TraceDetailRender = ({ traceId, http, openSpanFlyout }: TraceDetail
}, [traceId, fields, serviceBreakdownData, colorMap, payloadData]);

useEffect(() => {
handleTraceViewRequest(traceId, http, fields, setFields);
handleServicesPieChartRequest(traceId, http, setServiceBreakdownData, setColorMap);
handlePayloadRequest(traceId, http, payloadData, setPayloadData);
handleTraceViewRequest(traceId, http, fields, setFields, mode);
handleServicesPieChartRequest(traceId, http, setServiceBreakdownData, setColorMap, mode);
handlePayloadRequest(traceId, http, payloadData, setPayloadData, mode);
}, [traceId]);

return renderContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Application } from './components/application';
import { CreateApp } from './components/create';
import { TraceAnalyticsComponentDeps, TraceAnalyticsCoreDeps } from '../trace_analytics/home';
import { FilterType } from '../trace_analytics/components/common/filters/filters';
import { handleIndicesExistRequest } from '../trace_analytics/requests/request_handler';
import { handleDataPrepperIndicesExistRequest } from '../trace_analytics/requests/request_handler';
import { ObservabilitySideBar } from '../common/side_nav';
import { NotificationsStart } from '../../../../../src/core/public';
import { APP_ANALYTICS_API_PREFIX } from '../../../common/constants/application_analytics';
Expand Down Expand Up @@ -114,7 +114,7 @@ export const Home = (props: HomeProps) => {
};

useEffect(() => {
handleIndicesExistRequest(http, setIndicesExist);
handleDataPrepperIndicesExistRequest(http, setIndicesExist);
}, []);

const commonProps: AppAnalyticsComponentDeps = {
Expand All @@ -137,7 +137,7 @@ export const Home = (props: HomeProps) => {
setStartTime,
endTime,
setEndTime,
indicesExist,
mode: 'data_prepper',
};

const setToast = (title: string, color = 'success', text?: ReactChild) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ export const TraceBlock = ({ http, hit, logTraceId }: props) => {
);
}

return <TraceDetailRender traceId={logTraceId} http={http} />;
return <TraceDetailRender traceId={logTraceId} http={http} mode='data_prepper'/>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports[`Helper functions renders no match and missing configuration messages 2`
}
body={
<EuiText>
The indices required for trace analytics (otel-v1-apm-span-* and otel-v1-apm-service-map*) do not exist or you do not have permission to access them.
The indices required for trace analytics (*jaeger-span-* and *jaeger-service* or otel-v1-apm-span-* and otel-v1-apm-service-map*) do not exist or you do not have permission to access them.
</EuiText>
}
title={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe('Helper functions', () => {
it('converts filters to DSL', () => {
const getTestDslFromFilters = (field = 'traceGroup', operator = 'exists') =>
filtersToDsl(
'data_prepper',
[
{
field,
Expand Down Expand Up @@ -148,6 +149,7 @@ describe('Helper functions', () => {
);

const customDSL = filtersToDsl(
'data_prepper',
[
{
field: 'serviceName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('Search bar components', () => {
filters={[]}
setFilters={setFilters}
appConfigs={[]}
mode={'data_prepper'}
/>
);
expect(wrapper).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Filter popover component', () => {
it('renders filter popover', () => {
const setFilter = jest.fn();
const closePopover = jest.fn();
const filterFieldOptions = getFilterFields('dashboard').map((field) => ({ label: field }));
const filterFieldOptions = getFilterFields('data_prepper', 'dashboard').map((field) => ({ label: field }));
const wrapper = mount(
<FilterEditPopover
filterFieldOptions={filterFieldOptions}
Expand Down
Loading