Smarty

  1. Home
  2. Docs
  3. Smarty
  4. Statistics
  5. Dynamics of subscribers

Dynamics of subscribers

До релиза Smarty 2.8 статистика для данного раздела хранилась в MongoDB, на данный момент все данные перенесены оттуда в SQL и Redis.

Для корректной миграции данных из MongoDB после обновления на Smarty 2.8 воспользуйтесь командой migrate_account_activity.

Функционал раздела

Данный раздел в основном будет полезен операторам, использующим внутреннюю логику биллинга Smarty, так как показывает данные по оплатам, происходящим внутри Smarty с помощью платежных шлюзов, а также опирается на механизмы работы команды check_accounts.

Каждый из виджетов можно добавить на главную, чтобы они показывались при открытии админки:

Настройка модуля сбора статистики по абонентам для MongoDB

Для отображения информации внутри вкладки «Динамика абонентов» в секции INSTALLED_APPS in a configuration file other than a module viewstats add a module smartystats .

After adding modules, all missing migrations must be installed by the team

smarty_manage migrate --settings=settings.smarty

And set up the correct work of management teams cache_max_online and save_stats.

Team cache_max_online responsible for updating the maximum number of online subscribers for statistics. You can run with any regularity, but at least once a day.

Team save_stats отвечает за сбор и хранение статистики по каждому клиенту для виджетов на экране «Динамика абонентов». Можно запускать с любой регулярностью, но не реже, чем раз в сутки.

To work with a large amount of data, it is recommended to configure asynchronous task execution through RQ.
More information about asynchronous tasks can be found in the section «Масштабирование и отказоустойчивость» — «Настройка асинхронного выполнения задач через RQ (Redis Queue)».

Additional teams to collect statistics

Collection of additional statistics for the report on the number of users

smarty_manage collect_daily_stats --settings=settings.

Данная команда собирает информацию, которая используется в отчетах по оплатам, а также в графиках «Оплаты сегодня» и «Абоненты, от которых поступила оплата» (и части других данных статистики) экрана «Динамика абонентов». Команду необходимо выполнять каждый день в начале дня (время записи сохраняется в UTC+0).

Data caching for subscriber dynamics graphs

smarty_manage cache_customers_dynamic --settings=settings.

The team is recommended to run once an hour. For small bases, the charts will work quickly and correctly and without a given command. At the first run, the command can be executed for a long time (depending on the number of accounts, transactions and tariffs) due to the fact that the data for the entire previous month will be calculated. When restarting, data will only be calculated for the last day or hour (the data is not cached again).

Additional parameters of the team:

-client_id - a list of customer identifiers, through a comma, for which caching is necessary. If nothing is transferred to the argument, then the data is cached for all customers.