-
-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Support Spring's new RestClient with auto configuration (#3198) - Spring RestClient support * Support Spring's new RestClient with auto configuration (#3198) - Test when HTTP call fails is fixed with disabling retry mechanism in the Apache Http Client * apply code formatter etc. * Use separate trace origin; Add to Spring Boot 3 sample * changelog --------- Co-authored-by: Nándor Holozsnyák <[email protected]> Co-authored-by: Alexander Dinauer <[email protected]> Co-authored-by: Alexander Dinauer <[email protected]>
- Loading branch information
1 parent
256ae96
commit 955f1ff
Showing
9 changed files
with
418 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...t-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentrySpanRestClientCustomizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.sentry.spring.boot.jakarta; | ||
|
||
import com.jakewharton.nopen.annotation.Open; | ||
import io.sentry.IHub; | ||
import io.sentry.spring.jakarta.tracing.SentrySpanClientHttpRequestInterceptor; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.springframework.boot.web.client.RestClientCustomizer; | ||
import org.springframework.web.client.RestClient; | ||
|
||
@Open | ||
class SentrySpanRestClientCustomizer implements RestClientCustomizer { | ||
private final @NotNull SentrySpanClientHttpRequestInterceptor interceptor; | ||
|
||
public SentrySpanRestClientCustomizer(final @NotNull IHub hub) { | ||
this.interceptor = new SentrySpanClientHttpRequestInterceptor(hub, false); | ||
} | ||
|
||
@Override | ||
public void customize(final @NotNull RestClient.Builder restClientBuilder) { | ||
restClientBuilder.requestInterceptors( | ||
clientHttpRequestInterceptors -> { | ||
// As the SentrySpanClientHttpRequestInterceptor is being created in this class, this | ||
// might not work | ||
// if somebody registers it from an outside. | ||
if (!clientHttpRequestInterceptors.contains(interceptor)) { | ||
clientHttpRequestInterceptors.add(interceptor); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.