Skip to content

Commit ba42f29

Browse files
authored
fix(tracemetrics): Prep for stats flip (#113114)
### Summary Flipping from count to byte stats, need two flags.
1 parent 31f9de5 commit ba42f29

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

static/app/views/explore/metrics/metricsFlags.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export const canUseMetricsUI = (organization: Organization) => {
88
};
99

1010
export const canUseMetricsStatsUI = (organization: Organization) => {
11-
return canUseMetricsUI(organization);
11+
return (
12+
canUseMetricsUI(organization) &&
13+
organization.features.includes('explore-dev-features')
14+
);
1215
};
1316

1417
export const canUseMetricsSavedQueriesUI = (organization: Organization) => {

static/app/views/organizationStats/index.spec.tsx

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,9 @@ describe('OrganizationStats', () => {
545545
).not.toBeInTheDocument();
546546
});
547547

548-
it('shows Metrics category when tracemetrics-enabled feature flag is enabled', async () => {
548+
it('shows Metrics category when tracemetrics-enabled and explore-dev-features flags are enabled', async () => {
549549
const newOrg = OrganizationFixture({
550-
features: ['team-insights', 'tracemetrics-enabled'],
550+
features: ['team-insights', 'tracemetrics-enabled', 'explore-dev-features'],
551551
});
552552

553553
render(<OrganizationStats />, {
@@ -558,6 +558,47 @@ describe('OrganizationStats', () => {
558558
expect(screen.getByRole('option', {name: 'Metrics'})).toBeInTheDocument();
559559
});
560560

561+
it('does not show Metrics category without explore-dev-features flag', async () => {
562+
const newOrg = OrganizationFixture({
563+
features: ['team-insights', 'tracemetrics-enabled'],
564+
});
565+
566+
render(<OrganizationStats />, {
567+
organization: newOrg,
568+
});
569+
570+
await userEvent.click(await screen.findByText('Category'));
571+
expect(screen.queryByRole('option', {name: 'Metrics'})).not.toBeInTheDocument();
572+
});
573+
574+
it('shows Application Metrics category when tracemetrics-stats-bytes-ui flag is enabled', async () => {
575+
const newOrg = OrganizationFixture({
576+
features: ['team-insights', 'tracemetrics-enabled', 'tracemetrics-stats-bytes-ui'],
577+
});
578+
579+
render(<OrganizationStats />, {
580+
organization: newOrg,
581+
});
582+
583+
await userEvent.click(await screen.findByText('Category'));
584+
expect(screen.getByRole('option', {name: 'Application Metrics'})).toBeInTheDocument();
585+
});
586+
587+
it('does not show Application Metrics category without tracemetrics-stats-bytes-ui flag', async () => {
588+
const newOrg = OrganizationFixture({
589+
features: ['team-insights', 'tracemetrics-enabled'],
590+
});
591+
592+
render(<OrganizationStats />, {
593+
organization: newOrg,
594+
});
595+
596+
await userEvent.click(await screen.findByText('Category'));
597+
expect(
598+
screen.queryByRole('option', {name: 'Application Metrics'})
599+
).not.toBeInTheDocument();
600+
});
601+
561602
it('denies access on no projects', async () => {
562603
act(() => ProjectsStore.loadInitialData([]));
563604

0 commit comments

Comments
 (0)