Skip to content
Draft
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
29 changes: 1 addition & 28 deletions static/app/utils/performance/trends/trendsDiscoverQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TrendChangeType,
TrendFunctionField,
TrendsData,
TrendsDataEvents,
TrendsQuery,
TrendView,
} from 'sentry/views/performance/trends/types';
Expand All @@ -25,7 +24,6 @@ type TrendsRequest = {
projects: Project[];
trendChangeType?: TrendChangeType;
trendFunctionField?: TrendFunctionField;
withBreakpoint?: boolean;
};

type RequestProps = DiscoverQueryProps & TrendsRequest;
Expand All @@ -41,14 +39,6 @@ type Props = RequestProps & {
children: (props: TrendDiscoveryChildrenProps) => React.ReactNode;
};

type EventChildrenProps = Omit<GenericChildrenProps<TrendsDataEvents>, 'tableData'> & {
trendsData: TrendsDataEvents | null;
};

type EventProps = RequestProps & {
children: (props: EventChildrenProps) => React.ReactNode;
};

function getTrendsRequestPayload(props: RequestProps) {
const {eventView, projects} = props;
const apiPayload: TrendsQuery = eventView?.getEventsAPIPayload(props.location);
Expand Down Expand Up @@ -79,28 +69,11 @@ function getTrendsRequestPayload(props: RequestProps) {

export function TrendsDiscoverQuery(props: Omit<Props, 'projects'>) {
const {projects} = useProjects();
const route = props.withBreakpoint ? 'events-trends-statsv2' : 'events-trends-stats';
return (
<GenericDiscoverQuery<TrendsData, TrendsRequest>
{...props}
projects={projects}
route={route}
getRequestPayload={getTrendsRequestPayload}
>
{({tableData, ...rest}) => {
return props.children({trendsData: tableData, ...rest});
}}
</GenericDiscoverQuery>
);
}

export function TrendsEventsDiscoverQuery(props: Omit<EventProps, 'projects'>) {
const {projects} = useProjects();
return (
<GenericDiscoverQuery<TrendsDataEvents, TrendsRequest>
{...props}
projects={projects}
route="events-trends"
route="events-trends-statsv2"
getRequestPayload={getTrendsRequestPayload}
>
{({tableData, ...rest}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('Performance > Widgets > WidgetContainer', () => {

eventsTrendsStats = MockApiClient.addMockResponse({
method: 'GET',
url: '/organizations/org-slug/events-trends-stats/',
url: '/organizations/org-slug/events-trends-statsv2/',
body: [],
});

Expand Down Expand Up @@ -263,12 +263,11 @@ describe('Performance > Widgets > WidgetContainer', () => {
noPagination: true,
per_page: QUERY_LIMIT_PARAM,
project: ['-42'],
query:
'transaction.op:pageload tpm():>0.01 count_percentage():>0.25 count_percentage():<4 trend_percentage():>0% confidence():>6',
sort: 'trend_percentage()',
query: 'transaction.op:pageload tpm():>0.1',
sort: '-trend_percentage()',
statsPeriod: '14d',
trendFunction: 'p95(transaction.duration)',
trendType: 'improved',
trendType: 'any',
}),
})
);
Expand Down Expand Up @@ -720,12 +719,11 @@ describe('Performance > Widgets > WidgetContainer', () => {
middle: undefined,
per_page: QUERY_LIMIT_PARAM,
project: ['-42'],
query:
'transaction.op:pageload tpm():>0.01 count_percentage():>0.25 count_percentage():<4 trend_percentage():>0% confidence():>6',
sort: 'trend_percentage()',
query: 'transaction.op:pageload tpm():>0.1',
sort: '-trend_percentage()',
statsPeriod: '7d',
trendFunction: 'p95(transaction.duration)',
trendType: 'improved',
trendType: 'any',
}),
})
);
Expand Down Expand Up @@ -1008,12 +1006,11 @@ describe('Performance > Widgets > WidgetContainer', () => {
middle: undefined,
per_page: QUERY_LIMIT_PARAM,
project: ['-42'],
query:
'transaction.op:pageload tpm():>0.01 count_percentage():>0.25 count_percentage():<4 trend_percentage():>0% confidence():>6',
query: 'transaction.op:pageload tpm():>0.1',
sort: '-trend_percentage()',
statsPeriod: '7d',
trendFunction: 'p95(transaction.duration)',
trendType: 'regression',
trendType: 'any',
}),
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
QUERY_LIMIT_PARAM,
TOTAL_EXPANDABLE_ROWS_HEIGHT,
} from 'sentry/views/performance/landing/widgets/utils';
import {PerformanceWidgetSetting} from 'sentry/views/performance/landing/widgets/widgetDefinitions';
import {
DisplayModes,
transactionSummaryRouteWithQuery,
Expand All @@ -56,17 +55,11 @@
const navigate = useNavigate();
const {projects} = useProjects();

const {isLoading: isCardinalityCheckLoading, outcome} = useMetricsCardinalityContext();
const {isLoading: isCardinalityCheckLoading} = useMetricsCardinalityContext();

const {eventView: _eventView, withStaticFilters, InteractiveTitle} = props;

const withBreakpoint = !isCardinalityCheckLoading && !outcome?.forceTransactionsOnly;

const trendChangeType =
props.chartSetting === PerformanceWidgetSetting.MOST_IMPROVED
? TrendChangeType.IMPROVED
: TrendChangeType.REGRESSION;
const derivedTrendChangeType = withBreakpoint ? TrendChangeType.ANY : trendChangeType;
const derivedTrendChangeType = TrendChangeType.ANY;
const trendFunctionField = TrendFunctionField.P95;

const [selectedListIndex, setSelectListIndex] = useState<number>(0);
Expand All @@ -75,19 +68,12 @@
eventView.fields = fields;
eventView.sorts = [
{
kind: derivedTrendChangeType === TrendChangeType.IMPROVED ? 'asc' : 'desc',

Check failure on line 71 in static/app/views/performance/landing/widgets/widgets/trendsWidget.tsx

View workflow job for this annotation

GitHub Actions / @typescript/native-preview

This comparison appears to be unintentional because the types 'TrendChangeType.ANY' and 'TrendChangeType.IMPROVED' have no overlap.

Check failure on line 71 in static/app/views/performance/landing/widgets/widgets/trendsWidget.tsx

View workflow job for this annotation

GitHub Actions / typescript

This comparison appears to be unintentional because the types 'TrendChangeType.ANY' and 'TrendChangeType.IMPROVED' have no overlap.
field: 'trend_percentage()',
},
];
const rest = {...props, eventView};
if (withBreakpoint) {
eventView.additionalConditions.addFilterValues('tpm()', ['>0.1']);
} else {
eventView.additionalConditions.addFilterValues('tpm()', ['>0.01']);
eventView.additionalConditions.addFilterValues('count_percentage()', ['>0.25', '<4']);
eventView.additionalConditions.addFilterValues('trend_percentage()', ['>0%']);
eventView.additionalConditions.addFilterValues('confidence()', ['>6']);
}
eventView.additionalConditions.addFilterValues('tpm()', ['>0.1']);

const chart = useMemo<QueryDefinition<DataType, WidgetDataResult>>(
() => ({
Expand All @@ -102,7 +88,6 @@
limit={QUERY_LIMIT_PARAM}
cursor="0:0:1"
noPagination
withBreakpoint={withBreakpoint}
/>
),
transform: transformTrendsDiscover,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ export function TransactionSummaryCharts({
end={eventView.end}
statsPeriod={eventView.statsPeriod}
projects={project ? [project] : []}
withBreakpoint
/>
)}
{display === DisplayModes.VITALS && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type Props = {
start: number;
};
transaction?: NormalizedTrendsTransaction;
withBreakpoint?: boolean;
} & Omit<React.ComponentProps<typeof ReleaseSeries>, 'children' | 'queryExtra'> &
Pick<LineChartProps, 'onLegendSelectChanged' | 'legend'>;

Expand All @@ -53,7 +52,6 @@ export function Content({
legend,
utc,
queryExtra,
withBreakpoint,
transaction,
onLegendSelectChanged,
}: Props) {
Expand Down Expand Up @@ -81,9 +79,13 @@ export function Content({
: [];

const needsLabel = false;
const breakpointSeries = withBreakpoint
? getIntervalLine(theme, data || [], 0.5, needsLabel, transaction)
: [];
const breakpointSeries = getIntervalLine(
theme,
data || [],
0.5,
needsLabel,
transaction
);

const durationUnit = getDurationUnit(series, legend);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
queryExtra: Query;
trendFunction: TrendFunctionField;
trendParameter: string;
withBreakpoint?: boolean;
};

export function TrendChart({
Expand All @@ -52,7 +51,6 @@
trendFunction,
trendParameter,
queryExtra,
withBreakpoint,
eventView,
start: propsStart,
end: propsEnd,
Expand All @@ -65,7 +63,7 @@

const {isLoading: isCardinalityCheckLoading, outcome} = useMetricsCardinalityContext();
const shouldGetBreakpoint =
withBreakpoint && !isCardinalityCheckLoading && !outcome?.forceTransactionsOnly;
!isCardinalityCheckLoading && !outcome?.forceTransactionsOnly;

function handleLegendSelectChanged(legendChange: {
name: string;
Expand Down Expand Up @@ -172,13 +170,11 @@
<Fragment>
{header}
{shouldGetBreakpoint ? (
// queries events-trends-statsv2 for breakpoint data (feature flag only)
<TrendsDiscoverQuery
eventView={trendView}
orgSlug={organization.slug}
location={location}
limit={1}
withBreakpoint
>
{({isLoading, trendsData}) => {
const events = normalizeTrends(trendsData?.events?.data || []);
Expand Down Expand Up @@ -236,7 +232,6 @@
loading={loading || isLoading}
reloading={reloading}
timeFrame={timeframe}
withBreakpoint
transaction={selectedTransaction}
{...contentCommonProps}
/>
Expand All @@ -250,7 +245,7 @@
loading={isLoading || isCardinalityCheckLoading}
reloading={isLoading}
timeFrame={metricsTimeFrame}
withBreakpoint

Check failure on line 248 in static/app/views/performance/transactionSummary/transactionOverview/trendChart/index.tsx

View workflow job for this annotation

GitHub Actions / @typescript/native-preview

Type '{ theme: Theme; start: Date | null; end: Date | null; utc: boolean; legend: { right: number; top: number; selected: Dictionary<boolean> | undefined; }; queryExtra: DefaultQuery<...>; ... 10 more ...; transaction: NormalizedTrendsTransaction | undefined; }' is not assignable to type 'IntrinsicAttributes & { errored: boolean; loading: boolean; queryExtra: DefaultQuery<string>; reloading: boolean; theme: Theme; series?: Series[] | undefined; timeFrame?: { ...; } | undefined; transaction?: NormalizedTrendsTransaction | undefined; } & Omit<...> & Pick<...>'.

Check failure on line 248 in static/app/views/performance/transactionSummary/transactionOverview/trendChart/index.tsx

View workflow job for this annotation

GitHub Actions / typescript

Type '{ theme: Theme; start: Date | null; end: Date | null; utc: boolean; legend: { right: number; top: number; selected: Dictionary<boolean> | undefined; }; queryExtra: DefaultQuery<...>; ... 10 more ...; transaction: NormalizedTrendsTransaction | undefined; }' is not assignable to type 'IntrinsicAttributes & { errored: boolean; loading: boolean; queryExtra: DefaultQuery<string>; reloading: boolean; theme: Theme; series?: Series[] | undefined; timeFrame?: { ...; } | undefined; transaction?: NormalizedTrendsTransaction | undefined; } & Omit<...> & Pick<...>'.
transaction={selectedTransaction}
{...contentCommonProps}
/>
Expand Down
Loading