Skip to content

Commit 70bd245

Browse files
authored
ref(✂️): remove unused code from explore (#90147)
1 parent 6b072c1 commit 70bd245

File tree

11 files changed

+6
-169
lines changed

11 files changed

+6
-169
lines changed

static/app/components/modals/explore/saveQueryModal.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {Fragment, useCallback, useState} from 'react';
2-
import {css} from '@emotion/react';
32
import styled from '@emotion/styled';
43
import * as Sentry from '@sentry/react';
54

@@ -209,11 +208,6 @@ const StyledButtonBar = styled(ButtonBar)`
209208
}
210209
`;
211210

212-
export const modalCss = css`
213-
max-width: 700px;
214-
margin: 70px auto;
215-
`;
216-
217211
const SectionHeader = styled('h6')`
218212
font-size: ${p => p.theme.form.md.fontSize};
219213
margin-bottom: ${space(0.5)};

static/app/components/quickTrace/utils.tsx

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type {
1818
TracePerformanceIssue,
1919
} from 'sentry/utils/performance/quickTrace/types';
2020
import {getTraceTimeRangeFromEvent} from 'sentry/utils/performance/quickTrace/utils';
21-
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
2221
import {hasDatasetSelector} from 'sentry/views/dashboards/utils';
2322
import type {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHeader/breadcrumbs';
2423
import type {TraceTree} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
@@ -85,41 +84,6 @@ export function generateSingleErrorTarget(
8584
}
8685
}
8786

88-
export function generateMultiTransactionsTarget(
89-
currentEvent: Event,
90-
events: EventLite[],
91-
organization: Organization,
92-
groupType: 'Ancestor' | 'Children' | 'Descendant'
93-
): LocationDescriptor {
94-
const queryResults = new MutableSearch([]);
95-
const eventIds = events.map(child => child.event_id);
96-
for (let i = 0; i < eventIds.length; i++) {
97-
queryResults.addOp(i === 0 ? '(' : 'OR');
98-
queryResults.addFreeText(`id:${eventIds[i]}`);
99-
if (i === eventIds.length - 1) {
100-
queryResults.addOp(')');
101-
}
102-
}
103-
104-
const {start, end} = getTraceTimeRangeFromEvent(currentEvent);
105-
const traceEventView = EventView.fromSavedQuery({
106-
id: undefined,
107-
name: `${groupType} Transactions of Event ID ${currentEvent.id}`,
108-
fields: ['transaction', 'project', 'trace.span', 'transaction.duration', 'timestamp'],
109-
orderby: '-timestamp',
110-
query: queryResults.formatString(),
111-
projects: [...new Set(events.map(child => child.project_id))],
112-
version: 2,
113-
start,
114-
end,
115-
});
116-
return traceEventView.getResultsViewUrlTarget(
117-
organization,
118-
false,
119-
hasDatasetSelector(organization) ? SavedQueryDatasets.TRANSACTIONS : undefined
120-
);
121-
}
122-
12387
const timestampsFieldCandidates = [
12488
'dateCreated',
12589
'startTimestamp',

static/app/views/explore/components/table.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ import {
1313
GridHead,
1414
GridHeadCell,
1515
GridRow,
16-
Header,
17-
HeaderButtonContainer,
18-
HeaderTitle,
1916
} from 'sentry/components/gridEditable/styles';
2017
import {space} from 'sentry/styles/space';
2118
import {defined} from 'sentry/utils';
@@ -164,9 +161,6 @@ export const TableRow = GridRow;
164161
export const TableBodyCell = GridBodyCell;
165162

166163
export const TableHead = GridHead;
167-
export const TableHeader = Header;
168-
export const TableHeaderActions = HeaderButtonContainer;
169-
export const TableHeaderTitle = HeaderTitle;
170164
export const TableHeadCell = styled(GridHeadCell)<{align?: Alignments}>`
171165
${p => p.align && `justify-content: ${p.align};`}
172166
`;

static/app/views/explore/contexts/traceItemAttributeContext.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type TypedTraceItemAttributesStatus = {
2323
type TypedTraceItemAttributesResult = TypedTraceItemAttributes &
2424
TypedTraceItemAttributesStatus;
2525

26-
export const TraceItemAttributeContext = createContext<
26+
const TraceItemAttributeContext = createContext<
2727
TypedTraceItemAttributesResult | undefined
2828
>(undefined);
2929

@@ -120,13 +120,6 @@ export function useTraceItemAttributes(type?: 'number' | 'string') {
120120
};
121121
}
122122

123-
export function useTraceItemAttribute(key: string) {
124-
const {attributes: numberAttributes} = useTraceItemAttributes('number');
125-
const {attributes: stringAttributes} = useTraceItemAttributes('string');
126-
127-
return stringAttributes[key] ?? numberAttributes[key] ?? null;
128-
}
129-
130123
function getDefaultStringAttributes(itemType: TraceItemDataset) {
131124
if (itemType === TraceItemDataset.SPANS) {
132125
return SENTRY_SPAN_STRING_TAGS;

static/app/views/explore/logs/styles.tsx

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from 'sentry/views/explore/components/table';
1717
import {SeverityLevel} from 'sentry/views/explore/logs/utils';
1818

19-
export const StyledPanel = styled(Panel)`
19+
const StyledPanel = styled(Panel)`
2020
margin-bottom: 0;
2121
`;
2222

@@ -25,27 +25,6 @@ export const LogDetailPanelItem = styled(PanelItem)`
2525
display: auto;
2626
`;
2727

28-
export const StyledPanelItem = styled(PanelItem)<{
29-
align?: 'left' | 'center' | 'right';
30-
overflow?: boolean;
31-
span?: number;
32-
}>`
33-
align-items: center;
34-
padding: ${space(1)} ${space(1)};
35-
${p => (p.align === 'left' ? 'justify-content: flex-start;' : null)}
36-
${p => (p.align === 'right' ? 'justify-content: flex-end;' : null)}
37-
${p => (p.overflow ? p.theme.overflowEllipsis : null)};
38-
${p =>
39-
p.align === 'center'
40-
? `
41-
justify-content: space-around;`
42-
: p.align === 'left' || p.align === 'right'
43-
? `text-align: ${p.align};`
44-
: undefined}
45-
${p => p.span && `grid-column: auto / span ${p.span};`}
46-
white-space: nowrap;
47-
`;
48-
4928
export const LogTableRow = styled(TableRow)`
5029
&:not(thead > &) {
5130
cursor: pointer;
@@ -117,12 +96,6 @@ export const DetailsContent = styled(StyledPanel)`
11796
padding: ${space(1)} ${space(2)};
11897
`;
11998

120-
export const LogDetailsTitle = styled('div')`
121-
font-size: ${p => p.theme.fontSizeLarge};
122-
font-weight: ${p => p.theme.fontWeightBold};
123-
user-select: none;
124-
`;
125-
12699
export const LogFirstCellContent = styled('div')`
127100
display: flex;
128101
align-items: center;

static/app/views/explore/logs/utils.tsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as Sentry from '@sentry/react';
33
import {t} from 'sentry/locale';
44
import type {TagCollection} from 'sentry/types/group';
55
import {defined} from 'sentry/utils';
6-
import type {TableDataRow} from 'sentry/utils/discover/discoverQuery';
76
import type {EventsMetaType} from 'sentry/utils/discover/eventView';
87
import {
98
type ColumnValueType,
@@ -13,7 +12,6 @@ import {
1312
prettifyTagKey,
1413
} from 'sentry/utils/discover/fields';
1514
import type {MutableSearch} from 'sentry/utils/tokenizeSearch';
16-
import type {TableColumn} from 'sentry/views/discover/table/types';
1715
import {LogAttributesHumanLabel} from 'sentry/views/explore/logs/constants';
1816
import {
1917
type LogAttributeItem,
@@ -165,7 +163,7 @@ export function getTableHeaderLabel(
165163
);
166164
}
167165

168-
export function isLogAttributeUnit(unit: string | null): unit is LogAttributeUnits {
166+
function isLogAttributeUnit(unit: string | null): unit is LogAttributeUnits {
169167
return (
170168
unit === null ||
171169
Object.values(DurationUnit).includes(unit as DurationUnit) ||
@@ -205,21 +203,6 @@ export function getLogAttributeItem(
205203
};
206204
}
207205

208-
export function logRowItemToTableColumn(
209-
item: LogRowItem
210-
): TableColumn<keyof TableDataRow> {
211-
return {
212-
key: item.fieldKey,
213-
name: item.fieldKey,
214-
column: {
215-
field: item.fieldKey,
216-
kind: 'field',
217-
},
218-
isSortable: false,
219-
type: item.metaFieldType,
220-
};
221-
}
222-
223206
export function adjustLogTraceID(traceID: string) {
224207
return traceID.replace(/-/g, '');
225208
}

static/app/views/explore/multiQueryMode/queryVisualizations/chart.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ interface MultiQueryChartProps {
5353
samplingMode?: SamplingMode;
5454
}
5555

56-
export const EXPLORE_CHART_GROUP = 'multi-query-charts_group';
57-
5856
export function MultiQueryModeChart({
5957
index,
6058
query: queryParts,

static/app/views/explore/tables/tracesTable/fieldRenderers.tsx

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import type {SpanResult} from 'sentry/views/explore/hooks/useTraceSpans';
2626
import type {SpanIndexedField, SpanIndexedResponse} from 'sentry/views/insights/types';
2727
import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHeader/breadcrumbs';
2828
import {getTraceDetailsUrl} from 'sentry/views/performance/traceDetails/utils';
29-
import {transactionSummaryRouteWithQuery} from 'sentry/views/performance/transactionSummary/utils';
3029

3130
import type {Field} from './data';
3231
import {getShortenedSdkName, getStylingSliceName} from './utils';
@@ -171,7 +170,7 @@ interface ProjectRendererProps {
171170
hideName?: boolean;
172171
}
173172

174-
export function ProjectRenderer({projectSlug, hideName}: ProjectRendererProps) {
173+
function ProjectRenderer({projectSlug, hideName}: ProjectRendererProps) {
175174
const organization = useOrganization();
176175

177176
return (
@@ -469,32 +468,6 @@ export function TraceIdRenderer({
469468
);
470469
}
471470

472-
interface TransactionRendererProps {
473-
projectSlug: string;
474-
transaction: string;
475-
}
476-
477-
export function TransactionRenderer({
478-
projectSlug,
479-
transaction,
480-
}: TransactionRendererProps) {
481-
const location = useLocation();
482-
const organization = useOrganization();
483-
const {projects} = useProjects({slugs: [projectSlug]});
484-
485-
const target = transactionSummaryRouteWithQuery({
486-
organization,
487-
transaction,
488-
query: {
489-
...location.query,
490-
query: undefined,
491-
},
492-
projectID: String(projects[0]?.id ?? ''),
493-
});
494-
495-
return <Link to={target}>{transaction}</Link>;
496-
}
497-
498471
export function SpanTimeRenderer({
499472
timestamp,
500473
tooltipShowSeconds,
@@ -544,7 +517,7 @@ const OMITTED_SPAN_STATUS = ['unknown'];
544517
/**
545518
* This display a tag for the status (not to be confused with 'status_code' which has values like '200', '429').
546519
*/
547-
export function StatusTag({status, onClick}: {status: string; onClick?: () => void}) {
520+
function StatusTag({status, onClick}: {status: string; onClick?: () => void}) {
548521
const tagType = statusToTagType(status);
549522

550523
if (!tagType) {

static/app/views/explore/tables/tracesTable/utils.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
import type {TraceResult} from 'sentry/views/explore/hooks/useTraces';
21
import type {SpanResult} from 'sentry/views/explore/hooks/useTraceSpans';
32

43
import type {Field} from './data';
54

6-
export function normalizeTraces(traces: TraceResult[] | undefined) {
7-
if (!traces) {
8-
return traces;
9-
}
10-
return traces.sort(
11-
// Only sort name == null to the end, the rest leave in the original order.
12-
(t1, t2) => (t1.name ? '0' : '1').localeCompare(t2.name ? '0' : '1')
13-
);
14-
}
15-
165
export function getStylingSliceName(
176
sliceName: string | null,
187
sliceSecondaryName: string | null
@@ -25,21 +14,6 @@ export function getStylingSliceName(
2514
return sliceName;
2615
}
2716

28-
export function areQueriesEmpty(queries: string[]): boolean {
29-
if (queries.length > 1) {
30-
return false;
31-
}
32-
if (queries.length === 0) {
33-
return true;
34-
}
35-
36-
if (queries.length === 1) {
37-
return queries[0]!.length === 0;
38-
}
39-
40-
return false;
41-
}
42-
4317
export function getSecondaryNameFromSpan(span: SpanResult<Field>) {
4418
return span['sdk.name'];
4519
}

static/app/views/explore/utils.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export function getExploreUrlFromSavedQueryUrl({
126126
});
127127
}
128128

129-
export function getExploreMultiQueryUrl({
129+
function getExploreMultiQueryUrl({
130130
organization,
131131
selection,
132132
interval,
@@ -274,13 +274,6 @@ export function limitMaxPickableDays(organization: Organization): {
274274
};
275275
}
276276

277-
export function showConfidence(isSampled: boolean | null | undefined) {
278-
if (defined(isSampled) && isSampled === false) {
279-
return false;
280-
}
281-
return true;
282-
}
283-
284277
export function getDefaultExploreRoute(organization: Organization) {
285278
if (organization.features.includes('performance-trace-explorer')) {
286279
return 'traces';

static/app/views/traces/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import Redirect from 'sentry/components/redirect';
55
import useOrganization from 'sentry/utils/useOrganization';
66
import {useRedirectNavV2Routes} from 'sentry/views/nav/useRedirectNavV2Routes';
77

8-
export const TRACE_EXPLORER_DOCS_URL = 'https://docs.sentry.io/product/explore/traces/';
9-
108
interface Props {
119
children: React.ReactNode;
1210
}

0 commit comments

Comments
 (0)