Skip to content

fix: apply errorResponseTransform to query execution failures - #20529

Open
capistrant wants to merge 1 commit into
apache:masterfrom
capistrant:fix-error-response-transform-operational-gaps
Open

capistrant wants to merge 1 commit into
apache:masterfrom
capistrant:fix-error-response-transform-operational-gaps

Conversation

@capistrant

@capistrant capistrant commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

#11711 added functionality for creating runtime transformations to error messages according to a policy. The initial policy was a regex that can be used to sanitize what errors pass through to callers. #18487 added a new policy, persona. The persona policy hides non-user persona error details from clients, and instead gives them a generic error with an ID that an operator can take to troubleshoot more deeply. In investigating how I may leverage this policy for a use case, I found that the transformations were not always taking effect and some other apparent issues existed.

This PR aims to close some of the gaps in the implementation to give more complete coverage to the documented feature.

  1. Errors raised during query execution are now transformed.
    • Previously DruidExceptions thrown during query run bypassed the strategy, allowing operator facing errors to reach the client.
    • Failures during execution that are transformed now log an Error ID with the generated ID to help with operator finding and correlating the user facing error to what happened under the hood.
  2. Legacy QueryExceptions now map to a persona via QueryExceptionCompat. This allows these exceptions to be transformed as well now.
    • This does result in some persona field changes from OPERATOR to USER
  3. persona issue for JDBC and Druid router errors fixed. transformIfNeeded was calling getErrorMessageTransformFunction which threw UnsupportedOperationException. persona now implements transformIfNeeded so the policy can transform JDBC and router generated errors
  4. Invalid native json now passes through the strategy

Release note

Fixed gaps in druid.server.http.errorResponseTransform

  • Errors raised while a query is running are now transformed instead of passing through to client unchanged
  • JDBC errors and errors raised by the router are now transformed

Key changed/added classes in this PR
  • QueryResultPusher
  • QueryResourceQueryResultPusherFactory
  • SqlResourceQueryResultPusher
  • QueryResource
  • PersonaBasedErrorTransformStrategy
  • QueryExceptionCompat
  • docs/configuration/index.md

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant