diff --git a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx index aeaa7a8d166..409b9688d4f 100644 --- a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx +++ b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/TraceQLSearch.tsx @@ -10,7 +10,7 @@ import { createErrorNotification } from '../../../../core/copy/appNotification'; import { notifyApp } from '../../../../core/reducers/appNotification'; import { dispatch } from '../../../../store/store'; import { RawQuery } from '../../prometheus/querybuilder/shared/RawQuery'; -import { TraceqlFilter } from '../dataquery.gen'; +import { TraceqlFilter, TraceqlSearchScope } from '../dataquery.gen'; import { TempoDatasource } from '../datasource'; import { TempoQueryBuilderOptions } from '../traceql/TempoQueryBuilderOptions'; import { traceqlGrammar } from '../traceql/traceql'; @@ -30,6 +30,8 @@ interface Props { onBlur?: () => void; } +const hardCodedFilterIds = ['min-duration', 'max-duration', 'status']; + const TraceQLSearch = ({ datasource, query, onChange }: Props) => { const styles = useStyles2(getStyles); const [error, setError] = useState(null); @@ -95,9 +97,10 @@ const TraceQLSearch = ({ datasource, query, onChange }: Props) => { staticTags.push('duration'); // Dynamic filters are all filters that don't match the ID of a filter in the datasource configuration - // The duration tag is a special case since its selector is hard-coded + // The duration and status fields are a special case since its selector is hard-coded const dynamicFilters = (query.filters || []).filter( - (f) => f.tag !== 'duration' && (datasource.search?.filters?.findIndex((sf) => sf.id === f.id) || 0) === -1 + (f) => + !hardCodedFilterIds.includes(f.id) && (datasource.search?.filters?.findIndex((sf) => sf.id === f.id) || 0) === -1 ); return ( @@ -127,6 +130,25 @@ const TraceQLSearch = ({ datasource, query, onChange }: Props) => { ) )} + +