[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 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
components and adding metrics whenever you need to. To customize the
`MetricsRepository` itself, just add a bean definition of that type to
@ -387,7 +387,7 @@ for now).
## 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
plain text body containing "ok". If you want to add more detailed
information (e.g. a description of the current state of the

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

@ -19,9 +19,9 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.bootstrap.actuate.health.HealthIndicator;
import org.springframework.bootstrap.actuate.health.HealthzEndpoint;
import org.springframework.bootstrap.actuate.health.VanillaHealthIndicator;
import org.springframework.bootstrap.actuate.endpoint.health.HealthEndpoint;
import org.springframework.bootstrap.actuate.endpoint.health.HealthIndicator;
import org.springframework.bootstrap.actuate.endpoint.health.VanillaHealthIndicator;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
@ -30,21 +30,21 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;
/**
* {@link EnableAutoConfiguration Auto-configuration} for /healthz endpoint.
* {@link EnableAutoConfiguration Auto-configuration} for /health endpoint.
*
* @author Dave Syer
*/
@Configuration
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
@ConditionalOnMissingBean({ HealthzEndpoint.class })
public class HealthzConfiguration {
@ConditionalOnMissingBean({ HealthEndpoint.class })
public class HealthConfiguration {
@Autowired(required = false)
private HealthIndicator<? extends Object> healthIndicator = new VanillaHealthIndicator();
@Bean
public HealthzEndpoint<? extends Object> healthzEndpoint() {
return new HealthzEndpoint<Object>(healthIndicator);
public HealthEndpoint<? extends Object> healthzEndpoint() {
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.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.context.annotation.ConditionalOnClass;
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}}")
@Configuration
@Import({ VarzConfiguration.class, HealthzConfiguration.class,
@Import({ MetricsConfiguration.class, HealthConfiguration.class,
ShutdownConfiguration.class, TraceConfiguration.class })
public static class ManagementEndpointsConfiguration {
}
@ -77,7 +77,7 @@ public class ManagementConfiguration implements ApplicationContextAware, Disposa
AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext();
context.setParent(this.parent);
context.register(ManagementServerConfiguration.class,
VarzConfiguration.class, HealthzConfiguration.class,
MetricsConfiguration.class, HealthConfiguration.class,
ShutdownConfiguration.class, TraceConfiguration.class);
context.refresh();
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.Value;
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.context.annotation.ConditionalOnBean;
import org.springframework.bootstrap.context.embedded.AbstractEmbeddedServletContainerFactory;

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

@ -19,10 +19,10 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet;
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.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.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
@ -38,7 +38,7 @@ import org.springframework.web.servlet.DispatcherServlet;
@Configuration
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
@ConditionalOnMissingBean({ VarzEndpoint.class })
public class VarzConfiguration {
public class MetricsConfiguration {
@Autowired
private MetricRepository repository;

@ -23,7 +23,7 @@ import org.apache.catalina.valves.RemoteIpValve;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
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.Tomcat;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;

@ -18,7 +18,7 @@ package org.springframework.bootstrap.actuate.autoconfigure;
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.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;

@ -19,7 +19,7 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet;
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.context.annotation.ConditionalOnClass;
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.annotation.Autowired;
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.TraceRepository;
import org.springframework.bootstrap.actuate.trace.WebRequestLoggingFilter;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;

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

@ -14,7 +14,7 @@
* 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.web.bind.annotation.RequestMapping;
@ -24,14 +24,14 @@ import org.springframework.web.bind.annotation.ResponseBody;
* @author Dave Syer
*/
@Controller
public class HealthzEndpoint<T> {
public class HealthEndpoint<T> {
private HealthIndicator<? extends T> indicator;
/**
* @param indicator
*/
public HealthzEndpoint(HealthIndicator<? extends T> indicator) {
public HealthEndpoint(HealthIndicator<? extends T> indicator) {
super();
this.indicator = indicator;
}

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

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

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

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

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

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

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

@ -14,13 +14,15 @@
* 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.ThreadInfo;
import java.util.Arrays;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

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

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

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

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

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

Loading…
Cancel
Save