| 53 | #endif |
| 54 | |
| 55 | JSON::Object Metrics() |
| 56 | { |
| 57 | UPID upid("metrics", process::address()); |
| 58 | |
| 59 | // TODO(neilc): This request might timeout if the current value of a |
| 60 | // metric cannot be determined. In tests, a common cause for this is |
| 61 | // MESOS-6231 when multiple scheduler drivers are in use. |
| 62 | Future<http::Response> response = http::get(upid, "snapshot"); |
| 63 | |
| 64 | AWAIT_EXPECT_RESPONSE_STATUS_EQ(http::OK().status, response); |
| 65 | AWAIT_EXPECT_RESPONSE_HEADER_EQ(APPLICATION_JSON, "Content-Type", response); |
| 66 | |
| 67 | Try<JSON::Object> parse = JSON::parse<JSON::Object>(response->body); |
| 68 | CHECK_SOME(parse); |
| 69 | |
| 70 | return parse.get(); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | Try<uint16_t> getFreePort() |
no test coverage detected