Skip to content

Commit 89cb613

Browse files
authored
Revert "Add total event, unencrypted message, and e2ee event counts to stats reporting" (#18346)
Reverts #18260 It is causing a failure when building release debs for `debian:bullseye` with the following error: ``` sqlite3.OperationalError: near "RETURNING": syntax error ```
1 parent c16a981 commit 89cb613

File tree

10 files changed

+10
-907
lines changed

10 files changed

+10
-907
lines changed

changelog.d/18260.feature

-1
This file was deleted.

docs/usage/administration/monitoring/reporting_homeserver_usage_statistics.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ The following statistics are sent to the configured reporting endpoint:
3030
| `python_version` | string | The Python version number in use (e.g "3.7.1"). Taken from `sys.version_info`. |
3131
| `total_users` | int | The number of registered users on the homeserver. |
3232
| `total_nonbridged_users` | int | The number of users, excluding those created by an Application Service. |
33-
| `daily_user_type_native` | int | The number of native, non-guest users created in the last 24 hours. |
33+
| `daily_user_type_native` | int | The number of native users created in the last 24 hours. |
3434
| `daily_user_type_guest` | int | The number of guest users created in the last 24 hours. |
3535
| `daily_user_type_bridged` | int | The number of users created by Application Services in the last 24 hours. |
3636
| `total_room_count` | int | The total number of rooms present on the homeserver. |
37-
| `total_event_count` | int | The total number of events present on the homeserver. |
38-
| `total_message_count` | int | The total number of non-state events with type `m.room.message` present on the homeserver. |
39-
| `total_e2ee_event_count` | int | The total number of non-state events with type `m.room.encrypted` present on the homeserver. This can be used as a slight over-estimate for the number of encrypted messages. |
4037
| `daily_active_users` | int | The number of unique users[^1] that have used the homeserver in the last 24 hours. |
4138
| `monthly_active_users` | int | The number of unique users[^1] that have used the homeserver in the last 30 days. |
4239
| `daily_active_rooms` | int | The number of rooms that have had a (state) event with the type `m.room.message` sent in them in the last 24 hours. |
@@ -53,8 +50,8 @@ The following statistics are sent to the configured reporting endpoint:
5350
| `cache_factor` | int | The configured [`global factor`](../../configuration/config_documentation.md#caching) value for caching. |
5451
| `event_cache_size` | int | The configured [`event_cache_size`](../../configuration/config_documentation.md#caching) value for caching. |
5552
| `database_engine` | string | The database engine that is in use. Either "psycopg2" meaning PostgreSQL is in use, or "sqlite3" for SQLite3. |
56-
| `database_server_version` | string | The version of the database server. Examples being "10.10" for PostgreSQL server version 10.0, and "3.38.5" for SQLite 3.38.5 installed on the system. |
57-
| `log_level` | string | The log level in use. Examples are "INFO", "WARNING", "ERROR", "DEBUG", etc. |
53+
| `database_server_version` | string | The version of the database server. Examples being "10.10" for PostgreSQL server version 10.0, and "3.38.5" for SQLite 3.38.5 installed on the system. |
54+
| `log_level` | string | The log level in use. Examples are "INFO", "WARNING", "ERROR", "DEBUG", etc. |
5855

5956

6057
[^1]: Native matrix users and guests are always counted. If the

synapse/app/phone_stats_home.py

+5-36
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,6 @@
3434

3535
logger = logging.getLogger("synapse.app.homeserver")
3636

37-
ONE_MINUTE_SECONDS = 60
38-
ONE_HOUR_SECONDS = 60 * ONE_MINUTE_SECONDS
39-
40-
MILLISECONDS_PER_SECOND = 1000
41-
42-
INITIAL_DELAY_BEFORE_FIRST_PHONE_HOME_SECONDS = 5 * ONE_MINUTE_SECONDS
43-
"""
44-
We wait 5 minutes to send the first set of stats as the server can be quite busy the
45-
first few minutes
46-
"""
47-
48-
PHONE_HOME_INTERVAL_SECONDS = 3 * ONE_HOUR_SECONDS
49-
"""
50-
Phone home stats are sent every 3 hours
51-
"""
52-
5337
# Contains the list of processes we will be monitoring
5438
# currently either 0 or 1
5539
_stats_process: List[Tuple[int, "resource.struct_rusage"]] = []
@@ -137,9 +121,6 @@ async def phone_stats_home(
137121

138122
room_count = await store.get_room_count()
139123
stats["total_room_count"] = room_count
140-
stats["total_event_count"] = await store.count_total_events()
141-
stats["total_message_count"] = await store.count_total_messages()
142-
stats["total_e2ee_event_count"] = await store.count_total_e2ee_events()
143124

144125
stats["daily_active_users"] = common_metrics.daily_active_users
145126
stats["monthly_active_users"] = await store.count_monthly_users()
@@ -204,14 +185,12 @@ def performance_stats_init() -> None:
204185
# If you increase the loop period, the accuracy of user_daily_visits
205186
# table will decrease
206187
clock.looping_call(
207-
hs.get_datastores().main.generate_user_daily_visits,
208-
5 * ONE_MINUTE_SECONDS * MILLISECONDS_PER_SECOND,
188+
hs.get_datastores().main.generate_user_daily_visits, 5 * 60 * 1000
209189
)
210190

211191
# monthly active user limiting functionality
212192
clock.looping_call(
213-
hs.get_datastores().main.reap_monthly_active_users,
214-
ONE_HOUR_SECONDS * MILLISECONDS_PER_SECOND,
193+
hs.get_datastores().main.reap_monthly_active_users, 1000 * 60 * 60
215194
)
216195
hs.get_datastores().main.reap_monthly_active_users()
217196

@@ -237,27 +216,17 @@ async def generate_monthly_active_users() -> None:
237216

238217
if hs.config.server.limit_usage_by_mau or hs.config.server.mau_stats_only:
239218
generate_monthly_active_users()
240-
clock.looping_call(
241-
generate_monthly_active_users,
242-
5 * ONE_MINUTE_SECONDS * MILLISECONDS_PER_SECOND,
243-
)
219+
clock.looping_call(generate_monthly_active_users, 5 * 60 * 1000)
244220
# End of monthly active user settings
245221

246222
if hs.config.metrics.report_stats:
247223
logger.info("Scheduling stats reporting for 3 hour intervals")
248-
clock.looping_call(
249-
phone_stats_home,
250-
PHONE_HOME_INTERVAL_SECONDS * MILLISECONDS_PER_SECOND,
251-
hs,
252-
stats,
253-
)
224+
clock.looping_call(phone_stats_home, 3 * 60 * 60 * 1000, hs, stats)
254225

255226
# We need to defer this init for the cases that we daemonize
256227
# otherwise the process ID we get is that of the non-daemon process
257228
clock.call_later(0, performance_stats_init)
258229

259230
# We wait 5 minutes to send the first set of stats as the server can
260231
# be quite busy the first few minutes
261-
clock.call_later(
262-
INITIAL_DELAY_BEFORE_FIRST_PHONE_HOME_SECONDS, phone_stats_home, hs, stats
263-
)
232+
clock.call_later(5 * 60, phone_stats_home, hs, stats)

0 commit comments

Comments
 (0)