Skip to content

Spring RestClient.Builder not instrumented #14561

@Munken

Description

@Munken

Describe the bug

RestClient is currently instrumented using a BeanPostProcessor.

However, it is typical to use the RestClient using the RestClient.Builder e.g.

        RestClient.builder()
                .baseUrl("http://localhost:8080")
                .requestInterceptors(System.out::println)
                .build()
                .get()
                .retrieve()
                .body(String.class);

In this case no instrumentation is present.

Steps to reproduce

Create a RestClient using the Builder. Have it print its interceptors.
Observe that the list is empty.

        RestClient.builder()
                .baseUrl("http://localhost:8080")
                .requestInterceptors(System.out::println)
                .build()
                .get()
                .retrieve()
                .body(String.class);

Expected behavior

A interceptor is added to the RestClient.

Actual behavior

No interceptor is added.

Javaagent or library instrumentation version

2.17

Environment

JDK:
OpenJDK
OS:
Windows/Linux

Additional context

Solution
The RestClient should be instrumented in a similar fashion to the WebClient

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions