| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…g after exception handling
|
@tinnou - long time no see. Let me have a look at this and thanks once again for contributing |
Sorry, something went wrong.
There was a problem hiding this comment.
Nice one - lets add this!
Sorry, something went wrong.
That's some serious speed! ⚡ ⚡ Thank you Brad! |
Sorry, something went wrong.
…ainedInstrumentation Missed it from PR graphql-java#4206
…ainedInstrumentation Missed it from PR graphql-java#4206
…ainedInstrumentation Missed it from PR graphql-java#4206
| Back | FazBrowse Home | New Git URL |
CONTEXT
In our infrastructure, we like to capture resolver latency along with error presence on a single metric. This unlocks alerting based on resolver error rate & resolver latency. We also leverage centralized resolver exception handling (via DataFetchingExceptionHandler) and implementations often contains logic to transforms certain classes of exceptions as client or server GraphQL errors. For example a data fetcher might raise a ValidationException which will be caught by the ExceptionHandler and mapped as a client GraphQL error (bad request error type).
Unfortunately right now, the existing instrumentation hooks (e.g instrumentDataFetcher or beginFieldFetching/beginFieldFetch) are insufficient because it's impossible to observe the post-exception-handling DataFetcherResult. So in the example above, instrumentations would only have access to the ValidationException and not the graphql client error because exception handling has not happened yet. Emitting a metric that tracks the rate of client/server errors as well as latency becomes complicated without replicating the exception handling inside instrumentations.
WHAT IS THIS PR PROPOSING?
This PR exposes an additional method on default void onExceptionHandled(DataFetcherResult<Object> dataFetcherResult) on FieldFetchingInstrumentationContext to observe the final DataFetcherResult after exception handling. This is part of the beginFieldFetching instrumentation method callback.
Breaking Changes
I put this PR together as a discussion starting point (using the Cunningham's Law), there are definitive alternatives that I thought of and would love your input.
Alternatives considered: