Skip to content

Commit

Permalink
ref(insights): remove performance-landing-page-stats-period flag (#86199
Browse files Browse the repository at this point in the history
)

Just doing a bit of cleanup. This feature has been GA almost 2 years
now, no need to keep the flag and it's conditions around.
  • Loading branch information
DominikB2014 authored Mar 3, 2025
1 parent ffa89a6 commit 78b77cf
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ function GenericBackendOverviewPage() {
const {selection} = usePageFilters();

const withStaticFilters = canUseMetricsData(organization);
const eventView = generateBackendPerformanceEventView(
location,
withStaticFilters,
organization
);
const eventView = generateBackendPerformanceEventView(location, withStaticFilters);
const searchBarEventView = eventView.clone();

// TODO - this should come from MetricsField / EAP fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ export function LaravelOverviewPage() {
const navigate = useNavigate();

const withStaticFilters = canUseMetricsData(organization);
const eventView = generateBackendPerformanceEventView(
location,
withStaticFilters,
organization
);
const eventView = generateBackendPerformanceEventView(location, withStaticFilters);

const showOnboarding = onboardingProject !== undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ function FrontendOverviewPage() {
const withStaticFilters = canUseMetricsData(organization);
const eventView = generateFrontendOtherPerformanceEventView(
location,
withStaticFilters,
organization
withStaticFilters
);
const searchBarEventView = eventView.clone();

Expand Down
4 changes: 2 additions & 2 deletions static/app/views/performance/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import useProjects from 'sentry/utils/useProjects';
import withPageFilters from 'sentry/utils/withPageFilters';

import {getLandingDisplayFromParam} from './landing/utils';
import {generatePerformanceEventView, getDefaultStatsPeriod} from './data';
import {DEFAULT_STATS_PERIOD, generatePerformanceEventView} from './data';
import {PerformanceLanding} from './landing';
import {
addRoutePerformanceContext,
Expand Down Expand Up @@ -180,7 +180,7 @@ function PerformanceContent({selection, location, demoMode, router}: Props) {
start: null,
end: null,
utc: false,
period: getDefaultStatsPeriod(organization),
period: DEFAULT_STATS_PERIOD,
},
}}
>
Expand Down
53 changes: 14 additions & 39 deletions static/app/views/performance/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
vitalNameFromLocation,
} from './vitalDetail/utils';

export const DEFAULT_STATS_PERIOD = '7d';
export const DEFAULT_STATS_PERIOD = '14d';
export const DEFAULT_PROJECT_THRESHOLD_METRIC = 'duration';
export const DEFAULT_PROJECT_THRESHOLD = 300;

Expand All @@ -48,13 +48,6 @@ export const USER_MISERY_TOOLTIP = tct(

const TOKEN_KEYS_SUPPORTED_IN_LIMITED_SEARCH = ['transaction'];

export const getDefaultStatsPeriod = (organization: Organization) => {
if (organization.features.includes('performance-landing-page-stats-period')) {
return '14d';
}
return DEFAULT_STATS_PERIOD;
};

export enum PerformanceTerm {
TPM = 'tpm',
THROUGHPUT = 'throughput',
Expand Down Expand Up @@ -484,7 +477,7 @@ export function generateGenericPerformanceEventView(
savedQuery.widths = widths;

if (!query.statsPeriod && !hasStartAndEnd) {
savedQuery.range = getDefaultStatsPeriod(organization);
savedQuery.range = DEFAULT_STATS_PERIOD;
}
savedQuery.orderby = decodeScalar(query.sort, '-tpm');

Expand Down Expand Up @@ -512,8 +505,7 @@ export function generateGenericPerformanceEventView(

export function generateBackendPerformanceEventView(
location: Location,
withStaticFilters: boolean,
organization: Organization
withStaticFilters: boolean
): EventView {
const {query} = location;

Expand Down Expand Up @@ -548,7 +540,7 @@ export function generateBackendPerformanceEventView(
savedQuery.widths = widths;

if (!query.statsPeriod && !hasStartAndEnd) {
savedQuery.range = getDefaultStatsPeriod(organization);
savedQuery.range = DEFAULT_STATS_PERIOD;
}
savedQuery.orderby = decodeScalar(query.sort, '-tpm');

Expand Down Expand Up @@ -615,7 +607,7 @@ export function generateMobilePerformanceEventView(
savedQuery.widths = widths;

if (!query.statsPeriod && !hasStartAndEnd) {
savedQuery.range = getDefaultStatsPeriod(organization);
savedQuery.range = DEFAULT_STATS_PERIOD;
}
savedQuery.orderby = decodeScalar(query.sort, '-tpm');

Expand All @@ -631,8 +623,7 @@ export function generateMobilePerformanceEventView(

function generateFrontendPageloadPerformanceEventView(
location: Location,
withStaticFilters: boolean,
organization: Organization
withStaticFilters: boolean
): EventView {
const {query} = location;

Expand Down Expand Up @@ -665,7 +656,7 @@ function generateFrontendPageloadPerformanceEventView(
savedQuery.widths = widths;

if (!query.statsPeriod && !hasStartAndEnd) {
savedQuery.range = getDefaultStatsPeriod(organization);
savedQuery.range = DEFAULT_STATS_PERIOD;
}
savedQuery.orderby = decodeScalar(query.sort, '-tpm');

Expand All @@ -682,8 +673,7 @@ function generateFrontendPageloadPerformanceEventView(

export function generateFrontendOtherPerformanceEventView(
location: Location,
withStaticFilters: boolean,
organization: Organization
withStaticFilters: boolean
): EventView {
const {query} = location;

Expand Down Expand Up @@ -716,7 +706,7 @@ export function generateFrontendOtherPerformanceEventView(
savedQuery.widths = widths;

if (!query.statsPeriod && !hasStartAndEnd) {
savedQuery.range = getDefaultStatsPeriod(organization);
savedQuery.range = DEFAULT_STATS_PERIOD;
}
savedQuery.orderby = decodeScalar(query.sort, '-tpm');

Expand Down Expand Up @@ -748,23 +738,11 @@ export function generatePerformanceEventView(
const display = getCurrentLandingDisplay(location, projects, eventView);
switch (display?.field) {
case LandingDisplayField.FRONTEND_PAGELOAD:
return generateFrontendPageloadPerformanceEventView(
location,
withStaticFilters,
organization
);
return generateFrontendPageloadPerformanceEventView(location, withStaticFilters);
case LandingDisplayField.FRONTEND_OTHER:
return generateFrontendOtherPerformanceEventView(
location,
withStaticFilters,
organization
);
return generateFrontendOtherPerformanceEventView(location, withStaticFilters);
case LandingDisplayField.BACKEND:
return generateBackendPerformanceEventView(
location,
withStaticFilters,
organization
);
return generateBackendPerformanceEventView(location, withStaticFilters);
case LandingDisplayField.MOBILE:
return generateMobilePerformanceEventView(
location,
Expand All @@ -778,10 +756,7 @@ export function generatePerformanceEventView(
}
}

export function generatePerformanceVitalDetailView(
location: Location,
organization: Organization
): EventView {
export function generatePerformanceVitalDetailView(location: Location): EventView {
const {query} = location;

const vitalName = vitalNameFromLocation(location);
Expand Down Expand Up @@ -809,7 +784,7 @@ export function generatePerformanceVitalDetailView(
};

if (!query.statsPeriod && !hasStartAndEnd) {
savedQuery.range = getDefaultStatsPeriod(organization);
savedQuery.range = DEFAULT_STATS_PERIOD;
}
savedQuery.orderby = decodeScalar(query.sort, '-count');

Expand Down
2 changes: 1 addition & 1 deletion static/app/views/performance/landing/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('Performance > Landing > Index', function () {
project: [],
query: 'event.type:transaction',
referrer: 'api.performance.generic-widget-chart.user-misery-area',
statsPeriod: '14d',
statsPeriod: '28d',
yAxis: ['user_misery()', 'tpm()', 'failure_rate()'],
}),
})
Expand Down
10 changes: 2 additions & 8 deletions static/app/views/performance/vitalDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,13 @@ type State = {

class VitalDetail extends Component<Props, State> {
state: State = {
eventView: generatePerformanceVitalDetailView(
this.props.location,
this.props.organization
),
eventView: generatePerformanceVitalDetailView(this.props.location),
};

static getDerivedStateFromProps(nextProps: Readonly<Props>, prevState: State): State {
return {
...prevState,
eventView: generatePerformanceVitalDetailView(
nextProps.location,
nextProps.organization
),
eventView: generatePerformanceVitalDetailView(nextProps.location),
};
}

Expand Down

0 comments on commit 78b77cf

Please sign in to comment.