Repository navigation
fix(search-logs): Suggest existing attributes when a log attribute is unknown - #2853
Open
sentry-junior[bot] wants to merge 3 commits into
Open
sentry-junior[bot] wants to merge 3 commits into
sentry-junior[bot] wants to merge 3 commits into
Conversation
… unknown When Sentry's validate endpoint rejects a log attribute as unknown, search_logs only echoed the validation result, so agents had no way to find a key that does exist and often stopped or guessed again. The final validation gate now looks up log attribute keys that share the longest part of each unknown name, in the same projects and time range, and names up to three of the closest. Close means the same name with other separators or another type (`request_id` -> `request.id`, `foo` -> `tags[foo,number]`), then containment, then shared name parts. `level` maps to `severity` without a lookup, and a filter negated with `-` gets a note that Sentry negates with `!`. The error also points to search_attributes for the exact key. The lookup is best effort: when it fails, the validation error and the search_attributes pointer stay, and only unexpected failures are reported. Only the logs dataset gets these hints, and the query-repair agent is unchanged. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
… of negation hints Search an unknown camelCase name by its longest part, so orderId also finds order_id. Strip the leading - from unknown sort names, so a descending sort no longer gets the filter-negation hint.
…n log attribute hints main's bundle sits about 700 bytes under the 3.77 MiB budget, and the hints add about 3 KB. Raise the budget by 0.01 MiB, as earlier feature changes did, which leaves about 8 KB.
Contributor
Author
|
This PR and #2211 both fix the same bug: The newest report (MCP user feedback, Maintainers: please pick one of the two and close the other. This PR is currently in conflict with main. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Sentry's validate endpoint reports a log attribute as unknown (no logs in the searched projects and time range have it),
search_logsonly echoed the validation result, so the agent couldn't tell which keys do exist. This is the most common waysearch_logsfails: most of its tool errors are validation failures withUnknown attribute, usually for custom attributes.When the final validation gate fails on the logs dataset, the error now ends with recovery hints:
trace-items/attributesrequest runs a substring search on the longest part of the name, in the same project and time window as the search. Sentry checks whether an attribute exists only within that window.request_id→request.id,foo→tags[foo,number]), then containment, then shared name parts. Parts shorter than 3 characters, such asid, don't count.levelandlog.levelmap toseveritywithout a lookup. A filter negated with-(Sentry reads-messageas an attribute name) gets a note that Sentry negates with!.search_attributespointer appears only when the session has that tool, and it uses the session's call route.app.search_events.validation.unknown_attribute_suggestions.Only the final error for the logs dataset changes. The query-repair agent, its
validateSearchtool, and the other datasets stay the same.via @dcramer.
--
View Session [Sentry]