aminghadersohi opened a new pull request, #42644: URL: https://github.com/apache/superset/pull/42644
### SUMMARY #### Why OAuth2 database token exchange and refresh failures lacked queryable context, and the callback emitted an outcome-neutral event metric that did not represent failures. #### What - Log token exchange and refresh failures with `database_id`, engine, and exception type while excluding OAuth codes, tokens, and provider payloads. - Use the standard REST API StatsD decorator for the OAuth2 callback so `DatabaseRestApi.oauth2.success`, `.warning`, and `.error` outcomes are distinguishable, while disabling the old duplicate unqualified event counter. - Add focused coverage for exchange logs, refresh logs, and callback success/error metrics. #### Blast radius Limited to OAuth2 database token exchange/refresh error handling and callback observability. Existing exceptions and token cleanup behavior are preserved. ### TESTING INSTRUCTIONS ```bash pytest -q tests/unit_tests/commands/databases/oauth2_test.py tests/unit_tests/utils/oauth2_tests.py tests/unit_tests/databases/oauth2_api_test.py tests/unit_tests/databases/api_test.py -k oauth2 --disable-warnings uvx pre-commit run --files superset/commands/database/oauth2.py superset/databases/api.py superset/utils/oauth2.py tests/unit_tests/commands/databases/oauth2_test.py tests/unit_tests/databases/oauth2_api_test.py tests/unit_tests/utils/oauth2_tests.py ``` The OAuth2 test selection passes with 38 tests. All changed-file pre-commit hooks pass. A full-repository pre-commit run was also attempted; it reaches unrelated existing mypy errors in version-restore tests and frontend custom-rule checks cannot load the uninstalled `glob` package in this worktree. ### RISK & ROLLBACK Low risk: no success-path or persistence semantics change. Roll back this commit to restore the prior logging and metric behavior. ### REVIEW GUIDANCE Please focus on log-field usefulness/redaction and the callback decorator ordering, which ensures outcome metrics wrap transaction completion. ### 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 -- 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]
