Enable verbose actuator format by default.
fixes gh-1192
This commit is contained in:
@@ -1444,12 +1444,12 @@ A new, more verbose format has been added to Gateway. This adds more detail to e
|
||||
]
|
||||
----
|
||||
|
||||
To enable this feature, set the following property:
|
||||
This feature is enabled by default. To disable it, set the following property:
|
||||
|
||||
.application.properties
|
||||
[source,properties]
|
||||
----
|
||||
spring.cloud.gateway.actuator.verbose.enabled=true
|
||||
spring.cloud.gateway.actuator.verbose.enabled=false
|
||||
----
|
||||
|
||||
This will default to true in a future release.
|
||||
|
||||
@@ -31,7 +31,7 @@ import rx.RxReactiveStreams;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
@@ -656,8 +656,9 @@ public class GatewayAutoConfiguration {
|
||||
protected static class GatewayActuatorConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty("spring.cloud.gateway.actuator.verbose.enabled")
|
||||
@ConditionalOnEnabledEndpoint
|
||||
@ConditionalOnProperty(name = "spring.cloud.gateway.actuator.verbose.enabled",
|
||||
matchIfMissing = true)
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public GatewayControllerEndpoint gatewayControllerEndpoint(
|
||||
List<GlobalFilter> globalFilters,
|
||||
List<GatewayFilterFactory> gatewayFilters,
|
||||
@@ -668,7 +669,7 @@ public class GatewayAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@Conditional(OnVerboseDisabledCondition.class)
|
||||
@ConditionalOnEnabledEndpoint
|
||||
@ConditionalOnAvailableEndpoint
|
||||
public GatewayLegacyControllerEndpoint gatewayLegacyControllerEndpoint(
|
||||
RouteDefinitionLocator routeDefinitionLocator,
|
||||
List<GlobalFilter> globalFilters,
|
||||
@@ -686,7 +687,8 @@ public class GatewayAutoConfiguration {
|
||||
super(ConfigurationPhase.REGISTER_BEAN);
|
||||
}
|
||||
|
||||
@ConditionalOnProperty("spring.cloud.gateway.actuator.verbose.enabled")
|
||||
@ConditionalOnProperty(name = "spring.cloud.gateway.actuator.verbose.enabled",
|
||||
matchIfMissing = true)
|
||||
static class VerboseDisabled {
|
||||
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ public class HystrixGatewayFilterFactory
|
||||
public Mono<Void> filter(ServerWebExchange exchange,
|
||||
GatewayFilterChain chain) {
|
||||
RouteHystrixCommand command = new RouteHystrixCommand(
|
||||
createCommandSetter(config, exchange),
|
||||
config.fallbackUri, exchange, chain);
|
||||
createCommandSetter(config, exchange), config.fallbackUri,
|
||||
exchange, chain);
|
||||
|
||||
return Mono.create(s -> {
|
||||
Subscription sub = command.toObservable().subscribe(s::success,
|
||||
|
||||
@@ -117,22 +117,22 @@ public class GatewayAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void legacyActuatorEnabledByDefault() {
|
||||
public void verboseActuatorEnabledByDefault() {
|
||||
try (ConfigurableApplicationContext ctx = SpringApplication.run(Config.class,
|
||||
"--spring.jmx.enabled=false", "--server.port=0")) {
|
||||
assertThat(ctx.getBeanNamesForType(GatewayControllerEndpoint.class))
|
||||
.isEmpty();
|
||||
assertThat(ctx.getBeanNamesForType(GatewayLegacyControllerEndpoint.class))
|
||||
.hasSize(1);
|
||||
assertThat(ctx.getBeanNamesForType(GatewayLegacyControllerEndpoint.class))
|
||||
.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verboseActuatorEnabled() {
|
||||
public void verboseActuatorDisabled() {
|
||||
try (ConfigurableApplicationContext ctx = SpringApplication.run(Config.class,
|
||||
"--spring.jmx.enabled=false", "--server.port=0",
|
||||
"--spring.cloud.gateway.actuator.verbose.enabled=true")) {
|
||||
assertThat(ctx.getBeanNamesForType(GatewayControllerEndpoint.class))
|
||||
"--spring.cloud.gateway.actuator.verbose.enabled=false")) {
|
||||
assertThat(ctx.getBeanNamesForType(GatewayLegacyControllerEndpoint.class))
|
||||
.hasSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user