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

STAT: Support config server_id and generate one if empty. v4.0.257

This commit is contained in:
winlin 2022-08-24 15:06:43 +08:00
parent 8e6d207e56
commit 9923c749d4
9 changed files with 158 additions and 33 deletions

View file

@ -12,6 +12,7 @@
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <srs_kernel_codec.hpp>
#include <srs_rtmp_stack.hpp>
@ -116,7 +117,7 @@ class SrsStatistic
private:
static SrsStatistic *_instance;
// The id to identify the sever.
std::string _server_id;
std::string server_id_;
private:
// The key: vhost id, value: vhost object.
std::map<std::string, SrsStatisticVhost*> vhosts;
@ -197,9 +198,14 @@ public:
// @param start the start index, from 0.
// @param count the max count of clients to dump.
virtual srs_error_t dumps_clients(SrsJsonArray* arr, int start, int count);
// Dumps the hints about SRS server.
void dumps_hints_kv(std::stringstream & ss);
private:
virtual SrsStatisticVhost* create_vhost(SrsRequest* req);
virtual SrsStatisticStream* create_stream(SrsStatisticVhost* vhost, SrsRequest* req);
};
// Generate a random string id, with constant prefix.
extern std::string srs_generate_stat_vid();
#endif