fix(dashboard): guard sort param by dataset in widget table queries#715
Merged
fix(dashboard): guard sort param by dataset in widget table queries#715
Conversation
…129) queryWidgetTable was passing sort/orderby to the events API for all datasets, but the sort param is only supported on the spans dataset. Errors/discover endpoints reject it with 400 Bad Request. Also enrich ApiError captures in exceptionWhileRunningCommand with structured Sentry context (status, endpoint, detail) for better diagnostics on future API errors.
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Contributor
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 90.91%. Project has 1573 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.37% 95.37% —%
==========================================
Files 232 232 —
Lines 33928 33941 +13
Branches 0 0 —
==========================================
+ Hits 32355 32368 +13
- Misses 1573 1573 —
- Partials 0 0 —Generated by Codecov Action |
The authenticatedFetch wrapper returned Response objects without throwing on 4xx, so withTracing always marked HTTP spans as "ok" regardless of the actual HTTP status. This made traces misleading — a 400 Bad Request showed span.status: "ok" because the span status was set before apiRequestToRegion checked response.ok. Switch from withHttpSpan to withTracingSpan in createAuthenticatedFetch to set http.response.status_code as a span attribute and mark non-ok responses with error status. OAuth callers of withHttpSpan are unaffected since they already throw inside the callback on non-ok responses.
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.
Summary
queryWidgetTablesendingsortparam for non-spans datasets (errors/discover reject with 400 Bad Request)ApiErrorcaptures inexceptionWhileRunningCommandwith structured Sentry context (status,endpoint,detail) for better diagnosticsFixes CLI-129
Details
queryWidgetTimeseriesalready correctly guarded thesortparameter behinddataset === "spans"(lines 384-389), butqueryWidgetTablewas passingquery?.orderbyunconditionally. When a dashboard has a table or big_number widget witherror-eventsordiscoverwidget type and the widget query hasorderby, the events endpoint returns 400.The
api_errorcontext onSentry.setContext()ensures future ApiError events include the endpoint URL and response detail, making it possible to diagnose which API call failed without guessing from minified stack traces.