Skip to content
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

0111 unregister session with timestamp #12326

Merged
merged 9 commits into from Feb 2, 2024

Conversation

zmstone
Copy link
Member

@zmstone zmstone commented Jan 15, 2024

Fixes 11737

Release version: v/e5.6.0

Summary

Add a new config to enable recording session unregister with a timestamp.
This timestamp can be used to count/query the number of unique clients connected during the the past X seconds/minutes/hours/days.

Demo

  • Start EMQX with env EMQX_BROKER__session_history_retain='1m' to retain expired sessions for 1 minute.
  • Connect a client.
  • Observe session count with API:
$ curl 'http://admin:ppp@localhost:18083/api/v5/sessions_count'
1⏎
  • Disconnect the client, and wait for up to 1.5min, the API should return 0

image

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Added property-based tests for code which performs user input validation
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix|breaking)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • Created PR to emqx-docs if documentation update is required, or link to a follow-up jira ticket
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch 5 times, most recently from 9e1178e to a088715 Compare January 15, 2024 16:50
@ieQu1
Copy link
Member

ieQu1 commented Jan 16, 2024

@zmstone
Copy link
Member Author

zmstone commented Jan 18, 2024

@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch 2 times, most recently from 81a6f2e to 466869f Compare January 19, 2024 16:34
@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch from 97b87af to 77b5fc9 Compare January 19, 2024 16:46
@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch from 77b5fc9 to 386dd6b Compare January 19, 2024 16:51
@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch 2 times, most recently from 3aa7ab5 to 77455bb Compare January 19, 2024 20:39
@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch from 77455bb to 0853b7e Compare January 26, 2024 15:50
@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch from 0853b7e to 3804710 Compare January 31, 2024 08:51
@zmstone zmstone marked this pull request as ready for review February 1, 2024 13:19
@zmstone zmstone requested review from JimMoen, a team and lafirest as code owners February 1, 2024 13:19
thalesmg
thalesmg previously approved these changes Feb 1, 2024
apps/emqx/test/emqx_cm_registry_keeper_SUITE.erl Outdated Show resolved Hide resolved
apps/emqx/src/emqx_schema.erl Show resolved Hide resolved
apps/emqx/src/emqx_cm_registry.erl Outdated Show resolved Hide resolved
apps/emqx/include/emqx_cm.hrl Outdated Show resolved Hide resolved
apps/emqx_management/src/emqx_mgmt_api_clients.erl Outdated Show resolved Hide resolved
rel/i18n/emqx_schema.hocon Outdated Show resolved Hide resolved
rel/i18n/emqx_schema.hocon Outdated Show resolved Hide resolved
apps/emqx/src/emqx_cm_registry_keeper.erl Outdated Show resolved Hide resolved
apps/emqx/src/emqx_cm_registry_keeper.erl Outdated Show resolved Hide resolved
@zmstone zmstone force-pushed the 0111-unregister-session-with-timestamp branch from 409466a to f0569d8 Compare February 2, 2024 08:27
@zmstone zmstone merged commit b1a05c7 into emqx:master Feb 2, 2024
165 checks passed
@zmstone zmstone deleted the 0111-unregister-session-with-timestamp branch February 2, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants