emqx_dashboard.hrl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2020-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. -define(ADMIN, emqx_admin).
  17. -record(?ADMIN, {
  18. username :: binary(),
  19. pwdhash :: binary(),
  20. description :: binary(),
  21. role = undefined :: atom(),
  22. %% not used so far, for future extension
  23. extra = [] :: term()
  24. }).
  25. -define(ADMIN_JWT, emqx_admin_jwt).
  26. -record(?ADMIN_JWT, {
  27. token :: binary(),
  28. username :: binary(),
  29. exptime :: integer(),
  30. %% not used so far, fur future extension
  31. extra = [] :: term()
  32. }).
  33. -define(TAB_COLLECT, emqx_collect).
  34. -define(EMPTY_KEY(Key), ((Key == undefined) orelse (Key == <<>>))).
  35. -define(DASHBOARD_SHARD, emqx_dashboard_shard).
  36. -ifdef(TEST).
  37. %% for test
  38. -define(DEFAULT_SAMPLE_INTERVAL, 1).
  39. -define(RPC_TIMEOUT, 50).
  40. -else.
  41. %% dashboard monitor do sample interval, default 10s
  42. -define(DEFAULT_SAMPLE_INTERVAL, 10).
  43. -define(RPC_TIMEOUT, 5000).
  44. -endif.
  45. -define(DELTA_SAMPLER_LIST, [
  46. received,
  47. %, received_bytes
  48. sent,
  49. %, sent_bytes
  50. dropped
  51. ]).
  52. -define(GAUGE_SAMPLER_LIST, [
  53. subscriptions,
  54. topics,
  55. connections,
  56. live_connections
  57. ]).
  58. -define(SAMPLER_LIST, ?GAUGE_SAMPLER_LIST ++ ?DELTA_SAMPLER_LIST).
  59. -define(DELTA_SAMPLER_RATE_MAP, #{
  60. received => received_msg_rate,
  61. %% In 5.0.0, temporarily comment it to suppress bytes rate
  62. %received_bytes => received_bytes_rate,
  63. %sent_bytes => sent_bytes_rate,
  64. sent => sent_msg_rate,
  65. dropped => dropped_msg_rate
  66. }).