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

[Backport 2.x] Trace Groups Optimization - Remove duplicate filters #2373

Merged
merged 1 commit into from
Mar 5, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -222,21 +222,7 @@ exports[`Dashboard component renders dashboard 1`] = `
}
query=""
setEndTime={[MockFunction]}
setFilters={
[MockFunction] {
"calls": Array [
Array [
Array [],
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
],
}
}
setFilters={[MockFunction]}
setQuery={[MockFunction]}
setStartTime={[MockFunction]}
startTime="now-5m"
Expand Down Expand Up @@ -617,21 +603,7 @@ exports[`Dashboard component renders dashboard 1`] = `
}
query=""
setEndTime={[MockFunction]}
setFilters={
[MockFunction] {
"calls": Array [
Array [
Array [],
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
],
}
}
setFilters={[MockFunction]}
setQuery={[MockFunction]}
setStartTime={[MockFunction]}
startTime="now-5m"
Expand Down Expand Up @@ -2870,21 +2842,7 @@ exports[`Dashboard component renders empty dashboard 1`] = `
}
query=""
setEndTime={[MockFunction]}
setFilters={
[MockFunction] {
"calls": Array [
Array [
Array [],
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
],
}
}
setFilters={[MockFunction]}
setQuery={[MockFunction]}
setStartTime={[MockFunction]}
startTime="now-5m"
Expand Down Expand Up @@ -3264,21 +3222,7 @@ exports[`Dashboard component renders empty dashboard 1`] = `
}
query=""
setEndTime={[MockFunction]}
setFilters={
[MockFunction] {
"calls": Array [
Array [
Array [],
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
],
}
}
setFilters={[MockFunction]}
setQuery={[MockFunction]}
setStartTime={[MockFunction]}
startTime="now-5m"
Expand Down Expand Up @@ -5517,21 +5461,7 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = `
}
query=""
setEndTime={[MockFunction]}
setFilters={
[MockFunction] {
"calls": Array [
Array [
Array [],
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
],
}
}
setFilters={[MockFunction]}
setQuery={[MockFunction]}
setStartTime={[MockFunction]}
startTime="now-5m"
Expand Down Expand Up @@ -5913,21 +5843,7 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = `
}
query=""
setEndTime={[MockFunction]}
setFilters={
[MockFunction] {
"calls": Array [
Array [
Array [],
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
],
}
}
setFilters={[MockFunction]}
setQuery={[MockFunction]}
setStartTime={[MockFunction]}
startTime="now-5m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
handleJaegerDashboardRequest,
handleJaegerErrorDashboardRequest,
} from '../../requests/dashboard_request_handler';
import { getValidFilterFields } from '../common/filters/filter_helpers';
import { FilterType } from '../common/filters/filters';
import {
MissingConfigurationMessage,
Expand Down Expand Up @@ -47,14 +46,13 @@
filters,
setStartTime,
setEndTime,
setQuery,

Check failure on line 49 in public/components/trace_analytics/components/dashboard/dashboard_content.tsx

View workflow job for this annotation

GitHub Actions / Lint

'setQuery' is assigned a value but never used. Allowed unused vars must match /^_/u
setFilters,
mode,
dataPrepperIndicesExist,
jaegerIndicesExist,
toasts,
dataSourceMDSId,
attributesFilterFields,
} = props;
const [tableItems, setTableItems] = useState([]);
const [jaegerTableItems, setJaegerTableItems] = useState([]);
Expand All @@ -62,7 +60,7 @@
const [throughputPltItems, setThroughputPltItems] = useState({ items: [], fixedInterval: '1h' });
const [errorRatePltItems, setErrorRatePltItems] = useState({ items: [], fixedInterval: '1h' });
const [percentileMap, setPercentileMap] = useState<{ [traceGroup: string]: number[] }>({});
const [filteredService, setFilteredService] = useState('');

Check failure on line 63 in public/components/trace_analytics/components/dashboard/dashboard_content.tsx

View workflow job for this annotation

GitHub Actions / Lint

'filteredService' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 63 in public/components/trace_analytics/components/dashboard/dashboard_content.tsx

View workflow job for this annotation

GitHub Actions / Lint

'setFilteredService' is assigned a value but never used. Allowed unused vars must match /^_/u
const [redirect, setRedirect] = useState(true);
const [isTraceGroupTableLoading, setIsTraceGroupTableLoading] = useState(false);
const [showTimeoutToast, setShowTimeoutToast] = useState(false);
Expand All @@ -89,13 +87,6 @@
chrome.setBreadcrumbs([parentBreadcrumb, ...childBreadcrumbs]);
}

const validFilters = getValidFilterFields(mode, page, attributesFilterFields);
setFilters([
...filters.map((filter) => ({
...filter,
locked: validFilters.indexOf(filter.field) === -1,
})),
]);
setRedirect(false);
}, []);

Expand Down Expand Up @@ -195,7 +186,7 @@
// service map should not be filtered by service name (https://github.com/opensearch-project/observability/issues/442)
const serviceMapDSL = _.cloneDeep(DSL);
serviceMapDSL.query.bool.must = serviceMapDSL.query.bool.must.filter(
(must: any) => must?.term?.serviceName == null

Check warning on line 189 in public/components/trace_analytics/components/dashboard/dashboard_content.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
);
}

Expand Down Expand Up @@ -247,8 +238,8 @@
for (let i = 0; i < filters.length; i++) {
if (filters[i].custom) {
const newFilter = JSON.parse(JSON.stringify(filters[i]));
newFilter.custom.query.bool.should.forEach((should: any) =>

Check warning on line 241 in public/components/trace_analytics/components/dashboard/dashboard_content.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
should.bool.must.forEach((must: any) => {

Check warning on line 242 in public/components/trace_analytics/components/dashboard/dashboard_content.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const range = must?.range?.['traceGroupFields.durationInNanos'];
if (range) {
const duration = range.lt || range.lte || range.gt || range.gte;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

export function DashboardTable(props: {
title?: string;
items: any[];

Check warning on line 31 in public/components/trace_analytics/components/dashboard/dashboard_table.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
filters: FilterType[];
addFilter: (filter: FilterType) => void;
addPercentileFilter: (condition?: 'gte' | 'lte', additionalFilters?: FilterType[]) => void;
Expand All @@ -36,7 +36,7 @@
loading: boolean;
page: 'dashboard' | 'traces' | 'services' | 'app';
}) {
const getVarianceProps = (items: any[]) => {

Check warning on line 39 in public/components/trace_analytics/components/dashboard/dashboard_table.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
if (items.length === 0) {
return { minRange: 0, maxRange: 0, ticks: [0, 0], scale: '' };
}
Expand Down Expand Up @@ -335,7 +335,7 @@
inverted: false,
disabled: false,
});
if (props.page !== 'app') {
if (!['app', 'traces'].includes(props.page)) {
props.setRedirect(true);
location.assign('#/traces');
}
Expand All @@ -345,7 +345,7 @@
</EuiLink>
),
},
] as Array<EuiTableFieldDataColumnType<any>>;

Check warning on line 348 in public/components/trace_analytics/components/dashboard/dashboard_table.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

const renderTitleBar = (totalItems: number) => {
return (
Expand Down Expand Up @@ -380,8 +380,8 @@
};

const varianceProps = useMemo(() => getVarianceProps(props.items), [props.items]);
const columns = useMemo(() => getColumns(), [props.items, props.filters]);

Check warning on line 383 in public/components/trace_analytics/components/dashboard/dashboard_table.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useMemo has a missing dependency: 'getColumns'. Either include it or remove the dependency array
const titleBar = useMemo(() => renderTitleBar(props.items?.length), [props.items]);

Check warning on line 384 in public/components/trace_analytics/components/dashboard/dashboard_table.tsx

View workflow job for this annotation

GitHub Actions / Lint

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

const [sorting, setSorting] = useState<{ sort: PropertySort }>({
sort: {
Expand All @@ -390,7 +390,7 @@
},
});

const onTableChange = async ({ _page, sort }: CriteriaWithPagination<any>) => {

Check warning on line 393 in public/components/trace_analytics/components/dashboard/dashboard_table.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
if (typeof sort?.field !== 'string') return;
setSorting({ sort } as { sort: PropertySort });
};
Expand Down
Loading