|
|
@@ -529,47 +529,69 @@ printable_function_name(Mod, Func) ->
|
|
|
list_to_binary(lists:concat([Mod, ":", Func])).
|
|
|
|
|
|
get_rule_metrics(Id) ->
|
|
|
- Format = fun(
|
|
|
- Node,
|
|
|
- #{
|
|
|
- counters :=
|
|
|
- #{
|
|
|
- 'matched' := Matched,
|
|
|
- 'passed' := Passed,
|
|
|
- 'failed' := Failed,
|
|
|
- 'failed.exception' := FailedEx,
|
|
|
- 'failed.no_result' := FailedNoRes,
|
|
|
- 'actions.total' := OTotal,
|
|
|
- 'actions.failed' := OFailed,
|
|
|
- 'actions.failed.out_of_service' := OFailedOOS,
|
|
|
- 'actions.failed.unknown' := OFailedUnknown,
|
|
|
- 'actions.success' := OFailedSucc
|
|
|
- },
|
|
|
- rate :=
|
|
|
- #{
|
|
|
- 'matched' :=
|
|
|
- #{current := Current, max := Max, last5m := Last5M}
|
|
|
- }
|
|
|
- }
|
|
|
- ) ->
|
|
|
- #{
|
|
|
- metrics => ?METRICS(
|
|
|
- Matched,
|
|
|
- Passed,
|
|
|
- Failed,
|
|
|
- FailedEx,
|
|
|
- FailedNoRes,
|
|
|
- OTotal,
|
|
|
- OFailed,
|
|
|
- OFailedOOS,
|
|
|
- OFailedUnknown,
|
|
|
- OFailedSucc,
|
|
|
- Current,
|
|
|
- Max,
|
|
|
- Last5M
|
|
|
- ),
|
|
|
- node => Node
|
|
|
- }
|
|
|
+ Format = fun
|
|
|
+ (
|
|
|
+ Node,
|
|
|
+ #{
|
|
|
+ counters :=
|
|
|
+ #{
|
|
|
+ 'matched' := Matched,
|
|
|
+ 'passed' := Passed,
|
|
|
+ 'failed' := Failed,
|
|
|
+ 'failed.exception' := FailedEx,
|
|
|
+ 'failed.no_result' := FailedNoRes,
|
|
|
+ 'actions.total' := OTotal,
|
|
|
+ 'actions.failed' := OFailed,
|
|
|
+ 'actions.failed.out_of_service' := OFailedOOS,
|
|
|
+ 'actions.failed.unknown' := OFailedUnknown,
|
|
|
+ 'actions.success' := OFailedSucc
|
|
|
+ },
|
|
|
+ rate :=
|
|
|
+ #{
|
|
|
+ 'matched' :=
|
|
|
+ #{current := Current, max := Max, last5m := Last5M}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ) ->
|
|
|
+ #{
|
|
|
+ metrics => ?METRICS(
|
|
|
+ Matched,
|
|
|
+ Passed,
|
|
|
+ Failed,
|
|
|
+ FailedEx,
|
|
|
+ FailedNoRes,
|
|
|
+ OTotal,
|
|
|
+ OFailed,
|
|
|
+ OFailedOOS,
|
|
|
+ OFailedUnknown,
|
|
|
+ OFailedSucc,
|
|
|
+ Current,
|
|
|
+ Max,
|
|
|
+ Last5M
|
|
|
+ ),
|
|
|
+ node => Node
|
|
|
+ };
|
|
|
+ (Node, _Metrics) ->
|
|
|
+ %% Empty metrics: can happen when a node joins another and a bridge is not yet
|
|
|
+ %% replicated to it, so the counters map is empty.
|
|
|
+ #{
|
|
|
+ metrics => ?METRICS(
|
|
|
+ _Matched = 0,
|
|
|
+ _Passed = 0,
|
|
|
+ _Failed = 0,
|
|
|
+ _FailedEx = 0,
|
|
|
+ _FailedNoRes = 0,
|
|
|
+ _OTotal = 0,
|
|
|
+ _OFailed = 0,
|
|
|
+ _OFailedOOS = 0,
|
|
|
+ _OFailedUnknown = 0,
|
|
|
+ _OFailedSucc = 0,
|
|
|
+ _Current = 0,
|
|
|
+ _Max = 0,
|
|
|
+ _Last5M = 0
|
|
|
+ ),
|
|
|
+ node => Node
|
|
|
+ }
|
|
|
end,
|
|
|
[
|
|
|
Format(Node, emqx_plugin_libs_proto_v1:get_metrics(Node, rule_metrics, Id))
|