Merge pull request #9185 from terry-xiaoyu/fix_precision_of_rule_metrics
fix: set precision of counter 'max_speed' to 2 digits
This commit is contained in:
commit
eff4c109e0
|
@ -4,6 +4,7 @@
|
|||
[{"4.3.16",
|
||||
[{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||
{load_module,emqx_rule_funcs,brutal_purge,soft_purge,[]},
|
||||
{load_module,emqx_rule_metrics,brutal_purge,soft_purge,[]},
|
||||
{load_module,emqx_rule_engine_api,brutal_purge,soft_purge,[]}]},
|
||||
{"4.3.15",
|
||||
[{load_module,emqx_rule_funcs,brutal_purge,soft_purge,[]},
|
||||
|
@ -218,6 +219,7 @@
|
|||
[{"4.3.16",
|
||||
[{load_module,emqx_rule_registry,brutal_purge,soft_purge,[]},
|
||||
{load_module,emqx_rule_funcs,brutal_purge,soft_purge,[]},
|
||||
{load_module,emqx_rule_metrics,brutal_purge,soft_purge,[]},
|
||||
{load_module,emqx_rule_engine_api,brutal_purge,soft_purge,[]}]},
|
||||
{"4.3.15",
|
||||
[{load_module,emqx_rule_funcs,brutal_purge,soft_purge,[]},
|
||||
|
|
|
@ -500,11 +500,10 @@ calculate_speed(CurrVal, #rule_speed{max = MaxSpeed0, last_v = LastVal,
|
|||
last5m_smpl = Last5MinSamples, tick = Tick + 1}.
|
||||
|
||||
format_rule_speed(#rule_speed{max = Max, current = Current, last5m = Last5Min}) ->
|
||||
#{max => Max, current => precision(Current, 2), last5m => precision(Last5Min, 2)}.
|
||||
#{max => round2(Max), current => round2(Current), last5m => round2(Last5Min)}.
|
||||
|
||||
precision(Float, N) ->
|
||||
Base = math:pow(10, N),
|
||||
round(Float * Base) / Base.
|
||||
round2(Float) ->
|
||||
round(Float * 100) / 100.
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% Metrics Definitions
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
### Bug fixes
|
||||
|
||||
- Improve the display of rule's 'Maximum Speed' counter to only reserve 2 decimal places. [#9185](https://github.com/emqx/emqx/pull/9185)
|
||||
This is to avoid displaying floats like `0.30000000000000004` on the dashboard.
|
||||
|
||||
- Fix the issue that emqx prints too many error logs when connecting to mongodb but auth failed. [#9184](https://github.com/emqx/emqx/pull/9184)
|
||||
|
||||
- Fix that after receiving publish in `idle mode` the emqx-sn gateway may panic [#9024](https://github.com/emqx/emqx/pull/9024).
|
||||
|
||||
- "Pause due to rate limit" log level demoted from warning to notice [#9134](https://github.com/emqx/emqx/pull/9134).
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
### 修复
|
||||
|
||||
- 改进规则的 "最大执行速度" 的计数,只保留小数点之后 2 位 [#9185](https://github.com/emqx/emqx/pull/9185)
|
||||
避免在 dashboard 上展示类似这样的浮点数:`0.30000000000000004`。
|
||||
|
||||
- 修复在尝试连接 MongoDB 数据库过程中,如果认证失败会不停打印错误日志的问题。[#9184](https://github.com/emqx/emqx/pull/9184)
|
||||
|
||||
- 修复 emqx-sn 插件在“空闲”状态下收到消息发布请求时可能崩溃的情况 [#9024](https://github.com/emqx/emqx/pull/9024)。
|
||||
|
||||
- 限速 “Pause due to rate limit” 的日志级别从原先的 `warning` 降级到 `notice` [#9134](https://github.com/emqx/emqx/pull/9134)。
|
||||
|
|
Loading…
Reference in New Issue