Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-configure observations for RestClients #38500

Closed
atrepczik opened this issue Nov 22, 2023 · 0 comments
Closed

Auto-configure observations for RestClients #38500

atrepczik opened this issue Nov 22, 2023 · 0 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@atrepczik
Copy link

atrepczik commented Nov 22, 2023

I was trying out Spring Boot 3.2.0-RC2 and was quite surprised that a RestClient created via RestClient.builder().build() is not auto-instrumented like RestTemplate and WebClient currently are. If I create a RestClientCustomizer in a similar fashion to RestTemplateObservationConfiguration, then observations are properly created for HTTP requests as one could expect:

	@Bean
	RestClientCustomizer observationRestClientCustomizer(
			ObservationRegistry observationRegistry,
			ObjectProvider<ClientRequestObservationConvention> customConvention,
			ObservationProperties properties) {
		String name = properties.getHttp().getClient().getRequests().getName();
		ClientRequestObservationConvention observationConvention = customConvention
			.getIfAvailable(() -> new DefaultClientRequestObservationConvention(name));
		return builder -> builder
				.observationRegistry(observationRegistry)
				.observationConvention(observationConvention);
	}

Adding this as an auto configuration would improve the out-of-the-box experience for the new RestClient.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 22, 2023
@wilkinsona wilkinsona added the for: team-meeting An issue we'd like to discuss as a team to make progress label Nov 22, 2023
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Nov 22, 2023
@philwebb philwebb modified the milestones: 3.2.x, 3.2.0 Nov 22, 2023
@mhalbritter mhalbritter self-assigned this Nov 23, 2023
@mhalbritter mhalbritter changed the title Provide a RestClientObservationConfiguration Auto-configure observations for RestClients Nov 23, 2023
ndwlocatieservices added a commit to ndwnu/nls-accessibility-map that referenced this issue Jun 28, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [nu.ndw.nls:routing-map-matcher-spring-boot](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `7.7.1` -> `7.7.2` |
| [nu.ndw.nls.springboot:openapi](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | build | minor | `3.1.0` -> `3.2.1` |
| [nu.ndw.nls.springboot:oauth2-client-credentials](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.0` -> `3.2.1` |
| [nu.ndw.nls.springboot:test](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | test | minor | `3.1.0` -> `3.2.1` |
| [nu.ndw.nls.springboot:security](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.0` -> `3.2.1` |
| [nu.ndw.nls.springboot:messaging](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.0` -> `3.2.1` |
| [nu.ndw.nls.springboot:datadog](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.0` -> `3.2.1` |
| [nu.ndw:nls-nwb-data-access-jooq](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `4.2.1` -> `4.2.2` |
| nu.ndw:nls-events | compile | patch | `3.3.2` -> `3.3.5` |
| [org.springdoc:springdoc-openapi-starter-webmvc-ui](https://springdoc.org/) ([source](https://github.com/springdoc/springdoc-openapi)) | compile | minor | `2.2.0` -> `2.3.0` |
| [org.codehaus.mojo:exec-maven-plugin](https://www.mojohaus.org/exec-maven-plugin) ([source](https://github.com/mojohaus/exec-maven-plugin)) | build | patch | `3.1.0` -> `3.1.1` |
| [org.springframework.boot:spring-boot-starter-parent](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | parent | minor | `3.1.5` -> `3.2.0` |

---

### Release Notes

<details>
<summary>spring-projects/spring-boot (nu.ndw.nls.springboot:openapi)</summary>

### [`v3.2.0`](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.0)

[Compare Source](spring-projects/spring-boot@v3.1.0...v3.2.0)

##### ⭐ New Features

-   Auto-configure observations for RestClients [#&#8203;38500](spring-projects/spring-boot#38500)
-   Add support for Oracle Free, the replacement for Oracle XE, with Testcontainers and Docker Compose [#&#8203;38476](spring-projects/spring-boot#38476)
-   Provide dependency management for org.crac:crac [#&#8203;38378](spring-projects/spring-boot#38378)
-   Add new properties for Liquibase 4.24.0 [#&#8203;38274](spring-projects/spring-boot#38274)
...
ndwlocatieservices added a commit to ndwnu/nls-routing-map-matcher that referenced this issue Nov 6, 2024
…o v3.2.0

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [nu.ndw.nls.geometry:nls-geometry](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.2` -> `3.2.0` |

---

### Release Notes

<details>
<summary>spring-projects/spring-boot (nu.ndw.nls.geometry:nls-geometry)</summary>

### [`v3.2.0`](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.0)

[Compare Source](spring-projects/spring-boot@v3.1.2...v3.2.0)

#### ⭐ New Features

-   Auto-configure observations for RestClients [#&#8203;38500](spring-projects/spring-boot#38500)
-   Add support for Oracle Free, the replacement for Oracle XE, with Testcontainers and Docker Compose [#&#8203;38476](spring-projects/spring-boot#38476)
-   Provide dependency management for org.crac:crac [#&#8203;38378](spring-projects/spring-boot#38378)
-   Add new properties for Liquibase 4.24.0 [#&#8203;38274](spring-projects/spring-boot#38274)
-   Provide a way to create custom ApplicationContextFactory in SpringBootContextLoader [#&#8203;38205](spring-projects/spring-boot#38205)
-   Report friendly error when failing to find AOT initializer [#&#8203;38188](spring-projects/spring-boot#38188)

#### 🐞 Bug Fixes

-   Annotation based ConditionalOnBean checks can cause early initialization of FactoryBeans [#&#8203;38507](spring-projects/spring-boot#38507)
-   CRaC restoration fails when Actuator's running on a separate port [#&#8203;38502](spring-projects/spring-boot#38502)
-   App that depends on Tomcat and on Jetty's websocket-server module fails to start with IllegalStateException: WebSocketComponents has not been created [#&#8203;38286](spring-projects/spring-boot#38286)
-   App fails to start with a NoSuchMethodError when using Flyway 10.0.0 [#&#8203;38268](spring-projects/spring-boot#38268)
-   MeterRegistry throws BeanCreationNotAllowedException on shutdown [#&#8203;38240](spring-projects/spring-boot#38240)
-   Resolution of productionRuntimeClasspath configuration may select the wrong variant and contain a dependency's source jar [#&#8203;38233](spring-projects/spring-boot#38233)
-   Docker JSON parsing fails on certain locales [#&#8203;38220](spring-projects/spring-boot#38220)
-   FileNotFoundException is thrown serving resources due to JarUrlConnection.getLastModified() returning zero [#&#8203;38204](spring-projects/spring-boot#38204)
-   Failed to extract parameter names exception thrown when binding with non-enumerable property source [#&#8203;38201](https://github.com/spring-projects/spring...
quaff added a commit to quaff/spring-framework that referenced this issue Nov 8, 2024
ndwlocatieservices added a commit to ndwnu/nls-accessibility-map that referenced this issue Nov 13, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [nu.ndw.nls.geometry:nls-geometry](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.2` -> `3.2.0` |
| [nu.ndw.nls:routing-map-matcher-library](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `13.0.6` -> `13.0.7` |
| [nu.ndw.nls.springboot:openapi](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | build | patch | `5.0.9` -> `5.0.10` |
| [nu.ndw.nls.springboot:oauth2-client-credentials](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `5.0.9` -> `5.0.10` |
| [nu.ndw.nls.springboot:test](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | test | patch | `5.0.9` -> `5.0.10` |
| [nu.ndw.nls.springboot:security](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `5.0.9` -> `5.0.10` |
| [nu.ndw.nls.springboot:messaging](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `5.0.9` -> `5.0.10` |
| [nu.ndw.nls.springboot:monitoring](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `5.0.9` -> `5.0.10` |
| [nu.ndw.nls.springboot:client-feign](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `5.0.9` -> `5.0.10` |
| [nu.ndw:nls-nwb-data-access-jooq](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `7.1.6` -> `7.1.7` |
| [org.mapstruct:mapstruct-processor](https://mapstruct.org/mapstruct-processor/) ([source](https://github.com/mapstruct/mapstruct)) |  | patch | `1.6.2` -> `1.6.3` |
| [org.mapstruct:mapstruct](https://mapstruct.org/mapstruct/) ([source](https://github.com/mapstruct/mapstruct)) | compile | patch | `1.6.2` -> `1.6.3` |

---

### Release Notes

<details>
<summary>spring-projects/spring-boot (nu.ndw.nls.geometry:nls-geometry)</summary>

### [`v3.2.0`](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.0)

[Compare Source](spring-projects/spring-boot@v3.1.2...v3.2.0)

#### ⭐ New Features

-   Auto-configure observations for RestClients [#&#8203;38500](spring-projects/spring-boot#38500)
-   Add support for Oracle Free, the replacement for Oracle XE, with Testcontainers and Docker Compose [#&#8203;38476](spring-projects/spring-boot#38476)
-   Provide dependency management for org.crac:crac [#&#8203;38378](spring-projects/spring-boot#38378)
-   Add new properties for Liquibase 4.24.0 [#&...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants