de.otto.edison.metrics.load.MetricsLoadController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edison-metrics Show documentation
Show all versions of edison-metrics Show documentation
Status library of the edison-microservice project.
package de.otto.edison.metrics.load;
import de.otto.edison.annotations.Beta;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@Beta
@RestController
public class MetricsLoadController {
private LoadDetector loadDetector;
@Autowired
public MetricsLoadController(final LoadDetector loadDetector) {
this.loadDetector = loadDetector;
}
@RequestMapping(
value = "/internal/load",
produces = {"application/vnd.otto.monitoring.metrics+json", "application/json"},
method = GET
)
public MetricsLoadRepresentation getStatusAsJson() {
return new MetricsLoadRepresentation(loadDetector.getStatus());
}
}