Skip to content

Conversation

Munken
Copy link

@Munken Munken commented Aug 27, 2025

This implements url.template for WebClient and RestClient.
Attributes was first introduced in RestClient beginning with Spring 6.2.

I access it using reflection using a similar pattern to how the status code is accessed.

The other alternatives are:

  • Hook into the Spring client observability framework. I'm not sure whether this is compatible with the Otel framework.
  • Duplicate the spring-web-3-1/library to provide a spring-web-6-2/library

Copy link

linux-foundation-easycla bot commented Aug 27, 2025

CLA Not Signed

@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Aug 27, 2025
@otelbot-java-instrumentation
Copy link
Contributor

🔧 The result from spotlessApply was committed to the PR branch.

@laurit
Copy link
Contributor

laurit commented Aug 29, 2025

@Munken please sign the CLA. Please also add tests.

Comment on lines +120 to +124
try {
httpRequestClass = Class.forName("org.springframework.http.HttpRequest");
} catch (ClassNotFoundException e) {
// ignored
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to forName this class as it must be present.

try {
getAttributes =
lookup.findVirtual(
httpRequestClass, "getAttributes", MethodType.methodType(java.util.Map.class));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could import java.util.Map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants