mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Log: Stat the number of logs. v5.0.45
This commit is contained in:
parent
5757950860
commit
a54d371549
5 changed files with 21 additions and 3 deletions
|
@ -7,6 +7,7 @@ The changelog for SRS.
|
||||||
|
|
||||||
## SRS 5.0 Changelog
|
## 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-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-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
|
* v5.0, 2022-08-19, For [#2136](https://github.com/ossrs/srs/issues/2136): API: Cleanup no active streams for statistics. v5.0.42
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <srs_app_utility.hpp>
|
#include <srs_app_utility.hpp>
|
||||||
#include <srs_app_uuid.hpp>
|
#include <srs_app_uuid.hpp>
|
||||||
#include <srs_app_statistic.hpp>
|
#include <srs_app_statistic.hpp>
|
||||||
|
#include <srs_app_tencentcloud.hpp>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -155,6 +156,9 @@ void srs_build_features(stringstream& ss)
|
||||||
SRS_CHECK_FEATURE(exec, ss);
|
SRS_CHECK_FEATURE(exec, ss);
|
||||||
SRS_CHECK_FEATURE(transcode, ss);
|
SRS_CHECK_FEATURE(transcode, ss);
|
||||||
SRS_CHECK_FEATURE(security, 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()
|
SrsLatestVersion::SrsLatestVersion()
|
||||||
|
|
|
@ -800,6 +800,7 @@ SrsClsClient::SrsClsClient()
|
||||||
debug_logging_ = false;
|
debug_logging_ = false;
|
||||||
heartbeat_ratio_ = 0;
|
heartbeat_ratio_ = 0;
|
||||||
streams_ratio_ = 0;
|
streams_ratio_ = 0;
|
||||||
|
nn_logs_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsClsClient::~SrsClsClient()
|
SrsClsClient::~SrsClsClient()
|
||||||
|
@ -841,6 +842,11 @@ string SrsClsClient::tag()
|
||||||
return tag_;
|
return tag_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t SrsClsClient::nn_logs()
|
||||||
|
{
|
||||||
|
return nn_logs_;
|
||||||
|
}
|
||||||
|
|
||||||
srs_error_t SrsClsClient::initialize()
|
srs_error_t SrsClsClient::initialize()
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
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_) {
|
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;
|
return err;
|
||||||
|
@ -980,8 +987,11 @@ srs_error_t SrsClsClient::send_logs(SrsClsSugars* sugars)
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
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();
|
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) {
|
for (int i = 0; i < 128 && !sugars->empty(); ++i) {
|
||||||
SrsClsSugars* v = sugars->slice(SRS_CLS_BATCH_MAX_LOG_SIZE);
|
SrsClsSugars* v = sugars->slice(SRS_CLS_BATCH_MAX_LOG_SIZE);
|
||||||
SrsAutoFree(SrsClsSugars, v);
|
SrsAutoFree(SrsClsSugars, v);
|
||||||
|
|
|
@ -68,6 +68,8 @@ private:
|
||||||
std::string secret_id_;
|
std::string secret_id_;
|
||||||
std::string endpoint_;
|
std::string endpoint_;
|
||||||
std::string topic_;
|
std::string topic_;
|
||||||
|
private:
|
||||||
|
uint64_t nn_logs_;
|
||||||
public:
|
public:
|
||||||
SrsClsClient();
|
SrsClsClient();
|
||||||
virtual ~SrsClsClient();
|
virtual ~SrsClsClient();
|
||||||
|
@ -79,6 +81,7 @@ public:
|
||||||
int streams_ratio();
|
int streams_ratio();
|
||||||
std::string label();
|
std::string label();
|
||||||
std::string tag();
|
std::string tag();
|
||||||
|
uint64_t nn_logs();
|
||||||
public:
|
public:
|
||||||
srs_error_t initialize();
|
srs_error_t initialize();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
#define VERSION_MAJOR 5
|
#define VERSION_MAJOR 5
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 44
|
#define VERSION_REVISION 45
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue