MCPcopy Create free account
hub / github.com/apache/mesos / statistics

Method statistics

src/slave/http.cpp:2680–2714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2678
2679
2680Future<Response> Http::statistics(
2681 const Request& request,
2682 const Option<Principal>& principal) const
2683{
2684 // TODO(nfnt): Remove check for enabled
2685 // authorization as part of MESOS-5346.
2686 if (request.method != "GET" && slave->authorizer.isSome()) {
2687 return MethodNotAllowed({"GET"}, request.method);
2688 }
2689
2690 Try<string> endpoint = extractEndpoint(request.url);
2691 if (endpoint.isError()) {
2692 return Failure("Failed to extract endpoint: " + endpoint.error());
2693 }
2694
2695 return authorizeEndpoint(
2696 endpoint.get(),
2697 request.method,
2698 slave->authorizer,
2699 principal)
2700 .then(defer(
2701 slave->self(),
2702 [this, request](bool authorized) -> Future<Response> {
2703 if (!authorized) {
2704 return Forbidden();
2705 }
2706
2707 return statisticsLimiter->acquire()
2708 .then(defer(slave->self(), &Slave::usage))
2709 .then(defer(slave->self(),
2710 [this, request](const ResourceUsage& usage) {
2711 return _statistics(usage, request);
2712 }));
2713 }));
2714}
2715
2716
2717Response Http::_statistics(

Callers 4

TEST_FFunction · 0.45
TEST_PFunction · 0.45
foreachFunction · 0.45
initializeMethod · 0.45

Calls 12

MethodNotAllowedClass · 0.85
FailureClass · 0.85
authorizeEndpointFunction · 0.85
deferFunction · 0.85
ForbiddenClass · 0.85
errorMethod · 0.65
isSomeMethod · 0.45
isErrorMethod · 0.45
thenMethod · 0.45
getMethod · 0.45
selfMethod · 0.45
acquireMethod · 0.45

Tested by 2

TEST_FFunction · 0.36
TEST_PFunction · 0.36