feat(seer): Add widget-level LLM context to dashboard widgets#112267
feat(seer): Add widget-level LLM context to dashboard widgets#112267Mihir-Mavalankar merged 8 commits intomasterfrom
Conversation
Register each dashboard widget as a child node in the LLM context tree so the Seer Explorer agent gets per-widget metadata: title, display type, widget type, query config, and tool-use hints that map directly to Seer's telemetry_live_search parameters. Big number widgets also include their fetched data value. Capitalize node type headings in the backend markdown renderer for readability. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Include date range, environments, projects, and edit mode in the dashboard context node so the Seer Explorer agent knows the scope and timeframe the user is viewing. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Tell the Seer agent that dateRange/environments/projects are global page filters scoping every widget, and that child widget nodes have query config usable with telemetry_live_search. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: LLM context captures pre-mutation TOP_N display type
- Normalized TOP_N to AREA in the LLM context inputs so initial context and query hint now match the rendered timeseries widget.
Or push these changes by commenting:
@cursor push c66ab33a1a
Preview (c66ab33a1a)
diff --git a/static/app/views/dashboards/widgetCard/index.tsx b/static/app/views/dashboards/widgetCard/index.tsx
--- a/static/app/views/dashboards/widgetCard/index.tsx
+++ b/static/app/views/dashboards/widgetCard/index.tsx
@@ -177,13 +177,17 @@
const navigate = useNavigate();
const {dashboardId: currentDashboardId} = useParams<{dashboardId: string}>();
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
+ const llmDisplayType =
+ props.widget.displayType === DisplayType.TOP_N
+ ? DisplayType.AREA
+ : props.widget.displayType;
// Push widget metadata into the LLM context tree for Seer Explorer.
useLLMContext({
title: props.widget.title,
- displayType: props.widget.displayType,
+ displayType: llmDisplayType,
widgetType: props.widget.widgetType,
- queryHint: getQueryHint(props.widget.displayType),
+ queryHint: getQueryHint(llmDisplayType),
queries: props.widget.queries.map(q => ({
name: q.name,
conditions: q.conditions,
@@ -191,7 +195,7 @@
columns: q.columns,
orderby: q.orderby,
})),
- ...getWidgetData(props.widget.displayType, data),
+ ...getWidgetData(llmDisplayType, data),
});
const onDataFetched = (newData: Data) => {This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1bbe4ed. Configure here.
TOP_N widgets are mutated to AREA later in the render body, but useLLMContext read the pre-mutation value on first render, producing a misleading table query hint instead of the correct timeseries hint. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Missed this assertion when capitalizing nodeType in _render_node. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
gggritso
left a comment
There was a problem hiding this comment.
Makes sense overall, just one nit and one suggestion. In the future please split up PRs that contain unrelated changes, regardless of whether it's safe to deploy them together!
| export function getWidgetData( | ||
| displayType: DisplayType, | ||
| data: Data | undefined | ||
| ): Record<string, unknown> { | ||
| if (displayType === DisplayType.BIG_NUMBER && data?.tableResults?.[0]) { | ||
| return {data: data.tableResults[0].data}; | ||
| } | ||
| return {}; | ||
| } |
There was a problem hiding this comment.
Each widget already has code that takes the fetched data and parses out the visible value (or values). Maybe it would be wise to call useLLMContext from there? e.g., BigNumberWidgetVisualization figures out the correct type, units, thresholds, and so on, all of which is valuable context, you could lean on that, and you won't need getWidgetData at all
There was a problem hiding this comment.
I changed the approach for Big number. If this looks good, I'll use the something similar for Table and time series data.
Capitalization of nodeType headings in _render_node will be done in a separate PR. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
…lues Move getWidgetQueryLLMHint into widgetLLMContext.tsx and remove getWidgetLLMData — visualization components now push their own parsed display values instead of extracting raw data at the WidgetCard level. Register BigNumberWidgetVisualization as a 'chart' child node under the widget and push field, value, type, unit, and thresholds into the LLM context tree. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Change BigNumberWidgetVisualizationProps from interface to type so it satisfies the Record<string, unknown> constraint in registerLLMContext. Structurally identical, no behavior change. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
+ Register each dashboard widget as a child node in the LLM context tree so the Seer Explorer agent gets per-widget metadata: title, display type, widget type, query config, and tool-use hints that map directly to Seer's telemetry_live_search parameters. + Add page-level filters (date range, environments, projects) and edit mode to the dashboard context node so the agent knows the scope and timeframe the user is viewing. + For BigNumber widgets, the visualization component registers as a chart child node and pushes parsed display values (field, value, type, unit, thresholds) — no raw data, just what's rendered on screen. --------- Co-authored-by: Claude Opus 4.6 <noreply@example.com>


Uh oh!
There was an error while loading. Please reload this page.