diff --git a/frontend/src/api/trace/getTagFilter.ts b/frontend/src/api/trace/getTagFilter.ts index 746765c4bf..e4cadb710c 100644 --- a/frontend/src/api/trace/getTagFilter.ts +++ b/frontend/src/api/trace/getTagFilter.ts @@ -4,6 +4,7 @@ import { AxiosError } from 'axios'; import { omitBy } from 'lodash-es'; import { ErrorResponse, SuccessResponse } from 'types/api'; import { PayloadProps, Props } from 'types/api/trace/getTagFilters'; +import { TraceFilterEnum } from 'types/reducer/trace'; const getTagFilters = async ( props: Props, @@ -12,6 +13,14 @@ const getTagFilters = async ( const duration = omitBy(props.other, (_, key) => !key.startsWith('duration')) || []; + const exclude: TraceFilterEnum[] = []; + + props.isFilterExclude.forEach((value, key) => { + if (value) { + exclude.push(key); + } + }); + const nonDuration = omitBy(props.other, (_, key) => key.startsWith('duration'), ); @@ -22,6 +31,7 @@ const getTagFilters = async ( ...nonDuration, maxDuration: String((duration.duration || [])[0] || ''), minDuration: String((duration.duration || [])[1] || ''), + exclude, }); return { diff --git a/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx b/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx index da0f957008..b57b4fc361 100644 --- a/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx +++ b/frontend/src/container/Trace/Search/AllTags/Tag/TagKey.tsx @@ -27,6 +27,7 @@ function TagsKey(props: TagsKeysProps): JSX.Element { start: globalTime.minTime, end: globalTime.maxTime, other: Object.fromEntries(traces.selectedFilter), + isFilterExclude: traces.isFilterExclude, }); if (response.statusCode === 200) { diff --git a/frontend/src/types/api/trace/getTagFilters.ts b/frontend/src/types/api/trace/getTagFilters.ts index 31581e98ba..29506d1509 100644 --- a/frontend/src/types/api/trace/getTagFilters.ts +++ b/frontend/src/types/api/trace/getTagFilters.ts @@ -1,9 +1,12 @@ +import { TraceReducer } from 'types/reducer/trace'; + export interface Props { start: number; end: number; other: { [k: string]: string[]; }; + isFilterExclude: TraceReducer['isFilterExclude']; } interface TagsKeys {