rebenitez1802 opened a new pull request, #38744: URL: https://github.com/apache/superset/pull/38744
### SUMMARY Add error-level logging to all failure paths in the chart data API (`/api/v1/chart/data`) to help diagnose intermittent 400 BAD REQUEST failures during CSV exports. Previously: - JSON parsing errors on `form_data` were **silently swallowed** by `contextlib.suppress` - Schema validation, datasource, and query errors returned 400/403/404 **without any logging** This made it impossible to identify which failure path was hit or correlate errors with specific requests. **Changes (single file, `superset/charts/data/api.py`):** - Replace silent `contextlib.suppress` with logged `try/except` for form_data JSON parsing - Log when `json_body is None` returns 400 (wrong content type, empty body) - Log `DatasourceNotFound`, `QueryObjectValidationError`, and `ValidationError` with chart identifiers - Log `ChartDataQueryFailedError` in `_get_data_response` - Log export permission denied (403) and empty query result (400) in `_send_chart_response` **Logged fields (no PII):** `request.referrer`, `slice_id`, `datasource`, `result_format`, `content_type`, `content_length` All response codes and messages remain identical — purely additive logging. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — logging-only change, no UI impact. ### TESTING INSTRUCTIONS 1. Trigger a CSV export from a dashboard — should succeed with no extra logs 2. Simulate failures (malformed form_data, missing datasource, permission denied) — error logs should appear with request context 3. Run existing chart data API tests — no regressions expected ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
