Skip to content

Commit

Permalink
Merge pull request #3678 from esl/mam_muc_lookup_metric
Browse files Browse the repository at this point in the history
Add metric parallel to the one for 1:1 chats
  • Loading branch information
chrzaszcz authored Jun 10, 2022
2 parents 949d82a + 1fe9050 commit 7aabb41
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mam/mod_mam_muc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,11 @@ lookup_messages_without_policy_violation_check(HostType,
true -> %% Use of disabled full text search
{error, 'not-supported'};
false ->
mongoose_hooks:mam_muc_lookup_messages(HostType, Params)
StartT = erlang:monotonic_time(microsecond),
R = mongoose_hooks:mam_muc_lookup_messages(HostType, Params),
Diff = erlang:monotonic_time(microsecond) - StartT,
mongoose_metrics:update(HostType, [backends, ?MODULE, lookup], Diff),
R
end.

archive_message_for_ct(Params = #{local_jid := RoomJid}) ->
Expand Down Expand Up @@ -671,6 +675,7 @@ remove_iq_handlers(HostType) ->
ok.

ensure_metrics(HostType) ->
mongoose_metrics:ensure_metric(HostType, [backends, ?MODULE, lookup], histogram),
lists:foreach(fun(Name) ->
mongoose_metrics:ensure_metric(HostType, Name, spiral)
end,
Expand Down

0 comments on commit 7aabb41

Please sign in to comment.