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

(4.0.x) Enhance "/actuator/gateway" endpoint #3147

Conversation

martamedio
Copy link
Contributor

Solves: #3128

@ryanjbaxter
Copy link
Contributor

We shouldnt really need a separate PR for main, so I think we can close #3148 and just merge this one forward.

@@ -88,6 +100,53 @@ public AbstractGatewayControllerEndpoint(RouteDefinitionLocator routeDefinitionL
this.routeLocator = routeLocator;
}

private List<GatewayEndpointInfo> getAvailableEndpointsForClass(String className) {
try {
MetadataReader metadataReader = new SimpleMetadataReaderFactory().getMetadataReader(className);
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to instantiate SimpleMetadataReaderFactory every time this method is called

@@ -61,6 +71,8 @@ public class AbstractGatewayControllerEndpoint implements ApplicationEventPublis

private static final Log log = LogFactory.getLog(GatewayControllerEndpoint.class);

private static final String ENDPOINT_PREFIX = "/actuator/gateway";
Copy link
Contributor

Choose a reason for hiding this comment

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

Actuator endpoints won't necessarily be at /actuator. What happens if they are configured to be at a different endpoint?

Copy link
Member

@spencergibb spencergibb Dec 5, 2023

Choose a reason for hiding this comment

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

testClient.get().uri("http://localhost:" + port + "/actuator/gateway").exchange().expectStatus().isOk()
.expectBody(List.class).consumeWith(result -> {
List<String> responseBody = result.getResponseBody();
assertThat(responseBody).isNotEmpty();
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to validate that we are getting all the endpoints we expect

@ryanjbaxter ryanjbaxter merged commit f782783 into spring-cloud:4.0.x Dec 5, 2023
1 check passed
@martamedio martamedio deleted the mmedio/4.0.x-actuator_gateway_endpoint branch January 4, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants