Skip to content

Commit f5bd838

Browse files
authored
1 parent 66de876 commit f5bd838

File tree

3 files changed

+57
-18
lines changed

3 files changed

+57
-18
lines changed

static/app/views/explore/components/schemaHints/schemaHintsList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export function parseTagKey(tagKey: string) {
115115
const FILTER_KEY_SECTIONS: Record<SchemaHintsSources, FilterKeySection[]> = {
116116
[SchemaHintsSources.EXPLORE]: SPANS_FILTER_KEY_SECTIONS,
117117
[SchemaHintsSources.LOGS]: LOGS_FILTER_KEY_SECTIONS,
118+
[SchemaHintsSources.AI_GENERATIONS]: SPANS_FILTER_KEY_SECTIONS,
118119
};
119120

120121
function getFilterKeySections(source: SchemaHintsSources) {

static/app/views/explore/components/schemaHints/schemaHintsUtils.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,22 @@ const LOGS_HINT_KEYS = [
3434
OurLogKnownFieldKey.SERVER_ADDRESS,
3535
];
3636

37+
const AI_GENERATIONS_HINT_KEYS = [
38+
SpanFields.GEN_AI_REQUEST_MODEL,
39+
SpanFields.GEN_AI_AGENT_NAME,
40+
SpanFields.GEN_AI_REQUEST_MESSAGES,
41+
SpanFields.GEN_AI_RESPONSE_TEXT,
42+
SpanFields.GEN_AI_RESPONSE_OBJECT,
43+
SpanFields.TRANSACTION,
44+
SpanFields.RELEASE,
45+
];
46+
3747
const SCHEMA_HINTS_LIST_ORDER_KEYS_LOGS = [...new Set([...LOGS_HINT_KEYS])];
3848

49+
const SCHEMA_HINTS_LIST_ORDER_KEYS_AI_GENERATIONS = [
50+
...new Set([...AI_GENERATIONS_HINT_KEYS]),
51+
];
52+
3953
const SCHEMA_HINTS_LIST_ORDER_KEYS_EXPLORE = [
4054
...new Set([...FRONTEND_HINT_KEYS, ...MOBILE_HINT_KEYS, ...COMMON_HINT_KEYS]),
4155
];
@@ -54,12 +68,16 @@ const SCHEMA_HINTS_HIDDEN_KEYS: string[] = [
5468
export enum SchemaHintsSources {
5569
EXPLORE = 'explore',
5670
LOGS = 'logs',
71+
AI_GENERATIONS = 'ai_generations',
5772
}
5873

5974
export const getSchemaHintsListOrder = (source: SchemaHintsSources) => {
6075
if (source === SchemaHintsSources.LOGS) {
6176
return SCHEMA_HINTS_LIST_ORDER_KEYS_LOGS;
6277
}
78+
if (source === SchemaHintsSources.AI_GENERATIONS) {
79+
return SCHEMA_HINTS_LIST_ORDER_KEYS_AI_GENERATIONS;
80+
}
6381

6482
return SCHEMA_HINTS_LIST_ORDER_KEYS_EXPLORE;
6583
};

static/app/views/insights/aiGenerations/views/overview.tsx

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import {withChonk} from 'sentry/utils/theme/withChonk';
2323
import useOrganization from 'sentry/utils/useOrganization';
2424
import usePageFilters from 'sentry/utils/usePageFilters';
2525
import useProjects from 'sentry/utils/useProjects';
26+
import SchemaHintsList from 'sentry/views/explore/components/schemaHints/schemaHintsList';
27+
import {SchemaHintsSources} from 'sentry/views/explore/components/schemaHints/schemaHintsUtils';
2628
import {TableActionButton} from 'sentry/views/explore/components/tableActionButton';
2729
import {useTraceItemTags} from 'sentry/views/explore/contexts/spanTagsContext';
2830
import {TraceItemAttributeProvider} from 'sentry/views/explore/contexts/traceItemAttributeContext';
@@ -43,6 +45,8 @@ import {ModulePageProviders} from 'sentry/views/insights/common/components/modul
4345
import {InsightsProjectSelector} from 'sentry/views/insights/common/components/projectSelector';
4446
import {ModuleName, SpanFields} from 'sentry/views/insights/types';
4547

48+
const DISABLE_AGGREGATES: never[] = [];
49+
4650
function useShowOnboarding() {
4751
const {projects} = useProjects();
4852
const pageFilters = usePageFilters();
@@ -69,10 +73,16 @@ function AIGenerationsPage() {
6973

7074
const [fields, setFields] = useFieldsQueryParam();
7175

72-
const {tags: numberTags, secondaryAliases: numberSecondaryAliases} =
73-
useTraceItemTags('number');
74-
const {tags: stringTags, secondaryAliases: stringSecondaryAliases} =
75-
useTraceItemTags('string');
76+
const {
77+
tags: numberTags,
78+
secondaryAliases: numberSecondaryAliases,
79+
isLoading: numberTagsLoading,
80+
} = useTraceItemTags('number');
81+
const {
82+
tags: stringTags,
83+
secondaryAliases: stringSecondaryAliases,
84+
isLoading: stringTagsLoading,
85+
} = useTraceItemTags('string');
7686

7787
const hasRawSearchReplacement = organization.features.includes(
7888
'search-query-builder-raw-search-replacement'
@@ -137,26 +147,36 @@ function AIGenerationsPage() {
137147
return (
138148
<SearchQueryBuilderProvider {...eapSpanSearchQueryProviderProps}>
139149
<ModuleFeature moduleName={ModuleName.AI_GENERATIONS}>
140-
<Flex
150+
<Stack
151+
direction="column"
141152
gap="md"
142-
wrap="wrap"
153+
borderBottom="muted"
143154
padding={{
144155
xs: 'xl xl xl xl',
145156
md: 'xl 2xl xl 2xl',
146157
}}
147-
borderBottom="muted"
148158
>
149-
<PageFilterBar condensed>
150-
<InsightsProjectSelector />
151-
<InsightsEnvironmentSelector />
152-
<DatePageFilter {...datePageFilterProps} />
153-
</PageFilterBar>
154-
{!showOnboarding && (
155-
<Flex flex={2} minWidth="50%">
156-
<EAPSpanSearchQueryBuilder {...eapSpanSearchQueryBuilderProps} />
157-
</Flex>
158-
)}
159-
</Flex>
159+
<Flex gap="md" wrap="wrap">
160+
<PageFilterBar condensed>
161+
<InsightsProjectSelector />
162+
<InsightsEnvironmentSelector />
163+
<DatePageFilter {...datePageFilterProps} />
164+
</PageFilterBar>
165+
{!showOnboarding && (
166+
<Flex flex={2} minWidth="50%">
167+
<EAPSpanSearchQueryBuilder {...eapSpanSearchQueryBuilderProps} />
168+
</Flex>
169+
)}
170+
</Flex>
171+
<SchemaHintsList
172+
supportedAggregates={DISABLE_AGGREGATES}
173+
numberTags={numberTags}
174+
stringTags={stringTags}
175+
isLoading={numberTagsLoading || stringTagsLoading}
176+
exploreQuery={searchQuery ?? ''}
177+
source={SchemaHintsSources.AI_GENERATIONS}
178+
/>
179+
</Stack>
160180

161181
{showOnboarding ? (
162182
<Onboarding />

0 commit comments

Comments
 (0)