mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add kbps for vhost and stream
This commit is contained in:
parent
20a8818a8e
commit
4763f205a2
5 changed files with 21 additions and 12 deletions
|
@ -113,11 +113,11 @@ int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
|
|||
<< SRS_JFIELD_STR("vhosts", "dumps vhost to json") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("streams", "dumps streams to json") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("clients", "dumps clients to json") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("test", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("tests", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_STR("requests", "show the request info") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("errors", "always return an error 100") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("redirects", "always redirect to /api/v1/test/errors") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR(".vhost.", "http vhost for error.srs.com/api/v1/test/errors")
|
||||
<< SRS_JFIELD_STR("[vhost]", "http vhost for http://error.srs.com:1985/api/v1/tests/errors")
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
|
|
@ -811,19 +811,19 @@ int SrsServer::http_handle()
|
|||
}
|
||||
|
||||
// test the request info.
|
||||
if ((ret = http_api_mux->handle("/api/v1/test/requests", new SrsGoApiRequests())) != ERROR_SUCCESS) {
|
||||
if ((ret = http_api_mux->handle("/api/v1/tests/requests", new SrsGoApiRequests())) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
// test the error code response.
|
||||
if ((ret = http_api_mux->handle("/api/v1/test/errors", new SrsGoApiError())) != ERROR_SUCCESS) {
|
||||
if ((ret = http_api_mux->handle("/api/v1/tests/errors", new SrsGoApiError())) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
// test the redirect mechenism.
|
||||
if ((ret = http_api_mux->handle("/api/v1/test/redirects", new SrsHttpRedirectHandler("/api/v1/test/errors", SRS_CONSTS_HTTP_MovedPermanently))) != ERROR_SUCCESS) {
|
||||
if ((ret = http_api_mux->handle("/api/v1/tests/redirects", new SrsHttpRedirectHandler("/api/v1/tests/errors", SRS_CONSTS_HTTP_MovedPermanently))) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
// test the http vhost.
|
||||
if ((ret = http_api_mux->handle("error.srs.com/api/v1/test/errors", new SrsGoApiError())) != ERROR_SUCCESS) {
|
||||
if ((ret = http_api_mux->handle("error.srs.com/api/v1/tests/errors", new SrsGoApiError())) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,10 @@ int SrsStatisticVhost::dumps(stringstream& ss)
|
|||
<< SRS_JFIELD_ORG("clients", nb_clients) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("send_bytes", kbps->get_send_bytes()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("recv_bytes", kbps->get_recv_bytes()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_OBJ("kbps")
|
||||
<< SRS_JFIELD_ORG("r30s", kbps->get_recv_kbps_30s()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("s30s", kbps->get_send_kbps_30s())
|
||||
<< SRS_JOBJECT_END << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_NAME("hls") << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_BOOL("enabled", hls_enabled);
|
||||
if (hls_enabled) {
|
||||
|
@ -123,6 +127,10 @@ int SrsStatisticStream::dumps(stringstream& ss)
|
|||
<< SRS_JFIELD_ORG("clients", nb_clients) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("send_bytes", kbps->get_send_bytes()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("recv_bytes", kbps->get_recv_bytes()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_OBJ("kbps")
|
||||
<< SRS_JFIELD_ORG("r30s", kbps->get_recv_kbps_30s()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("s30s", kbps->get_send_kbps_30s())
|
||||
<< SRS_JOBJECT_END << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("live_ms", srs_get_system_time_ms()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("status", status) << SRS_JFIELD_CONT;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue