Skip to content

Enhancements for Spring Boot Admin registration#1508

Merged
bart-vmware merged 21 commits into
mainfrom
sba-hostname
Apr 25, 2025
Merged

Enhancements for Spring Boot Admin registration#1508
bart-vmware merged 21 commits into
mainfrom
sba-hostname

Conversation

@bart-vmware
Copy link
Copy Markdown
Member

@bart-vmware bart-vmware commented Apr 16, 2025

Description

This PR enhances the registration process of Steeltoe apps with a Spring Boot Admin server.

  • Periodically re-register (on by default), for resiliency against SBA server restarts
  • New settings to override the app scheme/host/port/path to register with (for running behind a reverse proxy)
  • Respond to configuration changes at runtime (unregister from previous server if URL changed)
  • Improved logging of the registration process, improved test coverage
  • Use the full Steeltoe version in the User-Agent header of outbound HTTP requests
  • Enhanced detection of app URL for Spring Boot Admin
    • Take the settings for exposing management endpoints on an alternate port into account
    • Use detection logic for local host/IP similar to Eureka
    • Infer the scheme and port (not the hostname, if wildcard) from ASP.NET address bindings, prefer https if multiple
    • Works with ASP.NET dynamic port bindings

Breaking changes:

  • BasePath configuration key was renamed to BaseUrl (new key BasePath means something else)
  • Default value for ConnectionTimeoutMs setting reduced to 5 seconds

Fixes #490

Quality checklist

@bart-vmware bart-vmware added Component/Management Issues related to Steeltoe Management (actuators) Warn/breaking-change There is a breaking change in the code ReleaseLine/4.x Identified as a feature/fix for the 4.x release line labels Apr 16, 2025
@bart-vmware bart-vmware added this to the 4.0.0-rc1 milestone Apr 16, 2025
@bart-vmware bart-vmware force-pushed the sba-hostname branch 4 times, most recently from 3f6aef6 to 3deac4d Compare April 17, 2025 07:28
@bart-vmware bart-vmware force-pushed the sba-hostname branch 8 times, most recently from a26cbda to 6ad31f9 Compare April 17, 2025 15:19
@bart-vmware bart-vmware marked this pull request as ready for review April 17, 2025 15:47
@bart-vmware bart-vmware requested a review from TimHess April 17, 2025 15:47
…gured HttpClient.Timeout of 0.5 seconds elapsing."
Comment thread src/Common/src/Common/Net/IDomainNameResolver.cs
Comment thread src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminClientOptions.cs Outdated
Comment thread src/Common/src/Common/Net/IDomainNameResolver.cs
Comment thread src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminClientOptions.cs Outdated
Comment thread src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminRefreshRunner.cs Outdated
Comment thread src/Management/src/Endpoint/SpringBootAdminClient/SpringBootAdminRefreshRunner.cs Outdated
Comment thread src/Management/test/Endpoint.Test/SpringBootAdminClient/AppUrlCalculatorTest.cs Outdated
@bart-vmware bart-vmware requested a review from TimHess April 23, 2025 12:39
@bart-vmware bart-vmware requested a review from TimHess April 25, 2025 11:25
@bart-vmware
Copy link
Copy Markdown
Member Author

The Config Server flaky test fix is based on the following log fragment:

Steeltoe.Configuration.ConfigServer.Test.ConfigServerConfigurationProviderTest.Load_ConfigServerReturnsBadStatus_FailFastEnabled_RetryEnabled

Assert.Throws() Failure: Exception type was not an exact match
Expected: typeof(Steeltoe.Configuration.ConfigServer.ConfigServerException)
Actual:   typeof(System.Threading.Tasks.TaskCanceledException)


Captured logs:
DBUG Steeltoe.Configuration.ConfigServer.ConfigServerConfigurationProvider: Fetching configuration from server at: http://localhost:8888/
TRCE Steeltoe.Configuration.ConfigServer.ConfigServerConfigurationProvider: Processing label ''
TRCE Steeltoe.Configuration.ConfigServer.ConfigServerConfigurationProvider: Entered RemoteLoadAsync
TRCE Steeltoe.Configuration.ConfigServer.ConfigServerConfigurationProvider: Building HTTP request message
TRCE Steeltoe.Configuration.ConfigServer.ConfigServerConfigurationProvider: Sending HTTP request


---- Assert.Throws() Failure: Exception type was not an exact match
Expected: typeof(Steeltoe.Configuration.ConfigServer.ConfigServerException)
Actual:   typeof(System.Threading.Tasks.TaskCanceledException)
-------- System.Threading.Tasks.TaskCanceledException : The operation was canceled.
------------ System.Net.Http.HttpRequestException : Error while copying content to a stream.
---------------- System.IO.IOException :
-------------------- System.IO.IOException : The client aborted the request.

The new diagnostics are starting to prove helpful. A 10 ms timeout is way too short, so I changed it to 1 sec. The other test is supposed to trigger a timeout, so it can be shortened.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@TimHess TimHess left a comment

Choose a reason for hiding this comment

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

LGTM!

@bart-vmware bart-vmware merged commit e8eb2bc into main Apr 25, 2025
24 checks passed
@bart-vmware bart-vmware deleted the sba-hostname branch April 25, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component/Management Issues related to Steeltoe Management (actuators) ReleaseLine/4.x Identified as a feature/fix for the 4.x release line Warn/breaking-change There is a breaking change in the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spring Boot Admin Integration enhancements

2 participants