Skip to content
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 @@ -71,6 +71,7 @@ export function InvalidTokenTooltip({
})}
position="bottom"
title={warning ?? tokenWarning ?? invalid?.reason ?? t('This token is invalid')}
isHoverable={hasWarning || hasTokenWarning || tooltipProps.isHoverable}
{...tooltipProps}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {memo, useCallback, useMemo} from 'react';
import {Grid} from '@sentry/scraps/layout';

import {SearchQueryBuilderProvider} from 'sentry/components/searchQueryBuilder/context';
import {t} from 'sentry/locale';
import {
ALLOWED_EXPLORE_VISUALIZE_AGGREGATES,
type AggregationKey,
Expand All @@ -23,6 +22,7 @@ import {
useQueryParamsMode,
useSetQueryParamsCrossEvents,
} from 'sentry/views/explore/queryParams/context';
import {SamplesModeAggregateFilterWarning} from 'sentry/views/explore/spans/samplesModeAggregateFilterWarning';
import {TraceItemDataset} from 'sentry/views/explore/types';

interface SpansTabCrossEventMetricsSearchBarProps {
Expand Down Expand Up @@ -96,9 +96,7 @@ export const SpansTabCrossEventMetricsSearchBar = memo(
if (
ALLOWED_EXPLORE_VISUALIZE_AGGREGATES.includes(key as AggregationKey)
) {
return t(
"This key won't affect the results because samples mode does not support aggregate functions"
);
return <SamplesModeAggregateFilterWarning />;
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {memo, useMemo} from 'react';

import {SearchQueryBuilderProvider} from 'sentry/components/searchQueryBuilder/context';
import {t} from 'sentry/locale';
import {
ALLOWED_EXPLORE_VISUALIZE_AGGREGATES,
type AggregationKey,
Expand All @@ -18,6 +17,7 @@ import {
useQueryParamsMode,
useSetQueryParamsCrossEvents,
} from 'sentry/views/explore/queryParams/context';
import {SamplesModeAggregateFilterWarning} from 'sentry/views/explore/spans/samplesModeAggregateFilterWarning';
import {TraceItemDataset} from 'sentry/views/explore/types';

interface SpansTabCrossEventSearchBarProps {
Expand Down Expand Up @@ -66,9 +66,7 @@ export const SpansTabCrossEventSearchBar = memo(
if (
ALLOWED_EXPLORE_VISUALIZE_AGGREGATES.includes(key as AggregationKey)
) {
return t(
"This key won't affect the results because samples mode does not support aggregate functions"
);
return <SamplesModeAggregateFilterWarning />;
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {useMemo} from 'react';

import {Link} from '@sentry/scraps/link';

import {tct} from 'sentry/locale';
import {updateNullableLocation} from 'sentry/utils/url/updateNullableLocation';
import {useLocation} from 'sentry/utils/useLocation';
import {Mode} from 'sentry/views/explore/contexts/pageParamsContext/mode';
import {getTargetWithReadableQueryParams} from 'sentry/views/explore/spans/spansQueryParams';

const SPANS_TABLE_KEY = 'table';

export function SamplesModeAggregateFilterWarning() {
const location = useLocation();

const target = useMemo(() => {
const nextLocation = getTargetWithReadableQueryParams(location, {
mode: Mode.AGGREGATE,
});
updateNullableLocation(nextLocation, SPANS_TABLE_KEY, null);
return nextLocation;
}, [location]);

return tct(
"This key won't affect the results because samples mode does not support aggregate functions. [link:View aggregates]",
{
link: <Link to={target} />,
}
);
}
5 changes: 2 additions & 3 deletions static/app/views/explore/spans/spansTabSearchSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
} from 'sentry/views/explore/queryParams/context';
import {CrossEventQueryingDropdown} from 'sentry/views/explore/spans/crossEvents/crossEventQueryingDropdown';
import {SpansTabCrossEventSearchBars} from 'sentry/views/explore/spans/crossEvents/crossEventSearchBars';
import {SamplesModeAggregateFilterWarning} from 'sentry/views/explore/spans/samplesModeAggregateFilterWarning';
import {SpansTabSeerComboBox} from 'sentry/views/explore/spans/spansTabSeerComboBox';
import {ExploreSpansTour, ExploreSpansTourContext} from 'sentry/views/explore/spans/tour';
import {findSuggestedColumns} from 'sentry/views/explore/utils';
Expand Down Expand Up @@ -114,9 +115,7 @@ export function SpanTabSearchSection({datePageFilterProps}: SpanTabSearchSection
mode === Mode.SAMPLES
? (key: string) => {
if (ALLOWED_EXPLORE_VISUALIZE_AGGREGATES.includes(key as AggregationKey)) {
return t(
"This key won't affect the results because samples mode does not support aggregate functions"
);
return <SamplesModeAggregateFilterWarning />;
}
return;
}
Expand Down
Loading