diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 3dd77797c8..7e551f41df 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -657,12 +657,12 @@ tencentcloud_apm { debug_logging off; } -# Promethous exporter config. +# Prometheus exporter config. # See https://prometheus.io/docs/instrumenting/exporters exporter { # Whether exporter is enabled. # Overwrite by env SRS_EXPORTER_ENABLED - # default: off + # Default: off enabled off; # The logging label to category the cluster servers. # Overwrite by env SRS_EXPORTER_LABEL diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 49a3106fba..295b1e923b 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-09-27, For [#2899](https://github.com/ossrs/srs/issues/2899): API: Support exporter for Prometheus. v5.0.67 * v5.0, 2022-09-27, For [#3167](https://github.com/ossrs/srs/issues/3167): WebRTC: Refine sequence jitter algorithm. v5.0.66 * v5.0, 2022-09-22, Fix [#3164](https://github.com/ossrs/srs/issues/3164): SRT: Choppy when audio ts gap is too large. v5.0.65 * v5.0, 2022-09-16, APM: Support distributed tracing by Tencent Cloud APM. v5.0.64 diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index fa0a189dc4..4b00e4e179 100644 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -1078,7 +1078,7 @@ srs_error_t SrsGoApiMetrics::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa { // whether enabled the HTTP Metrics API. if (!enabled_) { - return srs_api_response_code(w, r, ERROR_SYSTEM_CONFIG_EXPORTER_DISABLED); + return srs_api_response_code(w, r, ERROR_EXPORTER_DISABLED); } /* @@ -1096,58 +1096,58 @@ srs_error_t SrsGoApiMetrics::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa std::stringstream ss; // Build info from Config. - ss << "# HELP srs_build_info A metric with a constant '1' value labeled by build_date, version from which srs was built.\n" - << "# TYPE srs_build_info gauge\n" - << "srs_build_info{" - << "build_date=\"" << SRS_BUILD_DATE << "\"," - << "major=\"" << VERSION_MAJOR << "\"," - << "version=\"" << RTMP_SIG_SRS_VERSION << "\"," - << "code=\"" << RTMP_SIG_SRS_CODE<< "\"," - << "label=\"" << label_<< "\"," - << "tag=\"" << tag_ - << "\"} 1\n"; + ss << "# HELP srs_build_info A metric with a constant '1' value labeled by build_date, version from which SRS was built.\n" + << "# TYPE srs_build_info gauge\n" + << "srs_build_info{" + << "build_date=\"" << SRS_BUILD_DATE << "\"," + << "major=\"" << VERSION_MAJOR << "\"," + << "version=\"" << RTMP_SIG_SRS_VERSION << "\"," + << "code=\"" << RTMP_SIG_SRS_CODE<< "\""; + if (!label_.empty()) ss << ",label=\"" << label_ << "\""; + if (!tag_.empty()) ss << ",tag=\"" << tag_ << "\""; + ss << "} 1\n"; // Dump metrics by statistic. int64_t send_bytes, recv_bytes, nstreams, nclients, total_nclients, nerrs; stat->dumps_metrics(send_bytes, recv_bytes, nstreams, nclients, total_nclients, nerrs); // The total of bytes sent. - ss << "# HELP srs_send_bytes_total SRS server send bytes.\n" + ss << "# HELP srs_send_bytes_total SRS total sent bytes.\n" << "# TYPE srs_send_bytes_total counter\n" << "srs_send_bytes_total " << send_bytes << "\n"; // The total of bytes received. - ss << "# HELP srs_receive_bytes_total SRS server receive bytes.\n" + ss << "# HELP srs_receive_bytes_total SRS total received bytes.\n" << "# TYPE srs_receive_bytes_total counter\n" << "srs_receive_bytes_total " << recv_bytes << "\n"; // Current number of online streams. - ss << "# HELP srs_streams SRS server concurrent stream counts.\n" + ss << "# HELP srs_streams The number of SRS concurrent streams.\n" << "# TYPE srs_streams gauge\n" << "srs_streams " << nstreams << "\n"; // Current number of online clients. - ss << "# HELP srs_clients SRS server concurrent client counts.\n" + ss << "# HELP srs_clients The number of SRS concurrent clients.\n" << "# TYPE srs_clients gauge\n" << "srs_clients " << nclients << "\n"; // The total of clients connections. - ss << "# HELP srs_clients_total SRS server client total counts.\n" + ss << "# HELP srs_clients_total The total counts of SRS clients.\n" << "# TYPE srs_clients_total counter\n" << "srs_clients_total " << total_nclients << "\n"; // The total of clients errors. - ss << "# HELP srs_clients_errs_total SRS server clients total errors.\n" + ss << "# HELP srs_clients_errs_total The total errors of SRS clients.\n" << "# TYPE srs_clients_errs_total counter\n" << "srs_clients_errs_total " << nerrs diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index a3ccd36a9d..2c26b8e5ef 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 66 +#define VERSION_REVISION 67 #endif diff --git a/trunk/src/kernel/srs_kernel_error.hpp b/trunk/src/kernel/srs_kernel_error.hpp index fbd18f244a..b68a948680 100644 --- a/trunk/src/kernel/srs_kernel_error.hpp +++ b/trunk/src/kernel/srs_kernel_error.hpp @@ -100,7 +100,7 @@ XX(ERROR_APM_EXCEED_SIZE , 1087, "ApmExceedSize", "APM logs exceed max size 5MB") \ XX(ERROR_APM_ENDPOINT , 1088, "ApmEndpoint", "APM endpoint is invalid") \ XX(ERROR_APM_AUTH , 1089, "ApmAuth", "APM team or token is invalid") \ - XX(ERROR_SYSTEM_CONFIG_EXPORTER_DISABLED, 1090, "ConfigMetricsDisable", "Metrics API is disabled") \ + XX(ERROR_EXPORTER_DISABLED , 1090, "ExporterDisable", "Prometheus exporter is disabled") \ /**************************************************/ /* RTMP protocol error. */