-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
ref(insights): Refactor Insights -> LLM charts #90094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref(insights): Refactor Insights -> LLM charts #90094
Conversation
Refactors the Insights -> LLM charts to better support deep linking in a future PR. Notable in this PR is the introduction of a `chartProperties` prop for `LoadableChartWidgetProps`. These are to be used as URL query params when linking to the Releases Drawer, but also used to render the chart as well. They are chart-specific, which is the reason for the additional level of object nesting. Part of #88560
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
@gggritso this is slightly more complex than the other widgets. I have a slightly more complicated solution here that can account for future widgets where we need extra URL parameters for a specific chart. But the footnote above describes a potentially simpler approach that requires more queries. |
I spent all morning thinking about this, going crazy Charlie-and-the-corkboard style, and couldn't come up with anything better. I'm a little spooked by the
My main question is about this:
Are the specific examples of this? This LLM chart, as far as I can tell, is the only one that's rendered in an Issues context. Are there others? Do they have similar limitations? If this is the only one, I think having three widgets (one for LLM landing page, one for LLM pipeline details page, and one for the Issue Details page) is way simpler, and matches how the other widgets are done (e.g., query duration). The extra request is annoying, but that seems like a price worth paying. |
All great points, 1+3 are addressable but comes w/ complexity costs. 2+4 are good reasons to avoid this solution.
Nope, no others thus far (well aside from You're right, there's no reason to move away from our initial design regarding chart configuration in the URL. I've gone ahead and removed |
const {data} = useSpansIndexed( | ||
{ | ||
limit: 1, | ||
fields: [SpanIndexedField.SPAN_AI_PIPELINE_GROUP], | ||
search: new MutableSearch(`trace:${trace?.trace_id} id:"${trace?.span_id}"`), | ||
enabled: Boolean(trace?.span_id) && Boolean(trace?.trace_id), | ||
}, | ||
'api.ai-pipelines.view' | ||
); | ||
|
||
const aiPipelineGroup = data[0]?.[SpanIndexedField.SPAN_AI_PIPELINE_GROUP]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into a new hook that is used in the new widgets
</ModuleLayout.Half> | ||
</ModuleLayout.Layout> | ||
) : ( | ||
'loading' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely a yolo refactor, I don't have an issue that renders this component. @gggritso helped me look at some Sentry traces and it doesn't seem like this is used at all (at least in last 30 days)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be just as happy (maybe even happier) with 9 widgets and no base, TBH. I think it's a little sketchy that the useParams()
intentionally doesn't return a groupId
on pages without that param, which is half the time, due to the specific page it's on.
Not major though, this is pretty straight-forward overall 👍🏻
👍 got rid of |
Refactors the Insights -> LLM charts to better support deep linking in a future PR.
Notable in this PR is that these widgets are used in 3 different sections:
groupId
from URL parametersevent
argument, which uses the trace (span id + trace id) to query for a groupId to pass to widgetsWe're going to refactor the 3 widgets into:
(3) base widgets that accept an optionalgroupId
(referring to AI Pipeline Group, and not our normal Issues Group)groupId
from URL parameters. These widgets handle points1) and2) above.llmEvent*
) that takegroupId
(Issues Group!) andeventId
from URL parameters to fetch the Issues Group, and then tries to find the AI Pipeline Group id via the event's trace. This AI Pipeline Group ID is then used in the query and renders the appropriate charts. These widgets account for point 3) above.In order to handle this1 (and for future widgets), this PR introduces achartProperties
prop forLoadableChartWidgetProps
. These are to be used as URL query params when linking to the Releases Drawer, but also used to render the chart as well. They are chart-specific, which is the reason for the additional level of object nesting. Think of it as these two stages:- "Serialization": we have a chart, and want to "serialize" it into a URL. This will involve 2 steps- taking the keys ofchartProperties
object and using a known query parameter key (e.g.rdChartPropertyKey
) to create a list of query parameters (e.g.rdChartPropertyKey=foo&rdChartPropertyKey=bar
)- turningchartProperties
into query parameters (e.g.foo=val1&bar=val2
)- "Parsing": inverse of "serialization" -- we have a URL and want to render a chart.- using known key (rdChartPropertyKey
), we're able to fetch the keys ofchartProperties
(which can vary from chart to chart)- with the keys, we can again look through the query parameters to get the values for each keyThe known key (e.g.rdChartPropertKey
) acts as an indirect pointer to thechartProperties
object which has dynamic keys. See this commit for an example.Part of #88560
Footnotes
There is another solution, since (1) and (2) can be handled without any changes, we would just need slightly diff widgets for (3) where it's mostly the same except it expects
eventId
to available via URL params and it fetches the event to get the trace and then fetches the group id ↩