From af7469ec8e07f6c4ce6a504c9617aef693d54b5b Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Thu, 4 Feb 2021 13:43:23 +0100 Subject: [PATCH] Fix modMucMamFlushed metric --- big_tests/tests/mam_SUITE.erl | 10 +++++++++- src/metrics/mongoose_metrics_definitions.hrl | 1 + src/metrics/mongoose_metrics_mam_hooks.erl | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/big_tests/tests/mam_SUITE.erl b/big_tests/tests/mam_SUITE.erl index 166eecd60d..8e8e22c810 100644 --- a/big_tests/tests/mam_SUITE.erl +++ b/big_tests/tests/mam_SUITE.erl @@ -933,7 +933,15 @@ init_per_testcase(C=muc_querying_for_all_messages_with_jid, Config) -> muc_bootstrap_archive(start_alice_room(Config1))); init_per_testcase(C=muc_archive_request, Config) -> Config1 = escalus_fresh:create_users(Config, [{alice, 1}, {bob, 1}]), - escalus:init_per_testcase(C, start_alice_room(Config1)); + Config2 = %% Check that metric is incremented on MUC flushed + case ?config(configuration, Config1) of + rdbms_async_pool -> + MongooseMetrics = [{['_', 'modMucMamFlushed'], changed}], + [{mongoose_metrics, MongooseMetrics} | Config1]; + _ -> + Config1 + end, + escalus:init_per_testcase(C, start_alice_room(Config2)); init_per_testcase(C=muc_no_elements, Config) -> rpc_apply(gen_mod, set_module_opts, [host(), mod_mam_muc, [no_stanzaid_element]]), Config1 = escalus_fresh:create_users(Config, [{alice, 1}, {bob, 1}]), diff --git a/src/metrics/mongoose_metrics_definitions.hrl b/src/metrics/mongoose_metrics_definitions.hrl index 7815bcfdd3..a2ad46335e 100644 --- a/src/metrics/mongoose_metrics_definitions.hrl +++ b/src/metrics/mongoose_metrics_definitions.hrl @@ -53,6 +53,7 @@ modMucMamLookups, modMucMamForwarded, modMucMamArchived, + modMucMamFlushed, modMucMamSinglePurges, modMucMamMultiplePurges, modCSIInactive, diff --git a/src/metrics/mongoose_metrics_mam_hooks.erl b/src/metrics/mongoose_metrics_mam_hooks.erl index d08a9c72b6..3c66c5dae7 100644 --- a/src/metrics/mongoose_metrics_mam_hooks.erl +++ b/src/metrics/mongoose_metrics_mam_hooks.erl @@ -46,7 +46,8 @@ get_hooks(Host) -> [mam_muc_get_prefs, Host, ?MODULE, mam_muc_get_prefs, 50], [mam_muc_archive_message, Host, ?MODULE, mam_muc_archive_message, 50], [mam_muc_remove_archive, Host, ?MODULE, mam_muc_remove_archive, 50], - [mam_muc_lookup_messages, Host, ?MODULE, mam_muc_lookup_messages, 100] + [mam_muc_lookup_messages, Host, ?MODULE, mam_muc_lookup_messages, 100], + [mam_muc_flush_messages, Host, ?MODULE, mam_muc_flush_messages, 50] ]. -spec mam_get_prefs(Result :: any(),