fix(explore): add !has filter when drilling down into no value group#110404
Conversation
0b08e44 to
73be391
Compare
nsdeschenes
left a comment
There was a problem hiding this comment.
Everything looks great here, thank you very much for your contribution!
|
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you add the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
|
Friendly bump, still active. Already approved and waiting on merge. |
|
Hey @SafinMahmud, sorry for the delay getting caught up in different things! Can you verify this is still an issue in production? I haven't been able to repro this. |
|
Sorry for the late reply. I don't have access to a production org with the right data to verify. I verified the fix through the unit test covering the no-value drill down scenario. I wasn't able to reproduce in a local environment due to span ingestion setup. |
| search.addFilterValue('!has', groupBy); | ||
| } | ||
| } |
There was a problem hiding this comment.
Bug: The generateTargetQuery function silently ignores numeric groupBy values when drilling down into samples, causing the drilldown to show unfiltered results instead of the expected filtered data.
Severity: MEDIUM
Suggested Fix
Add a generic handler to the generateTargetQuery function to process numeric values. This can be done by adding an else if (typeof value === 'number') block that appends the filter condition newQuery.push(${groupBy}:${value}); to the query, similar to how string values are handled.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/app/views/explore/utils.tsx#L324-L326
Potential issue: The `generateTargetQuery` function in
`static/app/views/explore/utils.tsx` lacks a handler for numeric values in `groupBy`
columns. While there are specific handlers for fields like `project.id` and a generic
handler for strings, any other numeric value (e.g., `http.status_code` or custom numeric
attributes) will fall through all conditions. Consequently, when a user groups by a
numeric attribute and clicks "View Samples", the numeric filter is silently skipped.
This leads to the samples page showing all spans instead of the correctly filtered
subset, which is incorrect and misleading behavior.
Did we get this right? 👍 / 👎 to inform future reviews.
Fixes #106948
Problem
When clicking "View Samples" from a group with no value (e.g.
user.idis empty), the filter was silently skipped because the code had no handler
for undefined values. This caused the samples page to show all spans
instead of only spans matching the no-value group.
Solution
Add a
!has:<groupBy>filter when the group by value is undefined/null,which correctly filters for spans where that field is not present.
Changes
static/app/views/explore/utils.tsx: Addedelse if (!defined(value))branch to handle undefined group by values
static/app/views/explore/utils.spec.tsx: Added test case covering theno-value drill down scenario