OpenFeign / OpenFeign/feign

Using ResponseInterceptor : add request execution elapsedTime to the InvocationContext

Open
#2,617 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

I'm implementing the ResponseInterceptor interface to provide informations about each HTTP request to my users.
I wanted to display the request execution elapsedTime, but this data is not present in the InvocationContext.

in ResponseHandler, this could be as simple as

public Object handleResponse(
      String configKey, Response response, Type returnType, long elapsedTime) throws Exception {
    try {
      response = logAndRebufferResponseIfNeeded(configKey, response, elapsedTime);
      return executionChain.next(
          new InvocationContext(
              configKey,
              decoder,
              errorDecoder,
              dismiss404,
              closeAfterDecode,
              decodeVoid,
              response,
              returnType,
              elapsedTime));

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading ResponseHandler.handleResponse and the InvocationContext and ResponseInterceptor APIs named in the issue. Trace how the elapsedTime argument is currently used, then expose it through the invocation context so response interceptors can access it. Done means an interceptor can read the HTTP request execution elapsed time from InvocationContext.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.