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 62 commits
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
1 change: 1 addition & 0 deletions common/constants/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const REDIRECT_TAB = 'redirect_tab';
export const PAGE_SIZE = 50;
export const DEFAULT_COLUMNS = ['', 'Time', '_source'];
export const OTEL_TRACE_ID = 'traceId';
export const JAEGER_TRACE_ID = 'traceID';
export const DATE_PICKER_FORMAT = 'YYYY-MM-DD HH:mm:ss';
export const TIME_INTERVAL_OPTIONS = [
{
Expand Down
5 changes: 4 additions & 1 deletion 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/jaeger_indices';
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';
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 @@ -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
6 changes: 3 additions & 3 deletions public/components/application_analytics/home.tsx
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 @@ -12,7 +12,7 @@ import { useEffect } from 'react';
import { IExplorerFields, IField } from '../../../../../common/types/explorer';
import { DocFlyout } from './doc_flyout';
import { HttpStart } from '../../../../../../../src/core/public';
import { OTEL_TRACE_ID, DATE_PICKER_FORMAT } from '../../../../../common/constants/explorer';
import { OTEL_TRACE_ID, DATE_PICKER_FORMAT, JAEGER_TRACE_ID } from '../../../../../common/constants/explorer';
import { SurroundingFlyout } from './surrounding_flyout';
import PPLService from '../../../../services/requests/ppl';
import { isValidTraceId } from '../../utils';
Expand Down Expand Up @@ -77,13 +77,13 @@ export const DocViewRow = forwardRef((props: IDocViewRowProps, ref) => {
<span>
<dl className="source truncate-by-height">
{toPairs(doc).map((entry: string[]) => {
const isTraceField = entry[0] === OTEL_TRACE_ID;
const isTraceField = (entry[0] === OTEL_TRACE_ID || entry[0] === JAEGER_TRACE_ID);
return (
<span key={uniqueId('grid-desc')}>
<dt>{entry[0]}:</dt>
<dd>
<span>
{isTraceField && isValidTraceId(entry[1]) && !isFlyout ? (
Comment on lines -80 to -86
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to enable event analytics traceID clicking/flyout pops out for jaeger indices

{isTraceField && (isValidTraceId(entry[1]) || entry[0] === JAEGER_TRACE_ID) && !isFlyout ? (
<EuiLink onClick={tracesFlyout}>{entry[1]}</EuiLink>
) : (
entry[1]
Expand Down
Loading