1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

APM: Update statistic for APM.

This commit is contained in:
winlin 2022-09-16 21:04:43 +08:00
parent 3e2f8622f8
commit e63c02e928
3 changed files with 20 additions and 0 deletions

View file

@ -2086,6 +2086,7 @@ ISrsApmSpan* SrsApmSpan::load()
SrsApmClient::SrsApmClient()
{
enabled_ = false;
nn_spans_ = 0;
}
SrsApmClient::~SrsApmClient()
@ -2121,6 +2122,9 @@ srs_error_t SrsApmClient::report()
if (spans_.empty()) return err;
// Update statistaic for APM.
nn_spans_ += spans_.size();
SrsOtelExportTraceServiceRequest* sugar = new SrsOtelExportTraceServiceRequest();
SrsAutoFree(SrsOtelExportTraceServiceRequest, sugar);
@ -2200,6 +2204,16 @@ srs_error_t SrsApmClient::report()
return err;
}
bool SrsApmClient::enabled()
{
return enabled_;
}
uint64_t SrsApmClient::nn_spans()
{
return nn_spans_;
}
ISrsApmSpan* SrsApmClient::span(const std::string& name)
{
if (!enabled_) return new ISrsApmSpan();