Skip to content

Commit bfbcb7f

Browse files
authored
feat(metrics): Show sampling warning for standard metrics (#68968)
- closes #68410
1 parent 3a1f937 commit bfbcb7f

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

static/app/views/metrics/metricListItemDetails.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import styled from '@emotion/styled';
33

44
import ProjectBadge from 'sentry/components/idBadge/projectBadge';
55
import LoadingIndicator from 'sentry/components/loadingIndicator';
6+
import {IconWarning} from 'sentry/icons';
67
import {t} from 'sentry/locale';
78
import {space} from 'sentry/styles/space';
89
import type {MetricMeta, Project} from 'sentry/types';
910
import {getReadableMetricType} from 'sentry/utils/metrics/formatters';
10-
import {formatMRI} from 'sentry/utils/metrics/mri';
11+
import {formatMRI, parseMRI} from 'sentry/utils/metrics/mri';
1112
import {
1213
getMetricsTagsQueryKey,
1314
useMetricsTags,
@@ -27,6 +28,7 @@ export function MetricListItemDetails({
2728
}) {
2829
const organization = useOrganization();
2930
const queryClient = useQueryClient();
31+
const isCustomMetric = parseMRI(metric.mri)?.useCase === 'custom';
3032

3133
const projectIds = useMemo(
3234
() => selectedProjects.map(project => parseInt(project.id, 10)),
@@ -71,9 +73,15 @@ export function MetricListItemDetails({
7173
<MetricName>
7274
{/* Add zero width spaces at delimiter characters for nice word breaks */}
7375
{formatMRI(metric.mri).replaceAll(/([\.\/-_])/g, '\u200b$1')}
76+
{!isCustomMetric && (
77+
<SamplingWarning>
78+
<IconWarning color="yellow400" size="xs" />
79+
{t('Prone to client-side sampling')}
80+
</SamplingWarning>
81+
)}
7482
</MetricName>
7583
<DetailsGrid>
76-
<DetailsLabel>Project</DetailsLabel>
84+
<DetailsLabel>{t('Project')}</DetailsLabel>
7785
<DetailsValue>
7886
{truncatedProjects.map(project => (
7987
<ProjectBadge
@@ -87,11 +95,11 @@ export function MetricListItemDetails({
8795
<span>{t('+%d more', metricProjects.length - MAX_PROJECTS_TO_SHOW)}</span>
8896
)}
8997
</DetailsValue>
90-
<DetailsLabel>Type</DetailsLabel>
98+
<DetailsLabel>{t('Type')}</DetailsLabel>
9199
<DetailsValue>{getReadableMetricType(metric.type)}</DetailsValue>
92-
<DetailsLabel>Unit</DetailsLabel>
100+
<DetailsLabel>{t('Unit')}</DetailsLabel>
93101
<DetailsValue>{metric.unit}</DetailsValue>
94-
<DetailsLabel>Tags</DetailsLabel>
102+
<DetailsLabel>{t('Tags')}</DetailsLabel>
95103
<DetailsValue>
96104
{tagsIsLoading || !isQueryEnabled ? (
97105
<StyledLoadingIndicator mini size={12} />
@@ -153,3 +161,12 @@ const DetailsValue = styled('div')`
153161
border-bottom-right-radius: ${p => p.theme.borderRadius};
154162
min-width: 0;
155163
`;
164+
165+
const SamplingWarning = styled('div')`
166+
display: grid;
167+
gap: ${space(0.25)};
168+
grid-template-columns: max-content 1fr;
169+
font-size: ${p => p.theme.fontSizeSmall};
170+
color: ${p => p.theme.yellow400};
171+
align-items: center;
172+
`;

0 commit comments

Comments
 (0)