From 1fe90500aad4f4ca0dce40c674cce1f7956821cb Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Thu, 9 Jun 2022 20:07:07 +0200 Subject: [PATCH] Add metric parallel to the one for 1:1 chats --- src/mam/mod_mam_muc.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mam/mod_mam_muc.erl b/src/mam/mod_mam_muc.erl index c8b47801947..5059ce3a461 100644 --- a/src/mam/mod_mam_muc.erl +++ b/src/mam/mod_mam_muc.erl @@ -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}) -> @@ -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,