-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 #3163
Merged
ryanjbaxter
merged 5 commits into
spring-cloud:4.0.x
from
fombico:mmedio/4.0.x-actuator_gateway_endpoint
Dec 5, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
63fc79c
Add links to child paths for /actuator/gateway endpoint
martamedio f782783
Add docs with output of gateway actuator endpoint
martamedio 8157363
Test additional endpoints
fombico 84c351a
Refactor to use the actuator path set in properties
fombico 7249dcc
Deprecate constructor and create a new one with injected WebEndpointP…
fombico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
71 changes: 71 additions & 0 deletions
71
...y-server/src/main/java/org/springframework/cloud/gateway/actuate/GatewayEndpointInfo.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,71 @@ | ||
/* | ||
* Copyright 2013-2020 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.cloud.gateway.actuate; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* @author Marta Medio | ||
*/ | ||
class GatewayEndpointInfo { | ||
|
||
private String href; | ||
|
||
private List<String> methods; | ||
|
||
public String getHref() { | ||
return href; | ||
} | ||
|
||
public void setHref(String href) { | ||
this.href = href; | ||
} | ||
|
||
public String[] getMethods() { | ||
return methods.stream().toArray(String[]::new); | ||
} | ||
|
||
GatewayEndpointInfo(String href, String method) { | ||
this.href = href; | ||
this.methods = Collections.singletonList(method); | ||
} | ||
|
||
GatewayEndpointInfo(String href, List<String> methods) { | ||
this.href = href; | ||
this.methods = methods; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
GatewayEndpointInfo that = (GatewayEndpointInfo) o; | ||
return Objects.equals(href, that.href) && Objects.equals(methods, that.methods); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(href, methods); | ||
} | ||
|
||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have noticed this before, but can we deprecate the old constructor and create a new one? I just dont want to introduce any breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I keep the deprecated constructor, I would not be able to inject a
WebEndpointProperties
bean. So I was thinking of simply creating a new instance, where the base path would be fixed to/actuator
.GatewayControllerEndpoint
andGatewayLegacyControllerEndpoint
would use the new constructor that handles the base path being overriden/actuator
Does this seem ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that seems right