|
1 | 1 | 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'; |
2 | 7 |
|
3 | 8 | import {getEscapedKey} from 'sentry/components/core/compactSelect/utils'; |
4 | 9 | import {ASK_SEER_CONSENT_ITEM_KEY} from 'sentry/components/searchQueryBuilder/askSeer/askSeerConsentOption'; |
@@ -28,6 +33,7 @@ import { |
28 | 33 | getKeyLabel as getFilterKeyLabel, |
29 | 34 | getKeyName, |
30 | 35 | } from 'sentry/components/searchSyntax/utils'; |
| 36 | +import {IconSentry} from 'sentry/icons'; |
31 | 37 | import {t} from 'sentry/locale'; |
32 | 38 | import type {RecentSearch, Tag, TagCollection} from 'sentry/types/group'; |
33 | 39 | import {defined} from 'sentry/utils'; |
@@ -102,15 +108,38 @@ export function createSection( |
102 | 108 | export function createItem( |
103 | 109 | tag: Tag, |
104 | 110 | fieldDefinition: FieldDefinition | null, |
105 | | - section?: FilterKeySection |
| 111 | + section?: FilterKeySection, |
| 112 | + hasSentryConventions?: boolean |
106 | 113 | ): KeyItem { |
107 | 114 | const description = fieldDefinition?.desc; |
108 | 115 |
|
109 | 116 | const key = section ? `${section.value}:${tag.key}` : tag.key; |
110 | 117 |
|
| 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 | + |
111 | 131 | return { |
112 | 132 | 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 | + ), |
114 | 143 | description: description ?? '', |
115 | 144 | value: tag.key, |
116 | 145 | textValue: tag.key, |
|
0 commit comments