diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 66107e6e0..5c2a712a2 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2022-08-26, Log: Stat the number of logs. v5.0.45 * v5.0, 2022-08-24, Log: Support write log to tencentcloud CLS. v5.0.44 * v5.0, 2022-08-22, Fix [#3114](https://github.com/ossrs/srs/issues/3114): Origin cluster config bug. v5.0.43 * v5.0, 2022-08-19, For [#2136](https://github.com/ossrs/srs/issues/2136): API: Cleanup no active streams for statistics. v5.0.42 diff --git a/trunk/src/app/srs_app_latest_version.cpp b/trunk/src/app/srs_app_latest_version.cpp index c869d6c3e..e8d7c43d1 100644 --- a/trunk/src/app/srs_app_latest_version.cpp +++ b/trunk/src/app/srs_app_latest_version.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -155,6 +156,9 @@ void srs_build_features(stringstream& ss) SRS_CHECK_FEATURE(exec, ss); SRS_CHECK_FEATURE(transcode, ss); SRS_CHECK_FEATURE(security, ss); + + SRS_CHECK_FEATURE2(_srs_cls->enabled(), "cls", ss); + SRS_CHECK_FEATURE3(_srs_cls->nn_logs(), "logs", _srs_cls->nn_logs(), ss); } SrsLatestVersion::SrsLatestVersion() diff --git a/trunk/src/app/srs_app_tencentcloud.cpp b/trunk/src/app/srs_app_tencentcloud.cpp index 582e00e6a..130f2d19a 100644 --- a/trunk/src/app/srs_app_tencentcloud.cpp +++ b/trunk/src/app/srs_app_tencentcloud.cpp @@ -800,6 +800,7 @@ SrsClsClient::SrsClsClient() debug_logging_ = false; heartbeat_ratio_ = 0; streams_ratio_ = 0; + nn_logs_ = 0; } SrsClsClient::~SrsClsClient() @@ -841,6 +842,11 @@ string SrsClsClient::tag() return tag_; } +uint64_t SrsClsClient::nn_logs() +{ + return nn_logs_; +} + srs_error_t SrsClsClient::initialize() { srs_error_t err = srs_success; @@ -967,7 +973,8 @@ srs_error_t SrsClsClient::send_log(ISrsEncoder* sugar, int count, int total) } if (debug_logging_) { - srs_trace("CLS write logs=%d/%d, size=%dB, request_id=%s", count, total, body.length(), request_id.c_str()); + string server_id = SrsStatistic::instance()->server_id(); + srs_trace("CLS write logs=%d/%d, size=%dB, server_id=%s, request_id=%s", count, total, body.length(), server_id.c_str(), request_id.c_str()); } return err; @@ -980,8 +987,11 @@ srs_error_t SrsClsClient::send_logs(SrsClsSugars* sugars) { srs_error_t err = srs_success; - // Never do infinite loop, limit to a max loop and drop logs if exceed. + // Record the total logs sent out. int total = sugars->size(); + nn_logs_ += total; + + // Never do infinite loop, limit to a max loop and drop logs if exceed. for (int i = 0; i < 128 && !sugars->empty(); ++i) { SrsClsSugars* v = sugars->slice(SRS_CLS_BATCH_MAX_LOG_SIZE); SrsAutoFree(SrsClsSugars, v); diff --git a/trunk/src/app/srs_app_tencentcloud.hpp b/trunk/src/app/srs_app_tencentcloud.hpp index 47c1eaa9f..e8d12f6dd 100644 --- a/trunk/src/app/srs_app_tencentcloud.hpp +++ b/trunk/src/app/srs_app_tencentcloud.hpp @@ -68,6 +68,8 @@ private: std::string secret_id_; std::string endpoint_; std::string topic_; +private: + uint64_t nn_logs_; public: SrsClsClient(); virtual ~SrsClsClient(); @@ -79,6 +81,7 @@ public: int streams_ratio(); std::string label(); std::string tag(); + uint64_t nn_logs(); public: srs_error_t initialize(); private: diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index d6f69f2ef..b5d1f362f 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 44 +#define VERSION_REVISION 45 #endif