refactor(resource): remove metrics 'sent.exception'

This commit is contained in:
Shawn 2022-09-02 12:41:54 +08:00
parent b45f3de8db
commit 83f21b4c65
6 changed files with 5 additions and 24 deletions

View File

@ -181,16 +181,6 @@ emqx_bridge_schema {
zh: "已发送" zh: "已发送"
} }
} }
metric_sent_exception {
desc {
en: """Count of messages that were sent but exceptions occur."""
zh: """发送出现异常的消息个数。"""
}
label: {
en: "Sent Exception"
zh: "发送异常"
}
}
metric_sent_failed { metric_sent_failed {
desc { desc {

View File

@ -1,6 +1,6 @@
-define(EMPTY_METRICS, -define(EMPTY_METRICS,
?METRICS( ?METRICS(
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
) )
). ).
@ -15,7 +15,6 @@
Matched, Matched,
Queued, Queued,
Sent, Sent,
SentExcpt,
SentFailed, SentFailed,
SentInflight, SentInflight,
SentSucc, SentSucc,
@ -35,7 +34,6 @@
'matched' => Matched, 'matched' => Matched,
'queuing' => Queued, 'queuing' => Queued,
'sent' => Sent, 'sent' => Sent,
'sent.exception' => SentExcpt,
'sent.failed' => SentFailed, 'sent.failed' => SentFailed,
'sent.inflight' => SentInflight, 'sent.inflight' => SentInflight,
'sent.success' => SentSucc, 'sent.success' => SentSucc,
@ -57,7 +55,6 @@
Matched, Matched,
Queued, Queued,
Sent, Sent,
SentExcpt,
SentFailed, SentFailed,
SentInflight, SentInflight,
SentSucc, SentSucc,
@ -77,7 +74,6 @@
'matched' := Matched, 'matched' := Matched,
'queuing' := Queued, 'queuing' := Queued,
'sent' := Sent, 'sent' := Sent,
'sent.exception' := SentExcpt,
'sent.failed' := SentFailed, 'sent.failed' := SentFailed,
'sent.inflight' := SentInflight, 'sent.inflight' := SentInflight,
'sent.success' := SentSucc, 'sent.success' := SentSucc,

View File

@ -617,11 +617,11 @@ aggregate_metrics(AllMetrics) ->
fun( fun(
#{ #{
metrics := ?metrics( metrics := ?metrics(
M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15, M16, M17, M18 M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15, M16, M17
) )
}, },
?metrics( ?metrics(
N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13, N14, N15, N16, N17, N18 N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13, N14, N15, N16, N17
) )
) -> ) ->
?METRICS( ?METRICS(
@ -641,8 +641,7 @@ aggregate_metrics(AllMetrics) ->
M14 + N14, M14 + N14,
M15 + N15, M15 + N15,
M16 + N16, M16 + N16,
M17 + N17, M17 + N17
M18 + N18
) )
end, end,
InitMetrics, InitMetrics,
@ -682,7 +681,6 @@ format_metrics(#{
'matched' := Matched, 'matched' := Matched,
'queuing' := Queued, 'queuing' := Queued,
'sent' := Sent, 'sent' := Sent,
'sent.exception' := SentExcpt,
'sent.failed' := SentFailed, 'sent.failed' := SentFailed,
'sent.inflight' := SentInflight, 'sent.inflight' := SentInflight,
'sent.success' := SentSucc, 'sent.success' := SentSucc,
@ -703,7 +701,6 @@ format_metrics(#{
Matched, Matched,
Queued, Queued,
Sent, Sent,
SentExcpt,
SentFailed, SentFailed,
SentInflight, SentInflight,
SentSucc, SentSucc,

View File

@ -115,7 +115,6 @@ fields("metrics") ->
{"matched", mk(integer(), #{desc => ?DESC("metric_matched")})}, {"matched", mk(integer(), #{desc => ?DESC("metric_matched")})},
{"queuing", mk(integer(), #{desc => ?DESC("metric_queuing")})}, {"queuing", mk(integer(), #{desc => ?DESC("metric_queuing")})},
{"sent", mk(integer(), #{desc => ?DESC("metric_sent")})}, {"sent", mk(integer(), #{desc => ?DESC("metric_sent")})},
{"sent.exception", mk(integer(), #{desc => ?DESC("metric_sent_exception")})},
{"sent.failed", mk(integer(), #{desc => ?DESC("metric_sent_failed")})}, {"sent.failed", mk(integer(), #{desc => ?DESC("metric_sent_failed")})},
{"sent.inflight", mk(integer(), #{desc => ?DESC("metric_sent_inflight")})}, {"sent.inflight", mk(integer(), #{desc => ?DESC("metric_sent_inflight")})},
{"sent.success", mk(integer(), #{desc => ?DESC("metric_sent_success")})}, {"sent.success", mk(integer(), #{desc => ?DESC("metric_sent_success")})},

View File

@ -136,7 +136,6 @@ create(MgrId, ResId, Group, ResourceType, Config, Opts) ->
'batching', 'batching',
'sent.success', 'sent.success',
'sent.failed', 'sent.failed',
'sent.exception',
'sent.inflight', 'sent.inflight',
'dropped.queue_not_enabled', 'dropped.queue_not_enabled',
'dropped.queue_full', 'dropped.queue_full',

View File

@ -375,7 +375,7 @@ reply_caller(Id, ?REPLY(From, _, Result), BlockWorker) ->
handle_query_result(Id, Result, BlockWorker). handle_query_result(Id, Result, BlockWorker).
handle_query_result(Id, ?RESOURCE_ERROR_M(exception, _), BlockWorker) -> handle_query_result(Id, ?RESOURCE_ERROR_M(exception, _), BlockWorker) ->
emqx_metrics_worker:inc(?RES_METRICS, Id, 'sent.exception'), emqx_metrics_worker:inc(?RES_METRICS, Id, 'sent.failed'),
BlockWorker; BlockWorker;
handle_query_result(_Id, ?RESOURCE_ERROR_M(NotWorking, _), _) when handle_query_result(_Id, ?RESOURCE_ERROR_M(NotWorking, _), _) when
NotWorking == not_connected; NotWorking == blocked NotWorking == not_connected; NotWorking == blocked