Skip to content

Commit 105f121

Browse files
authored
ref(explorer): add copy and nav for errors search (#104078)
closes [AIML-1720: Add copy+nav for error search tool](https://linear.app/getsentry/issue/AIML-1720/add-copynav-for-error-search-tool) same params as for spans, but we always expect y_axes to be a list
1 parent 37e9922 commit 105f121

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

static/app/views/seerExplorer/utils.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ const TOOL_FORMATTERS: Record<string, ToolFormatter> = {
4343
: `Searched for issues${projectInfo}: '${question}'`;
4444
}
4545

46+
if (dataset === 'errors') {
47+
return isLoading
48+
? `Searching for errors${projectInfo}: '${question}'...`
49+
: `Searched for errors${projectInfo}: '${question}'`;
50+
}
51+
4652
// Default to spans
4753
return isLoading
4854
? `Querying spans${projectInfo}: '${question}'...`
@@ -343,6 +349,43 @@ export function buildToolLinkUrl(
343349
};
344350
}
345351

352+
if (dataset === 'errors') {
353+
const queryParams: Record<string, any> = {
354+
dataset: 'errors',
355+
queryDataset: 'error-events',
356+
query: query || '',
357+
project: null,
358+
};
359+
360+
if (stats_period) {
361+
queryParams.statsPeriod = stats_period;
362+
}
363+
364+
// If project_slugs is provided, look up the project IDs
365+
if (project_slugs && project_slugs.length > 0 && projects) {
366+
const projectIds = project_slugs
367+
.map((slug: string) => projects.find(p => p.slug === slug)?.id)
368+
.filter((id: string | undefined) => id !== undefined);
369+
if (projectIds.length > 0) {
370+
queryParams.project = projectIds;
371+
}
372+
}
373+
374+
const {y_axes} = toolLink.params;
375+
if (y_axes) {
376+
queryParams.yAxis = y_axes;
377+
}
378+
379+
if (sort) {
380+
queryParams.sort = sort;
381+
}
382+
383+
return {
384+
pathname: `/organizations/${orgSlug}/explore/discover/homepage/`,
385+
query: queryParams,
386+
};
387+
}
388+
346389
// Default to spans (traces) search
347390
const {y_axes, group_by, mode} = toolLink.params;
348391

0 commit comments

Comments
 (0)