-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrument/hook handlers - session #4305
Instrument/hook handlers - session #4305
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/instrument #4305 +/- ##
======================================================
- Coverage 84.73% 84.67% -0.07%
======================================================
Files 557 557
Lines 33888 33889 +1
======================================================
- Hits 28714 28694 -20
- Misses 5174 5195 +21 ☔ View full report in Codecov by Sentry. |
10bbb5f
to
326c6a4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
326c6a4
to
1b5489e
Compare
This comment was marked as outdated.
This comment was marked as outdated.
f4bb23a
to
9abfcc2
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
9abfcc2
to
4d17179
Compare
This comment was marked as outdated.
This comment was marked as outdated.
4d17179
to
af516eb
Compare
Keep the session count as a counter, and update it accordingly. It was not a probe for performance reasons, and it stays that way. sm_presence_subscription becomes per-host-type for consistency.
It needs to be a gauge, because a counter is more like a spiral, and it can only be increased.
Some of them should be already removed.
Also: ensure that a spiral can't be decreased.
This test is a bit dirty. It should be rewritten, because it makes the system inconsistent. Details in the comments.
The implementation has changed to include the host type.
- Use instrumentation events - Parallelize tests
af516eb
to
7baafa9
Compare
This comment was marked as outdated.
This comment was marked as outdated.
As we add more events, the tests started failing, because they were expecting all possible events including c2s_auth_failed.
elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / ccb47ee small_tests_25 / small_tests / ccb47ee small_tests_26 / small_tests / ccb47ee small_tests_26_arm64 / small_tests / ccb47ee ldap_mnesia_25 / ldap_mnesia / ccb47ee dynamic_domains_mysql_redis_26 / mysql_redis / ccb47ee dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / ccb47ee ldap_mnesia_26 / ldap_mnesia / ccb47ee dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / ccb47ee dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / ccb47ee tr_util_SUITE:c2s_elements{error,{{badmatch,[#{name => <<"message">>,type => <<"chat">>,
hooks => [user_send_packet],
jid =>
<<"alice_c2s_elements_3184@domain.example.com/res1">>,
to_jid =>
<<"bob_c2s_elements_3184@domain.example.com/res1">>,
from_jid =>
<<"alice_c2s_elements_3184@domain.example.com/res1">>,
ref => #Ref<10231.2178159122.1897398273.69577>,
contents => <<"<body>Hello</body>">>},
#{name => <<"message">>,type => <<"chat">>,
hooks => [user_receive_packet,user_receive_message],
jid =>
<<"bob_c2s_elements_3184@domain.example.com/res1">>,
to_jid =>
<<"bob_c2s_elements_3184@domain.example.com/res1">>,
from_jid =>
<<"alice_c2s_elements_3184@domain.example.com/res1">>,
ref => #Ref<10231.2178159122.1897398273.69584>,
contents => <<"<body>Hello</body>">>},
#{name => <<"message">>,type => <<"chat">>,
hooks => [user_send_message],
jid =>
<<"alice_c2s_elements_3184@domain.example.com/res1">>,
to_jid =>
<<"bob_c2s_elements_3184@domain.example.com/res1">>,
from_jid =>
<<"alice_c2s_elements_3184@domain.example.com/res1">>,
ref => #Ref<10231.2178159122.1897398273.69577>,
contents => <<"<body>Hello</body>">>},
#{name => <<"message">>,type => <<"chat">>,
... pgsql_cets_26 / pgsql_cets / ccb47ee internal_mnesia_26 / internal_mnesia / ccb47ee pgsql_mnesia_25 / pgsql_mnesia / ccb47ee mysql_redis_26 / mysql_redis / ccb47ee pgsql_mnesia_26 / pgsql_mnesia / ccb47ee mssql_mnesia_26 / odbc_mssql_mnesia / ccb47ee dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / ccb47ee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
The goal is to use
mongoose_instrument
rather than hook handlers andmongoose_metrics
for session-related events.c2s_auth_failed
inmongoose_c2s
.sm_session
event withlogins
,logouts
andcount
metrics. I decided to keep it as one event to be able to increment and decrement the session count.counter
metric. In Prometheus, it is a gauge.sessions_cleanup
test inlast_SUITE
, because it was creating sessions with processes from another node, causing confusion and inconsistent metrics. As agreed with @arcusfelis, this test could be reworked and re-enabled later.Notes:
auth_failed
hook has no handlers now, but I thought it might still be useful.