Skip to content

Commit 292a014

Browse files
committed
👔 Conditionally render Sentry icon
1 parent e2edc3f commit 292a014

File tree

1 file changed

+31
-2
lines changed
  • static/app/components/searchQueryBuilder/tokens/filterKeyListBox

1 file changed

+31
-2
lines changed

static/app/components/searchQueryBuilder/tokens/filterKeyListBox/utils.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import styled from '@emotion/styled';
2+
import {ATTRIBUTE_METADATA} from '@sentry/conventions';
3+
import * as Sentry from '@sentry/react';
4+
5+
import {Flex} from '@sentry/scraps/layout';
6+
import {Text} from '@sentry/scraps/text';
27

38
import {getEscapedKey} from 'sentry/components/core/compactSelect/utils';
49
import {ASK_SEER_CONSENT_ITEM_KEY} from 'sentry/components/searchQueryBuilder/askSeer/askSeerConsentOption';
@@ -28,6 +33,7 @@ import {
2833
getKeyLabel as getFilterKeyLabel,
2934
getKeyName,
3035
} from 'sentry/components/searchSyntax/utils';
36+
import {IconSentry} from 'sentry/icons';
3137
import {t} from 'sentry/locale';
3238
import type {RecentSearch, Tag, TagCollection} from 'sentry/types/group';
3339
import {defined} from 'sentry/utils';
@@ -102,15 +108,38 @@ export function createSection(
102108
export function createItem(
103109
tag: Tag,
104110
fieldDefinition: FieldDefinition | null,
105-
section?: FilterKeySection
111+
section?: FilterKeySection,
112+
hasSentryConventions?: boolean
106113
): KeyItem {
107114
const description = fieldDefinition?.desc;
108115

109116
const key = section ? `${section.value}:${tag.key}` : tag.key;
110117

118+
let isSentryAttribute = false;
119+
if (hasSentryConventions) {
120+
isSentryAttribute = defined(
121+
ATTRIBUTE_METADATA?.[tag.key as keyof typeof ATTRIBUTE_METADATA]
122+
);
123+
// while we're rolling this out, we can keep track to see if we're missing any attributes.
124+
Sentry.logger.info(
125+
isSentryAttribute
126+
? Sentry.logger.fmt`${tag.key} is a sentry attribute`
127+
: Sentry.logger.fmt`${tag.key} is not a sentry attribute`
128+
);
129+
}
130+
111131
return {
112132
key: getEscapedKey(key),
113-
label: getKeyLabel(tag, fieldDefinition),
133+
label: (
134+
<Flex align="center" gap="xs">
135+
{props => (
136+
<Text {...props}>
137+
{getKeyLabel(tag, fieldDefinition)}
138+
{isSentryAttribute ? <IconSentry data-testid="sentry-icon" /> : null}
139+
</Text>
140+
)}
141+
</Flex>
142+
),
114143
description: description ?? '',
115144
value: tag.key,
116145
textValue: tag.key,

0 commit comments

Comments
 (0)