Merge pull request #9929 from olcai/add-live-connections-to-prometheus

feat(emqx_prometheus): expose live_connections stats to prometheus
This commit is contained in:
Erik Timan 2023-02-10 10:45:20 +01:00 committed by GitHub
commit dc97ac7fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_prometheus, {application, emqx_prometheus,
[{description, "Prometheus for EMQ X"}, [{description, "Prometheus for EMQ X"},
{vsn, "4.3.1"}, % strict semver, bump manually! {vsn, "4.3.2"}, % strict semver, bump manually!
{modules, []}, {modules, []},
{registered, [emqx_prometheus_sup]}, {registered, [emqx_prometheus_sup]},
{applications, [kernel,stdlib,prometheus]}, {applications, [kernel,stdlib,prometheus]},

View File

@ -1,9 +1,9 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
%% Unless you know what you are doing, DO NOT edit manually!! %% Unless you know what you are doing, DO NOT edit manually!!
{VSN, {VSN,
[{"4.3.0", [{"4.3.1",[{load_module,emqx_prometheus,brutal_purge,soft_purge,[]}]},
[{load_module,emqx_prometheus,brutal_purge,soft_purge,[]}]}, {"4.3.0",[{load_module,emqx_prometheus,brutal_purge,soft_purge,[]}]},
{<<".*">>,[]}], {<<".*">>,[]}],
[{"4.3.0", [{"4.3.1",[{load_module,emqx_prometheus,brutal_purge,soft_purge,[]}]},
[{load_module,emqx_prometheus,brutal_purge,soft_purge,[]}]}, {"4.3.0",[{load_module,emqx_prometheus,brutal_purge,soft_purge,[]}]},
{<<".*">>,[]}]}. {<<".*">>,[]}]}.

View File

@ -185,6 +185,10 @@ emqx_collect(emqx_connections_count, Stats) ->
gauge_metric(?C('connections.count', Stats)); gauge_metric(?C('connections.count', Stats));
emqx_collect(emqx_connections_max, Stats) -> emqx_collect(emqx_connections_max, Stats) ->
gauge_metric(?C('connections.max', Stats)); gauge_metric(?C('connections.max', Stats));
emqx_collect(emqx_live_connections_count, Stats) ->
gauge_metric(?C('live_connections.count', Stats));
emqx_collect(emqx_live_connections_max, Stats) ->
gauge_metric(?C('live_connections.max', Stats));
%% sessions %% sessions
emqx_collect(emqx_sessions_count, Stats) -> emqx_collect(emqx_sessions_count, Stats) ->
@ -471,6 +475,8 @@ emqx_collect(emqx_cluster_nodes_stopped, ClusterData) ->
emqx_stats() -> emqx_stats() ->
[ emqx_connections_count [ emqx_connections_count
, emqx_connections_max , emqx_connections_max
, emqx_live_connections_count
, emqx_live_connections_max
, emqx_sessions_count , emqx_sessions_count
, emqx_sessions_max , emqx_sessions_max
, emqx_topics_count , emqx_topics_count

View File

@ -16,6 +16,8 @@
- Add more debug logs for authentication and ACL [#9943](https://github.com/emqx/emqx/pull/9943). - Add more debug logs for authentication and ACL [#9943](https://github.com/emqx/emqx/pull/9943).
- Expose the stats `live_connections.count` and `live_connections.max` to Prometheus [#9929](https://github.com/emqx/emqx/pull/9929).
## Bug fixes ## Bug fixes
- Fixed an error when forward MQTT messages with User-Property using the `republish` action [#9942](https://github.com/emqx/emqx/pull/9942). - Fixed an error when forward MQTT messages with User-Property using the `republish` action [#9942](https://github.com/emqx/emqx/pull/9942).

View File

@ -16,6 +16,8 @@
- 为认证和授权添加了更多调试日志 [#9943](https://github.com/emqx/emqx/pull/9943)。 - 为认证和授权添加了更多调试日志 [#9943](https://github.com/emqx/emqx/pull/9943)。
- 将统计数据 `live_connections.count``live_connections.max` 公开给 Prometheus [#9929](https://github.com/emqx/emqx/pull/9929).
## 修复 ## 修复
- 修复使用 `消息重发布` 动作转发带 User-Property 的 MQTT 消息时出错的问题 [#9942](https://github.com/emqx/emqx/pull/9942)。 - 修复使用 `消息重发布` 动作转发带 User-Property 的 MQTT 消息时出错的问题 [#9942](https://github.com/emqx/emqx/pull/9942)。