fix(kafka): fix handling of `dropped.queue_full` event from wolff

https://emqx.atlassian.net/browse/EMQX-8530

cd20a37e65/src/wolff_producer.erl (L772-L773)

Wolff emits 2 events related to dropped messages when replayq reports
overflow.  Since in EMQX's side we also bump `dropped` when
`dropped_queue_full` happens, that was leading to wrong metrics.
This commit is contained in:
Thales Macedo Garitezi 2023-01-02 09:23:38 -03:00
parent 305ed68916
commit 69ac6b9e0d
1 changed files with 8 additions and 1 deletions

View File

@ -318,7 +318,14 @@ handle_telemetry_event(
#{bridge_id := ID},
#{bridge_id := ID}
) when is_integer(Val) ->
emqx_resource_metrics:dropped_queue_full_inc(ID, Val);
%% When wolff emits a `dropped_queue_full' event due to replayq
%% overflow, it also emits a `dropped' event (at the time of
%% writing, wolff is 1.7.4). Since we already bump `dropped' when
%% `dropped.queue_full' occurs, we have to correct it here. This
%% correction will have to be dropped if wolff stops also emitting
%% `dropped'.
emqx_resource_metrics:dropped_queue_full_inc(ID, Val),
emqx_resource_metrics:dropped_inc(ID, -Val);
handle_telemetry_event(
[wolff, queuing],
#{gauge_set := Val},