@@ -3,11 +3,12 @@ import styled from '@emotion/styled';
3
3
4
4
import ProjectBadge from 'sentry/components/idBadge/projectBadge' ;
5
5
import LoadingIndicator from 'sentry/components/loadingIndicator' ;
6
+ import { IconWarning } from 'sentry/icons' ;
6
7
import { t } from 'sentry/locale' ;
7
8
import { space } from 'sentry/styles/space' ;
8
9
import type { MetricMeta , Project } from 'sentry/types' ;
9
10
import { getReadableMetricType } from 'sentry/utils/metrics/formatters' ;
10
- import { formatMRI } from 'sentry/utils/metrics/mri' ;
11
+ import { formatMRI , parseMRI } from 'sentry/utils/metrics/mri' ;
11
12
import {
12
13
getMetricsTagsQueryKey ,
13
14
useMetricsTags ,
@@ -27,6 +28,7 @@ export function MetricListItemDetails({
27
28
} ) {
28
29
const organization = useOrganization ( ) ;
29
30
const queryClient = useQueryClient ( ) ;
31
+ const isCustomMetric = parseMRI ( metric . mri ) ?. useCase === 'custom' ;
30
32
31
33
const projectIds = useMemo (
32
34
( ) => selectedProjects . map ( project => parseInt ( project . id , 10 ) ) ,
@@ -71,9 +73,15 @@ export function MetricListItemDetails({
71
73
< MetricName >
72
74
{ /* Add zero width spaces at delimiter characters for nice word breaks */ }
73
75
{ 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
+ ) }
74
82
</ MetricName >
75
83
< DetailsGrid >
76
- < DetailsLabel > Project</ DetailsLabel >
84
+ < DetailsLabel > { t ( ' Project' ) } </ DetailsLabel >
77
85
< DetailsValue >
78
86
{ truncatedProjects . map ( project => (
79
87
< ProjectBadge
@@ -87,11 +95,11 @@ export function MetricListItemDetails({
87
95
< span > { t ( '+%d more' , metricProjects . length - MAX_PROJECTS_TO_SHOW ) } </ span >
88
96
) }
89
97
</ DetailsValue >
90
- < DetailsLabel > Type</ DetailsLabel >
98
+ < DetailsLabel > { t ( ' Type' ) } </ DetailsLabel >
91
99
< DetailsValue > { getReadableMetricType ( metric . type ) } </ DetailsValue >
92
- < DetailsLabel > Unit</ DetailsLabel >
100
+ < DetailsLabel > { t ( ' Unit' ) } </ DetailsLabel >
93
101
< DetailsValue > { metric . unit } </ DetailsValue >
94
- < DetailsLabel > Tags</ DetailsLabel >
102
+ < DetailsLabel > { t ( ' Tags' ) } </ DetailsLabel >
95
103
< DetailsValue >
96
104
{ tagsIsLoading || ! isQueryEnabled ? (
97
105
< StyledLoadingIndicator mini size = { 12 } />
@@ -153,3 +161,12 @@ const DetailsValue = styled('div')`
153
161
border-bottom-right-radius: ${ p => p . theme . borderRadius } ;
154
162
min-width: 0;
155
163
` ;
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