Skip to content

Commit

Permalink
chore(metrics): remove DDM references (#68898)
Browse files Browse the repository at this point in the history
  • Loading branch information
obostjancic authored Apr 22, 2024
1 parent 52aaf9e commit 57cb0dd
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 91 deletions.
13 changes: 0 additions & 13 deletions static/app/components/assistant/getGuidesContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,6 @@ export default function getGuidesContent(orgSlug: string | null): GuidesContent
},
],
},
{
guide: 'ddm_view',
requiredTargets: ['create_scratchpad'],
steps: [
{
title: t('Save your charts'),
target: 'create_scratchpad',
description: t(
`Scratchpads are stored locally on your device. If you want to share them, simply send the URL to your teammates.`
),
},
],
},
];
}

Expand Down
4 changes: 2 additions & 2 deletions static/app/types/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ type DisabledMemberTooltipProps = {children: React.ReactNode};

type DashboardHeadersProps = {organization: Organization};

type DDMMetricsSamplesListProps = {children: React.ReactNode; organization: Organization};
type MetricsSamplesListProps = {children: React.ReactNode; organization: Organization};

type ReplayFeedbackButton = {children: React.ReactNode};
type ReplayListPageHeaderProps = {children?: React.ReactNode};
Expand Down Expand Up @@ -188,7 +188,7 @@ export type ComponentHooks = {
'component:dashboards-header': () => React.ComponentType<DashboardHeadersProps>;
'component:data-consent-banner': () => React.ComponentType<{source: string}> | null;
'component:data-consent-priority-learn-more': () => React.ComponentType<{}> | null;
'component:ddm-metrics-samples-list': () => React.ComponentType<DDMMetricsSamplesListProps>;
'component:ddm-metrics-samples-list': () => React.ComponentType<MetricsSamplesListProps>;
'component:disabled-app-store-connect-multiple': () => React.ComponentType<DisabledAppStoreConnectMultiple>;
'component:disabled-custom-symbol-sources': () => React.ComponentType<DisabledCustomSymbolSources>;
'component:disabled-member': () => React.ComponentType<DisabledMemberViewProps>;
Expand Down
2 changes: 1 addition & 1 deletion static/app/types/metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface MetricsApiRequestQuery extends MetricsApiRequestMetric {
statsPeriod?: string;
}

export type MetricsDataIntervalLadder = 'ddm' | 'bar' | 'dashboard';
export type MetricsDataIntervalLadder = 'metrics' | 'bar' | 'dashboard';

export type MetricsApiResponse = {
end: string;
Expand Down
7 changes: 1 addition & 6 deletions static/app/utils/metrics/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import {defined} from 'sentry/utils';
import {MRIToField} from 'sentry/utils/metrics/mri';
import type {MetricDisplayType, MetricsQuery} from 'sentry/utils/metrics/types';
import type {Widget, WidgetQuery} from 'sentry/views/dashboards/types';
import {
DashboardWidgetSource,
DisplayType,
WidgetType,
} from 'sentry/views/dashboards/types';
import {DisplayType, WidgetType} from 'sentry/views/dashboards/types';

interface QueryParams extends MetricsQuery {
id?: number;
Expand Down Expand Up @@ -90,7 +86,6 @@ export function getWidgetAsQueryParams(
const {projects} = selection;

return {
source: DashboardWidgetSource.DDM,
start,
end,
statsPeriod: period,
Expand Down
8 changes: 4 additions & 4 deletions static/app/utils/metrics/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {MetricsOperation} from 'sentry/types';
import {
getAbsoluteDateTimeRange,
getDateTimeParams,
getDDMInterval,
getFormattedMQL,
getMetricsInterval,
isFormattedMQL,
} from 'sentry/utils/metrics';

Expand All @@ -14,7 +14,7 @@ describe('getDDMInterval', () => {
const dateTimeObj = {start: '2023-01-01', end: '2023-01-31'};
const useCase = 'sessions';

const result = getDDMInterval(dateTimeObj, useCase);
const result = getMetricsInterval(dateTimeObj, useCase);

expect(result).toBe('2h');
});
Expand All @@ -26,7 +26,7 @@ describe('getDDMInterval', () => {
};
const useCase = 'custom';

const result = getDDMInterval(dateTimeObj, useCase);
const result = getMetricsInterval(dateTimeObj, useCase);

expect(result).toBe('10s');
});
Expand All @@ -35,7 +35,7 @@ describe('getDDMInterval', () => {
const dateTimeObj = {start: '2023-01-01', end: '2023-01-01T01:05:00.000Z'};
const useCase = 'sessions';

const result = getDDMInterval(dateTimeObj, useCase);
const result = getMetricsInterval(dateTimeObj, useCase);

expect(result).toBe('1m');
});
Expand Down
8 changes: 4 additions & 4 deletions static/app/utils/metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function getMetricsUrl(
}

const intervalLadders: Record<MetricsDataIntervalLadder, GranularityLadder> = {
ddm: new GranularityLadder([
metrics: new GranularityLadder([
[SIXTY_DAYS, '1d'],
[THIRTY_DAYS, '2h'],
[TWO_WEEKS, '1h'],
Expand Down Expand Up @@ -129,14 +129,14 @@ const intervalLadders: Record<MetricsDataIntervalLadder, GranularityLadder> = {
};

// Wraps getInterval since other users of this function, and other metric use cases do not have support for 10s granularity
export function getDDMInterval(
export function getMetricsInterval(
datetimeObj: DateTimeObject,
useCase: UseCase,
ladder: MetricsDataIntervalLadder = 'ddm'
ladder: MetricsDataIntervalLadder = 'metrics'
) {
const diffInMinutes = getDiffInMinutes(datetimeObj);

if (diffInMinutes <= ONE_HOUR && useCase === 'custom' && ladder === 'ddm') {
if (diffInMinutes <= ONE_HOUR && useCase === 'custom' && ladder === 'metrics') {
return '10s';
}

Expand Down
2 changes: 1 addition & 1 deletion static/app/utils/metrics/useMetricsQuery.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ describe('getMetricsQueryApiRequestPayload', () => {
};

const result = getMetricsQueryApiRequestPayload([metric], filters, {
intervalLadder: 'ddm',
intervalLadder: 'metrics',
});

expect(result.query).toEqual({
Expand Down
4 changes: 2 additions & 2 deletions static/app/utils/metrics/useMetricsQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {useMemo} from 'react';

import type {PageFilters} from 'sentry/types';
import {parsePeriodToHours} from 'sentry/utils/dates';
import {getDateTimeParams, getDDMInterval} from 'sentry/utils/metrics';
import {getDateTimeParams, getMetricsInterval} from 'sentry/utils/metrics';
import {getUseCaseFromMRI, MRIToField} from 'sentry/utils/metrics/mri';
import {useApiQuery} from 'sentry/utils/queryClient';
import useOrganization from 'sentry/utils/useOrganization';
Expand Down Expand Up @@ -62,7 +62,7 @@ const getQueryInterval = (
intervalLadder?: MetricsDataIntervalLadder
) => {
const useCase = getUseCaseFromMRI(query.mri) ?? 'custom';
return getDDMInterval(datetime, useCase, intervalLadder);
return getMetricsInterval(datetime, useCase, intervalLadder);
};

export function isMetricFormula(
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/alerts/rules/metric/metricRulePresets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function makeDefaultCta({
end: timePeriod.end,
utc: timePeriod.utc,
// 7 days are 9998m in alerts as of a rounding error in the `events-stats` endpoint
// We need to round to 7d here to display it correctly in DDM
// We need to round to 7d here to display it correctly in Metrics
statsPeriod: timePeriod.period === '9998m' ? '7d' : timePeriod.period,
project: projects
.filter(({slug}) => rule.projects.includes(slug))
Expand Down
3 changes: 1 addition & 2 deletions static/app/views/dashboards/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export enum DisplayType {
export enum WidgetType {
DISCOVER = 'discover',
ISSUE = 'issue',
RELEASE = 'metrics', // TODO(ddm): rename RELEASE to 'release', and METRICS to 'metrics'
RELEASE = 'metrics', // TODO(metrics): rename RELEASE to 'release', and METRICS to 'metrics'
METRICS = 'custom-metrics',
}

Expand Down Expand Up @@ -152,5 +152,4 @@ export enum DashboardWidgetSource {
DASHBOARDS = 'dashboards',
LIBRARY = 'library',
ISSUE_DETAILS = 'issueDetail',
DDM = 'ddm',
}
4 changes: 2 additions & 2 deletions static/app/views/dashboards/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export function getWidgetMetricsUrl(
// ensures that My Projects selection is properly handled
const project = selection.projects.length ? selection.projects : [0];

const ddmLocation = getMetricsUrl(organization.slug, {
const metricsLocation = getMetricsUrl(organization.slug, {
...datetime,
project,
environment: selection.environments,
Expand All @@ -429,7 +429,7 @@ export function getWidgetMetricsUrl(
}),
});

return ddmLocation;
return metricsLocation;
}

export function flattenErrors(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ function WidgetCardContextMenu({
}

if (widget.widgetType === WidgetType.METRICS) {
const ddmLocation = getWidgetMetricsUrl(widget, selection, organization);
const metricsLocation = getWidgetMetricsUrl(widget, selection, organization);

menuOptions.push({
key: 'open-in-metrics',
label: t('Open in Metrics'),
to: ddmLocation,
to: metricsLocation,
});
}

Expand Down
1 change: 0 additions & 1 deletion static/app/views/metrics/chart/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export const MetricChart = memo(
}
});

// TODO(ddm): This assumes that all series have the same bucket size
const bucketSize = series[0]?.data[1]?.name - series[0]?.data[0]?.name;
const isSubMinuteBucket = bucketSize < 60_000;
const lastBucketTimestamp = series[0]?.data?.[series[0]?.data?.length - 1]?.name;
Expand Down
1 change: 0 additions & 1 deletion static/app/views/metrics/codeLocations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ const SourceContextWrapper = styled('div')<{isLast?: boolean}>`
word-wrap: break-word;
font-family: ${p => p.theme.text.familyMono};
font-size: ${p => p.theme.fontSizeSmall};
/* TODO(ddm): find out how it is done on the issues page */
line-height: 24px;
min-height: ${space(3)};
white-space: pre;
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/metrics/constants.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const DDM_CHART_GROUP = 'ddm_chart_group';
export const METRIC_CHART_GROUP = 'metric_chart_group';

export const CHART_HEIGHT = 177;
export const MIN_WIDGET_WIDTH = 400;
2 changes: 1 addition & 1 deletion static/app/views/metrics/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const useDefaultQuery = () => {
);
};

export function DDMContextProvider({children}: {children: React.ReactNode}) {
export function MetricsContextProvider({children}: {children: React.ReactNode}) {
const router = useRouter();
const updateQuery = useUpdateQuery();
const {multiChartMode} = useLocationQuery({fields: {multiChartMode: decodeInteger}});
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/metrics/createAlertModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {space} from 'sentry/styles/space';
import type {PageFilters, Project} from 'sentry/types';
import {parsePeriodToHours, statsPeriodToDays} from 'sentry/utils/dates';
import {
getDDMInterval,
getFieldFromMetricsQuery as getAlertAggregate,
getMetricsInterval,
} from 'sentry/utils/metrics';
import {formatMetricUsingFixedUnit} from 'sentry/utils/metrics/formatters';
import {formatMRIField, getUseCaseFromMRI, parseMRI} from 'sentry/utils/metrics/mri';
Expand Down Expand Up @@ -96,7 +96,7 @@ export function getAlertInterval(
period: TimePeriod
) {
const useCase = getUseCaseFromMRI(metricsQuery.mri) ?? 'custom';
const interval = getDDMInterval(datetime, useCase);
const interval = getMetricsInterval(datetime, useCase);
const inMinutes = parsePeriodToHours(interval) * 60;

function toInterval(timeWindow: TimeWindow) {
Expand Down
6 changes: 3 additions & 3 deletions static/app/views/metrics/metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {t} from 'sentry/locale';
import {trackAnalytics} from 'sentry/utils/analytics';
import {hasCustomMetrics} from 'sentry/utils/metrics/features';
import useOrganization from 'sentry/utils/useOrganization';
import {DDMContextProvider, useMetricsContext} from 'sentry/views/metrics/context';
import {MetricsContextProvider, useMetricsContext} from 'sentry/views/metrics/context';
import {MetricsLayout} from 'sentry/views/metrics/layout';
import {useOptInModal} from 'sentry/views/metrics/optInModal';

Expand Down Expand Up @@ -44,11 +44,11 @@ function Metrics() {

return (
<SentryDocumentTitle title={t('Metrics')} orgSlug={organization.slug}>
<DDMContextProvider>
<MetricsContextProvider>
<WrappedPageFiltersContainer>
<MetricsLayout />
</WrappedPageFiltersContainer>
</DDMContextProvider>
</MetricsContextProvider>
</SentryDocumentTitle>
);
}
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/metrics/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from 'sentry/utils/metrics/types';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import {DDM_CHART_GROUP} from 'sentry/views/metrics/constants';
import {METRIC_CHART_GROUP} from 'sentry/views/metrics/constants';
import {useMetricsContext} from 'sentry/views/metrics/context';
import {EquationSymbol} from 'sentry/views/metrics/equationSymbol';
import {FormulaInput} from 'sentry/views/metrics/formulaInput';
Expand Down Expand Up @@ -48,7 +48,7 @@ export function Queries() {

// Make sure all charts are connected to the same group whenever the widgets definition changes
useLayoutEffect(() => {
echarts.connect(DDM_CHART_GROUP);
echarts.connect(METRIC_CHART_GROUP);
}, [widgets]);

const handleChange = useCallback(
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/metrics/scratchpad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import useRouter from 'sentry/utils/useRouter';
import {DDM_CHART_GROUP, MIN_WIDGET_WIDTH} from 'sentry/views/metrics/constants';
import {METRIC_CHART_GROUP, MIN_WIDGET_WIDTH} from 'sentry/views/metrics/constants';
import {useMetricsContext} from 'sentry/views/metrics/context';
import {useGetCachedChartPalette} from 'sentry/views/metrics/utils/metricsChartPalette';
import {useFormulaDependencies} from 'sentry/views/metrics/utils/useFormulaDependencies';
Expand Down Expand Up @@ -46,7 +46,7 @@ export function MetricScratchpad() {

// Make sure all charts are connected to the same group whenever the widgets definition changes
useLayoutEffect(() => {
echarts.connect(DDM_CHART_GROUP);
echarts.connect(METRIC_CHART_GROUP);
}, [widgets]);

const handleChange = useCallback(
Expand Down
1 change: 0 additions & 1 deletion static/app/views/metrics/summaryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ export const SummaryTable = memo(function SummaryTable({
<TextOverflow>{seriesName}</TextOverflow>
</Tooltip>
</TextOverflowCell>
{/* TODO(ddm): Add a tooltip with the full value, don't add on click in case users want to copy the value */}
<NumberCell>{formatMetricUsingUnit(avg, unit)}</NumberCell>
<NumberCell>{formatMetricUsingUnit(min, unit)}</NumberCell>
<NumberCell>{formatMetricUsingUnit(max, unit)}</NumberCell>
Expand Down
6 changes: 3 additions & 3 deletions static/app/views/metrics/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {updateQueryWithSeriesFilter} from 'sentry/views/metrics/utils';
import {createChartPalette} from 'sentry/views/metrics/utils/metricsChartPalette';
import {useMetricsIntervalParam} from 'sentry/views/metrics/utils/useMetricsIntervalParam';

import {DDM_CHART_GROUP, MIN_WIDGET_WIDTH} from './constants';
import {METRIC_CHART_GROUP, MIN_WIDGET_WIDTH} from './constants';

type MetricWidgetProps = {
displayType: MetricDisplayType;
Expand Down Expand Up @@ -259,7 +259,7 @@ export const MetricWidget = memo(
focusAreaProps={focusAreaProps}
samples={isSelected ? samples : undefined}
chartHeight={chartHeight}
chartGroup={DDM_CHART_GROUP}
chartGroup={METRIC_CHART_GROUP}
queries={queries}
filters={filters}
displayType={displayType}
Expand Down Expand Up @@ -420,7 +420,7 @@ const MetricWidgetBody = memo(
}

if (isMetricFormula(queryToUpdate)) {
// TODO(ddm): filtering on an equation series should extend all conditions of all queries in the equation
// TODO(metrics): filtering on an equation series should extend all conditions of all queries in the equation
return;
}

Expand Down

0 comments on commit 57cb0dd

Please sign in to comment.