com.oath.micro.server.spring.metrics.health.HealthResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micro-metrics Show documentation
Show all versions of micro-metrics Show documentation
Opinionated rest microservices
package com.oath.micro.server.spring.metrics.health;
import java.util.Map;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.springframework.stereotype.Component;
import com.oath.micro.server.auto.discovery.CommonRestResource;
import com.oath.micro.server.auto.discovery.SingletonRestResource;
import com.codahale.metrics.health.HealthCheck.Result;
import com.codahale.metrics.health.HealthCheckRegistry;
@Path("/health")
@Component
public class HealthResource implements CommonRestResource, SingletonRestResource {
final HealthCheckRegistry healthChecks;
public HealthResource(HealthCheckRegistry healthChecks) {
this.healthChecks = healthChecks;
}
@GET
@Produces("application/json")
public Map health() {
return healthChecks.runHealthChecks();
}
}