Skip to content

Commit c5a26ed

Browse files
nsdeschenesclaude
andauthored
chore(tracemetrics): Cleanup side panel feature flag (#112105)
Now that this flag has been fully rolled out, lets do some tidying up by removing it, and defaulting to the side panel experience. Ticket: LOGS-600 --------- Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>
1 parent 26dd06e commit c5a26ed

File tree

4 files changed

+50
-152
lines changed

4 files changed

+50
-152
lines changed

static/app/views/dashboards/widgetBuilder/components/visualize/traceMetrics/metricSelectRow.spec.tsx

Lines changed: 22 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ describe('MetricSelectRow', () => {
2323
mockNavigate = jest.fn();
2424
mockedUseNavigate.mockReturnValue(mockNavigate);
2525

26+
MockApiClient.addMockResponse({
27+
url: '/organizations/org-slug/trace-items/attributes/',
28+
method: 'GET',
29+
body: [],
30+
});
31+
2632
MockApiClient.addMockResponse({
2733
url: '/organizations/org-slug/events/',
2834
body: {
@@ -37,13 +43,29 @@ describe('MetricSelectRow', () => {
3743
['metric.type']: 'counter',
3844
['count(metric.name)']: 1,
3945
},
46+
{
47+
['metric.name']: 'counter_metric',
48+
['metric.type']: 'counter',
49+
['count(metric.name)']: 1,
50+
},
51+
{
52+
['metric.name']: 'distribution_metric',
53+
['metric.type']: 'distribution',
54+
['count(metric.name)']: 1,
55+
},
56+
{
57+
['metric.name']: 'gauge_metric',
58+
['metric.type']: 'gauge',
59+
['count(metric.name)']: 1,
60+
},
4061
],
4162
},
4263
});
4364
});
4465

4566
afterEach(() => {
4667
jest.clearAllMocks();
68+
MockApiClient.clearMockResponses();
4769
});
4870

4971
it('renders the same metric for all rows', async () => {
@@ -165,25 +187,6 @@ describe('MetricSelectRow', () => {
165187
});
166188

167189
it('replaces invalid aggregates when changing to an incompatible metric type', async () => {
168-
MockApiClient.clearMockResponses();
169-
MockApiClient.addMockResponse({
170-
url: '/organizations/org-slug/events/',
171-
body: {
172-
data: [
173-
{
174-
['metric.name']: 'distribution_metric',
175-
['metric.type']: 'distribution',
176-
['count(metric.name)']: 1,
177-
},
178-
{
179-
['metric.name']: 'counter_metric',
180-
['metric.type']: 'counter',
181-
['count(metric.name)']: 1,
182-
},
183-
],
184-
},
185-
});
186-
187190
render(
188191
<WidgetBuilderProvider>
189192
<MetricSelectRow
@@ -248,25 +251,6 @@ describe('MetricSelectRow', () => {
248251
});
249252

250253
it('preserves valid aggregates when changing metric type', async () => {
251-
MockApiClient.clearMockResponses();
252-
MockApiClient.addMockResponse({
253-
url: '/organizations/org-slug/events/',
254-
body: {
255-
data: [
256-
{
257-
['metric.name']: 'counter_metric',
258-
['metric.type']: 'counter',
259-
['count(metric.name)']: 1,
260-
},
261-
{
262-
['metric.name']: 'distribution_metric',
263-
['metric.type']: 'distribution',
264-
['count(metric.name)']: 1,
265-
},
266-
],
267-
},
268-
});
269-
270254
render(
271255
<WidgetBuilderProvider>
272256
<MetricSelectRow
@@ -331,25 +315,6 @@ describe('MetricSelectRow', () => {
331315
});
332316

333317
it('handles mixed valid and invalid aggregates on metric change', async () => {
334-
MockApiClient.clearMockResponses();
335-
MockApiClient.addMockResponse({
336-
url: '/organizations/org-slug/events/',
337-
body: {
338-
data: [
339-
{
340-
['metric.name']: 'distribution_metric',
341-
['metric.type']: 'distribution',
342-
['count(metric.name)']: 1,
343-
},
344-
{
345-
['metric.name']: 'counter_metric',
346-
['metric.type']: 'counter',
347-
['count(metric.name)']: 1,
348-
},
349-
],
350-
},
351-
});
352-
353318
render(
354319
<WidgetBuilderProvider>
355320
<MetricSelectRow
@@ -438,25 +403,6 @@ describe('MetricSelectRow', () => {
438403
});
439404

440405
it('replaces invalid aggregates for big number display', async () => {
441-
MockApiClient.clearMockResponses();
442-
MockApiClient.addMockResponse({
443-
url: '/organizations/org-slug/events/',
444-
body: {
445-
data: [
446-
{
447-
['metric.name']: 'gauge_metric',
448-
['metric.type']: 'gauge',
449-
['count(metric.name)']: 1,
450-
},
451-
{
452-
['metric.name']: 'counter_metric',
453-
['metric.type']: 'counter',
454-
['count(metric.name)']: 1,
455-
},
456-
],
457-
},
458-
});
459-
460406
render(
461407
<WidgetBuilderProvider>
462408
<MetricSelectRow
@@ -519,24 +465,6 @@ describe('MetricSelectRow', () => {
519465
});
520466

521467
it('uses avg for gauge metrics', async () => {
522-
MockApiClient.clearMockResponses();
523-
MockApiClient.addMockResponse({
524-
url: '/organizations/org-slug/events/',
525-
body: {
526-
data: [
527-
{
528-
['metric.name']: 'gauge_metric',
529-
['metric.type']: 'gauge',
530-
['count(metric.name)']: 1,
531-
},
532-
{
533-
['metric.name']: 'distribution_metric',
534-
['metric.type']: 'distribution',
535-
['count(metric.name)']: 1,
536-
},
537-
],
538-
},
539-
});
540468
render(
541469
<WidgetBuilderProvider>
542470
<MetricSelectRow

static/app/views/explore/metrics/metricToolbar/metricSelector.spec.tsx

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ describe('MetricSelector', () => {
5050
{key: 'release', type: 'string'},
5151
],
5252
});
53+
54+
MockApiClient.addMockResponse({
55+
url: `/organizations/${organization.slug}/trace-items/attributes/`,
56+
method: 'GET',
57+
body: [
58+
{key: 'device.name', type: 'string'},
59+
{key: 'release', type: 'string'},
60+
],
61+
});
5362
});
5463

5564
afterEach(() => {
@@ -296,6 +305,14 @@ describe('MetricSelector', () => {
296305

297306
// Simulate search that narrows the list by re-mocking with fewer results
298307
MockApiClient.clearMockResponses();
308+
MockApiClient.addMockResponse({
309+
url: `/organizations/${organization.slug}/trace-items/attributes/`,
310+
method: 'GET',
311+
body: [
312+
{key: 'device.name', type: 'string'},
313+
{key: 'release', type: 'string'},
314+
],
315+
});
299316
setupEventsMock(
300317
createTraceMetricFixtures(organization, project, new Date()).baseFixtures.slice(
301318
0,
@@ -441,28 +458,11 @@ describe('MetricSelector', () => {
441458
expect(within(requestCountOption).queryByText('none')).not.toBeInTheDocument();
442459
});
443460

444-
it('does not show side panel without tracemetrics-attributes-dropdown-side-panel feature', async () => {
461+
it('renders side panel', async () => {
445462
render(<MetricSelector traceMetric={DEFAULT_TRACE_METRIC} onChange={jest.fn()} />, {
446463
organization,
447464
});
448465

449-
await userEvent.click(screen.getByRole('button', {name: 'bar'}));
450-
await screen.findByRole('option', {name: 'bar'});
451-
452-
expect(screen.queryByText('Type')).not.toBeInTheDocument();
453-
});
454-
455-
it('renders side panel with tracemetrics-attributes-dropdown-side-panel feature', async () => {
456-
render(<MetricSelector traceMetric={DEFAULT_TRACE_METRIC} onChange={jest.fn()} />, {
457-
organization: {
458-
...organization,
459-
features: [
460-
...organization.features,
461-
'tracemetrics-attributes-dropdown-side-panel',
462-
],
463-
},
464-
});
465-
466466
await userEvent.click(screen.getByRole('button', {name: 'bar'}));
467467
await userEvent.hover(await screen.findByRole('option', {name: 'bar'}));
468468

@@ -473,13 +473,7 @@ describe('MetricSelector', () => {
473473

474474
it('side panel defaults to current metric when no option is hovered', async () => {
475475
render(<MetricSelector traceMetric={DEFAULT_TRACE_METRIC} onChange={jest.fn()} />, {
476-
organization: {
477-
...organization,
478-
features: [
479-
...organization.features,
480-
'tracemetrics-attributes-dropdown-side-panel',
481-
],
482-
},
476+
organization,
483477
});
484478

485479
await userEvent.click(screen.getByRole('button', {name: 'bar'}));
@@ -491,13 +485,7 @@ describe('MetricSelector', () => {
491485

492486
it('shows attributes section in side panel', async () => {
493487
render(<MetricSelector traceMetric={DEFAULT_TRACE_METRIC} onChange={jest.fn()} />, {
494-
organization: {
495-
...organization,
496-
features: [
497-
...organization.features,
498-
'tracemetrics-attributes-dropdown-side-panel',
499-
],
500-
},
488+
organization,
501489
});
502490

503491
await userEvent.click(screen.getByRole('button', {name: 'bar'}));
@@ -509,13 +497,7 @@ describe('MetricSelector', () => {
509497

510498
it('side panel updates when hovering over a different metric option', async () => {
511499
render(<MetricSelector traceMetric={DEFAULT_TRACE_METRIC} onChange={jest.fn()} />, {
512-
organization: {
513-
...organization,
514-
features: [
515-
...organization.features,
516-
'tracemetrics-attributes-dropdown-side-panel',
517-
],
518-
},
500+
organization,
519501
});
520502

521503
await userEvent.click(screen.getByRole('button', {name: 'bar'}));

static/app/views/explore/metrics/metricToolbar/metricSelector.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ import {useMetricOptions} from 'sentry/views/explore/hooks/useMetricOptions';
3232
import {HiddenTraceMetricGroupByFields} from 'sentry/views/explore/metrics/constants';
3333
import {useHasMetricUnitsUI} from 'sentry/views/explore/metrics/hooks/useHasMetricUnitsUI';
3434
import type {TraceMetric} from 'sentry/views/explore/metrics/metricQuery';
35-
import {
36-
canUseMetricsSidePanelUI,
37-
canUseMetricsUIRefresh,
38-
} from 'sentry/views/explore/metrics/metricsFlags';
35+
import {canUseMetricsUIRefresh} from 'sentry/views/explore/metrics/metricsFlags';
3936
import {MetricTypeBadge} from 'sentry/views/explore/metrics/metricToolbar/metricOptionLabel';
4037
import {
4138
TraceMetricKnownFieldKey,
@@ -557,14 +554,12 @@ export function MetricSelector({
557554
)}
558555
</Container>
559556
</Stack>
560-
{canUseMetricsSidePanelUI(organization) ? (
561-
<Container width={{sm: '280px'}} padding="lg" minHeight={{sm: '200px'}}>
562-
<MetricDetailPanel
563-
metric={highlightedOption ?? optionFromTraceMetric}
564-
hasMetricUnitsUI={hasMetricUnitsUI}
565-
/>
566-
</Container>
567-
) : null}
557+
<Container width={{sm: '280px'}} padding="lg" minHeight={{sm: '200px'}}>
558+
<MetricDetailPanel
559+
metric={highlightedOption ?? optionFromTraceMetric}
560+
hasMetricUnitsUI={hasMetricUnitsUI}
561+
/>
562+
</Container>
568563
</Flex>
569564
</FocusScope>
570565
</Overlay>

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ export const canUseMetricsAlertsUI = (organization: Organization) => {
2121
);
2222
};
2323

24-
export const canUseMetricsSidePanelUI = (organization: Organization) => {
25-
return (
26-
canUseMetricsUI(organization) &&
27-
organization.features.includes('tracemetrics-attributes-dropdown-side-panel')
28-
);
29-
};
30-
3124
export const canUseMetricsUIRefresh = (organization: Organization) => {
3225
return (
3326
canUseMetricsUI(organization) &&

0 commit comments

Comments
 (0)