production: Add optional support for submitting usage statistics.

See documentation for details.
This commit is contained in:
Tim Abbott
2019-02-11 20:54:17 -08:00
parent de2f1ee0c4
commit 216d2ec1bf
5 changed files with 28 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ from django.utils.timezone import utc as timezone_utc
from analytics.lib.counts import COUNT_STATS, logger, process_count_stat
from scripts.lib.zulip_tools import ENDC, WARNING
from zerver.lib.remote_server import send_analytics_to_remote_server
from zerver.lib.timestamp import floor_to_hour
from zerver.models import Realm
@@ -84,3 +85,6 @@ class Command(BaseCommand):
print("Finished updating analytics counts through %s in %.3fs" %
(fill_to_time, time.time() - start))
logger.info("Finished updating analytics counts through %s" % (fill_to_time,))
if settings.PUSH_NOTIFICATION_BOUNCER_URL and settings.SUBMIT_USAGE_STATISTICS:
send_analytics_to_remote_server()

View File

@@ -130,6 +130,21 @@ and privacy in mind:
If you have any questions about the security model, contact
support@zulipchat.com.
## Submitting statistics
Systems using the Mobile Push Notifications Service will, by default,
submit basic usage statistics (e.g. Zulip version, number of users,
number of messages sent) to the service. These statistics help the
Zulip open source project understand how many people are using Zulip,
and help us allocate resources towards supporting self-hosted
installations.
Our use of these statistics is governed by the same ToS and
Privacy Policy that covers the Mobile Push Notifications Service
itself. If your organization does not want to submit these
statistics, you can disable this feature at any time by setting
`SUBMIT_USAGE_STATISTICS=False` in `/etc/zulip/settings.py`.
## Legacy signup
Here are legacy instructions for signing a server up for push

View File

@@ -131,6 +131,7 @@ def send_analytics_to_remote_server() -> None:
request = {
'realm_counts': ujson.dumps(realm_count_data),
'installation_counts': ujson.dumps(installation_count_data),
'version': ujson.dumps(ZULIP_VERSION),
}
# Gather only entries with an ID greater than last_realm_count_id

View File

@@ -223,6 +223,13 @@ SSO_APPEND_DOMAIN = None # type: Optional[str]
# notification encryption feature.
#PUSH_NOTIFICATION_REDACT_CONTENT = False
# Whether to submit basic usage statistics to help the Zulip core team. Details at
#
# https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html
#
# Defaults to True if and only if the Mobile Push Notifications Service is enabled.
#SUBMIT_USAGE_STATISTICS = True
# Controls whether session cookies expire when the browser closes
SESSION_EXPIRE_AT_BROWSER_CLOSE = False

View File

@@ -226,6 +226,7 @@ DEFAULT_SETTINGS = {
'PASSWORD_MIN_GUESSES': 10000,
'PUSH_NOTIFICATION_BOUNCER_URL': None,
'PUSH_NOTIFICATION_REDACT_CONTENT': False,
'SUBMIT_USAGE_STATISTICS': True,
'RATE_LIMITING': True,
'SEND_LOGIN_EMAILS': True,
'EMBEDDED_BOTS_ENABLED': False,