[bs-107] Remove "z" suffix from management endpoints

* /varz->/metrics
* /healthz->/health
* all actuator endpoints are now in a subpackage

[Fixes #49496887]
pull/1/merge
Dave Syer 12 years ago
parent 53078c320e
commit 728b4887c1

@ -378,7 +378,7 @@ or you can simply publish `AuditApplicationEvent` via the Spring
## Metrics Customization ## Metrics Customization
Metrics come out on the `/varz` endpoint. You can add additional Metrics come out on the `/metrics` endpoint. You can add additional
metrics by injecting a `MetricsRepository` into your application metrics by injecting a `MetricsRepository` into your application
components and adding metrics whenever you need to. To customize the components and adding metrics whenever you need to. To customize the
`MetricsRepository` itself, just add a bean definition of that type to `MetricsRepository` itself, just add a bean definition of that type to
@ -387,7 +387,7 @@ for now).
## Customizing the Health Indicator ## Customizing the Health Indicator
The application always tells you if it's healthy via the `/healthz` The application always tells you if it's healthy via the `/health`
endpoint. By default it just responds to a GET witha 200 status and a endpoint. By default it just responds to a GET witha 200 status and a
plain text body containing "ok". If you want to add more detailed plain text body containing "ok". If you want to add more detailed
information (e.g. a description of the current state of the information (e.g. a description of the current state of the

@ -33,7 +33,7 @@ import org.springframework.context.annotation.Import;
*/ */
@Configuration @Configuration
@Import({ ActuatorWebConfiguration.class, ManagementConfiguration.class, @Import({ ActuatorWebConfiguration.class, ManagementConfiguration.class,
MetricConfiguration.class, ServerConfiguration.class, MetricRepositoryConfiguration.class, ServerConfiguration.class,
SecurityConfiguration.class, TraceFilterConfiguration.class, SecurityConfiguration.class, TraceFilterConfiguration.class,
MetricFilterConfiguration.class, AuditConfiguration.class }) MetricFilterConfiguration.class, AuditConfiguration.class })
public class ActuatorAutoConfiguration { public class ActuatorAutoConfiguration {

@ -19,9 +19,9 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet; import javax.servlet.Servlet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.bootstrap.actuate.health.HealthIndicator; import org.springframework.bootstrap.actuate.endpoint.health.HealthEndpoint;
import org.springframework.bootstrap.actuate.health.HealthzEndpoint; import org.springframework.bootstrap.actuate.endpoint.health.HealthIndicator;
import org.springframework.bootstrap.actuate.health.VanillaHealthIndicator; import org.springframework.bootstrap.actuate.endpoint.health.VanillaHealthIndicator;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass; import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
@ -30,21 +30,21 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for /healthz endpoint. * {@link EnableAutoConfiguration Auto-configuration} for /health endpoint.
* *
* @author Dave Syer * @author Dave Syer
*/ */
@Configuration @Configuration
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) @ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
@ConditionalOnMissingBean({ HealthzEndpoint.class }) @ConditionalOnMissingBean({ HealthEndpoint.class })
public class HealthzConfiguration { public class HealthConfiguration {
@Autowired(required = false) @Autowired(required = false)
private HealthIndicator<? extends Object> healthIndicator = new VanillaHealthIndicator(); private HealthIndicator<? extends Object> healthIndicator = new VanillaHealthIndicator();
@Bean @Bean
public HealthzEndpoint<? extends Object> healthzEndpoint() { public HealthEndpoint<? extends Object> healthzEndpoint() {
return new HealthzEndpoint<Object>(healthIndicator); return new HealthEndpoint<Object>(this.healthIndicator);
} }
} }

@ -26,7 +26,7 @@ import javax.servlet.Servlet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.bootstrap.actuate.info.InfoEndpoint; import org.springframework.bootstrap.actuate.endpoint.info.InfoEndpoint;
import org.springframework.bootstrap.bind.PropertiesConfigurationFactory; import org.springframework.bootstrap.bind.PropertiesConfigurationFactory;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass; import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;

@ -50,7 +50,7 @@ public class ManagementConfiguration implements ApplicationContextAware, Disposa
@ConditionalOnExpression("${server.port:8080} == ${management.port:${server.port:8080}}") @ConditionalOnExpression("${server.port:8080} == ${management.port:${server.port:8080}}")
@Configuration @Configuration
@Import({ VarzConfiguration.class, HealthzConfiguration.class, @Import({ MetricsConfiguration.class, HealthConfiguration.class,
ShutdownConfiguration.class, TraceConfiguration.class }) ShutdownConfiguration.class, TraceConfiguration.class })
public static class ManagementEndpointsConfiguration { public static class ManagementEndpointsConfiguration {
} }
@ -77,7 +77,7 @@ public class ManagementConfiguration implements ApplicationContextAware, Disposa
AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext(); AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext();
context.setParent(this.parent); context.setParent(this.parent);
context.register(ManagementServerConfiguration.class, context.register(ManagementServerConfiguration.class,
VarzConfiguration.class, HealthzConfiguration.class, MetricsConfiguration.class, HealthConfiguration.class,
ShutdownConfiguration.class, TraceConfiguration.class); ShutdownConfiguration.class, TraceConfiguration.class);
context.refresh(); context.refresh();
this.context = context; this.context = context;

@ -21,7 +21,7 @@ import org.springframework.beans.factory.HierarchicalBeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.bootstrap.actuate.error.ErrorEndpoint; import org.springframework.bootstrap.actuate.endpoint.error.ErrorEndpoint;
import org.springframework.bootstrap.actuate.properties.ManagementServerProperties; import org.springframework.bootstrap.actuate.properties.ManagementServerProperties;
import org.springframework.bootstrap.context.annotation.ConditionalOnBean; import org.springframework.bootstrap.context.annotation.ConditionalOnBean;
import org.springframework.bootstrap.context.embedded.AbstractEmbeddedServletContainerFactory; import org.springframework.bootstrap.context.embedded.AbstractEmbeddedServletContainerFactory;

@ -33,7 +33,7 @@ import org.springframework.context.annotation.Configuration;
* *
*/ */
@Configuration @Configuration
public class MetricConfiguration { public class MetricRepositoryConfiguration {
@Bean @Bean
@ConditionalOnMissingBean({ CounterService.class }) @ConditionalOnMissingBean({ CounterService.class })

@ -19,10 +19,10 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet; import javax.servlet.Servlet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.bootstrap.actuate.endpoint.metrics.PublicMetrics;
import org.springframework.bootstrap.actuate.endpoint.metrics.VanillaPublicMetrics;
import org.springframework.bootstrap.actuate.endpoint.metrics.VarzEndpoint;
import org.springframework.bootstrap.actuate.metrics.MetricRepository; import org.springframework.bootstrap.actuate.metrics.MetricRepository;
import org.springframework.bootstrap.actuate.varz.PublicMetrics;
import org.springframework.bootstrap.actuate.varz.VanillaPublicMetrics;
import org.springframework.bootstrap.actuate.varz.VarzEndpoint;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass; import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
@ -38,7 +38,7 @@ import org.springframework.web.servlet.DispatcherServlet;
@Configuration @Configuration
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class }) @ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
@ConditionalOnMissingBean({ VarzEndpoint.class }) @ConditionalOnMissingBean({ VarzEndpoint.class })
public class VarzConfiguration { public class MetricsConfiguration {
@Autowired @Autowired
private MetricRepository repository; private MetricRepository repository;

@ -23,7 +23,7 @@ import org.apache.catalina.valves.RemoteIpValve;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.bootstrap.actuate.error.ErrorEndpoint; import org.springframework.bootstrap.actuate.endpoint.error.ErrorEndpoint;
import org.springframework.bootstrap.actuate.properties.ServerProperties; import org.springframework.bootstrap.actuate.properties.ServerProperties;
import org.springframework.bootstrap.actuate.properties.ServerProperties.Tomcat; import org.springframework.bootstrap.actuate.properties.ServerProperties.Tomcat;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass; import org.springframework.bootstrap.context.annotation.ConditionalOnClass;

@ -18,7 +18,7 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet; import javax.servlet.Servlet;
import org.springframework.bootstrap.actuate.shutdown.ShutdownEndpoint; import org.springframework.bootstrap.actuate.endpoint.shutdown.ShutdownEndpoint;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass; import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;

@ -19,7 +19,7 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet; import javax.servlet.Servlet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.bootstrap.actuate.trace.TraceEndpoints; import org.springframework.bootstrap.actuate.endpoint.trace.TraceEndpoints;
import org.springframework.bootstrap.actuate.trace.TraceRepository; import org.springframework.bootstrap.actuate.trace.TraceRepository;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass; import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;

@ -21,9 +21,9 @@ import javax.servlet.Servlet;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.bootstrap.actuate.endpoint.trace.WebRequestLoggingFilter;
import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository; import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository;
import org.springframework.bootstrap.actuate.trace.TraceRepository; import org.springframework.bootstrap.actuate.trace.TraceRepository;
import org.springframework.bootstrap.actuate.trace.WebRequestLoggingFilter;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass; import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean; import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration; import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.error; package org.springframework.bootstrap.actuate.endpoint.error;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.health; package org.springframework.bootstrap.actuate.endpoint.health;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -24,14 +24,14 @@ import org.springframework.web.bind.annotation.ResponseBody;
* @author Dave Syer * @author Dave Syer
*/ */
@Controller @Controller
public class HealthzEndpoint<T> { public class HealthEndpoint<T> {
private HealthIndicator<? extends T> indicator; private HealthIndicator<? extends T> indicator;
/** /**
* @param indicator * @param indicator
*/ */
public HealthzEndpoint(HealthIndicator<? extends T> indicator) { public HealthEndpoint(HealthIndicator<? extends T> indicator) {
super(); super();
this.indicator = indicator; this.indicator = indicator;
} }

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.health; package org.springframework.bootstrap.actuate.endpoint.health;
/** /**
* @author Dave Syer * @author Dave Syer

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.health; package org.springframework.bootstrap.actuate.endpoint.health;
/** /**
* @author Dave Syer * @author Dave Syer

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.info; package org.springframework.bootstrap.actuate.endpoint.info;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.varz; package org.springframework.bootstrap.actuate.endpoint.metrics;
import java.util.Collection; import java.util.Collection;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.varz; package org.springframework.bootstrap.actuate.endpoint.metrics;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.varz; package org.springframework.bootstrap.actuate.endpoint.metrics;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.shutdown; package org.springframework.bootstrap.actuate.endpoint.shutdown;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;

@ -14,13 +14,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.trace; package org.springframework.bootstrap.actuate.endpoint.trace;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo; import java.lang.management.ThreadInfo;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.springframework.bootstrap.actuate.trace.Trace;
import org.springframework.bootstrap.actuate.trace.TraceRepository;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.trace; package org.springframework.bootstrap.actuate.endpoint.trace;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.bootstrap.actuate.trace.TraceRepository;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;

@ -34,10 +34,10 @@ public class EndpointsProperties {
private Endpoint info = new Endpoint("/info"); private Endpoint info = new Endpoint("/info");
@Valid @Valid
private Endpoint varz = new Endpoint("/varz"); private Endpoint metrics = new Endpoint("/metrics");
@Valid @Valid
private Endpoint healthz = new Endpoint("/healthz"); private Endpoint health = new Endpoint("/health");
@Valid @Valid
private Endpoint error = new Endpoint("/error"); private Endpoint error = new Endpoint("/error");
@ -55,12 +55,12 @@ public class EndpointsProperties {
return this.info; return this.info;
} }
public Endpoint getVarz() { public Endpoint getMetrics() {
return this.varz; return this.metrics;
} }
public Endpoint getHealthz() { public Endpoint getHealth() {
return this.healthz; return this.health;
} }
public Endpoint getError() { public Endpoint getError() {

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.bootstrap.actuate.trace; package org.springframework.bootstrap.actuate.endpoint.trace;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.Test;
import org.springframework.bootstrap.actuate.endpoint.trace.WebRequestLoggingFilter;
import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository; import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository;
import org.springframework.bootstrap.actuate.trace.WebRequestLoggingFilter;
import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletRequest;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;

@ -19,8 +19,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
import org.springframework.bootstrap.actuate.trace.InMemoryTraceRepository;
import org.springframework.bootstrap.actuate.trace.Trace;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;

@ -116,12 +116,12 @@
<artifactId>thymeleaf-layout-dialect</artifactId> <artifactId>thymeleaf-layout-dialect</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId> <artifactId>hibernate-entitymanager</artifactId>
<scope>test</scope> <optional>true</optional>
</dependency> </dependency>
<!-- Test -->
<dependency> <dependency>
<groupId>org.hsqldb</groupId> <groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId> <artifactId>hsqldb</artifactId>

Loading…
Cancel
Save