Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Room Statistics #4338

Merged
merged 93 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
a34061d
WIP of tracking per-room and per-user stats
ara4n Jul 18, 2018
c82785f
flake8
ara4n Jul 18, 2018
6dacdd5
WIP for updating the stats store
ara4n Jul 18, 2018
1875298
hook up state deltas to stats
ara4n Jul 18, 2018
03bdbb8
typo
ara4n Dec 29, 2018
a9f535f
Merge remote-tracking branch 'origin/matthew/stats' into hawkowl/room…
hawkowl Dec 31, 2018
087cfa6
fixups
hawkowl Dec 31, 2018
cd1caa9
black and cleanups
hawkowl Dec 31, 2018
0fb5123
changelog
hawkowl Dec 31, 2018
b5de929
fix
hawkowl Jan 2, 2019
abfaba4
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Jan 31, 2019
7d68675
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Feb 27, 2019
8df031d
fix
hawkowl Feb 27, 2019
c6dacf6
fixes
hawkowl Feb 27, 2019
ae2f002
fixes
hawkowl Feb 28, 2019
d85dd46
fixes
hawkowl Feb 28, 2019
896fa6e
fixes
hawkowl Feb 28, 2019
c0c3a49
fixes
hawkowl Feb 28, 2019
d45f68a
fixes
hawkowl Feb 28, 2019
8cd2457
fixes
hawkowl Feb 28, 2019
40c75b8
fixes
hawkowl Feb 28, 2019
9c1ae80
fixes
hawkowl Feb 28, 2019
f2b4b9e
tests
hawkowl Feb 28, 2019
1e6afd6
tests
hawkowl Feb 28, 2019
9918911
tests
hawkowl Feb 28, 2019
1526e24
isort
hawkowl Feb 28, 2019
d560f43
tests
hawkowl Feb 28, 2019
cab6b0d
tests
hawkowl Feb 28, 2019
c4f2b98
Merge branch 'hawkowl/room-stats' of ssh://github.com/matrix-org/syna…
hawkowl Mar 7, 2019
97f2943
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 7, 2019
5c6358d
Merge branch 'hawkowl/room-stats' of github.com:matrix-org/synapse in…
hawkowl Mar 11, 2019
97290a2
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 11, 2019
0ef5b04
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 19, 2019
4d90896
pep8
hawkowl Mar 19, 2019
282de7f
config fix
hawkowl Mar 19, 2019
c0932ce
config fix
hawkowl Mar 19, 2019
492d73c
config fix
hawkowl Mar 19, 2019
d279cbd
config fix
hawkowl Mar 19, 2019
0963af5
fix stats
hawkowl Mar 19, 2019
27260f2
fix stats
hawkowl Mar 19, 2019
c49846c
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 21, 2019
8d9884e
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 21, 2019
a79acf5
fix
hawkowl Mar 25, 2019
5dc9936
fix
hawkowl Mar 25, 2019
11ab570
fix
hawkowl Mar 25, 2019
615f94a
cleanups
hawkowl Mar 25, 2019
9afe329
cleanups
hawkowl Mar 25, 2019
58f3fb4
cleanups
hawkowl Mar 25, 2019
6025fd6
cleanups
hawkowl Mar 25, 2019
ace21a2
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 26, 2019
de22de8
make it work based on the state event, not the number of rooms
hawkowl Mar 26, 2019
c7e6a46
changelog
hawkowl Mar 26, 2019
2636ffc
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 27, 2019
169085a
turn it on by default
hawkowl Mar 27, 2019
340ffe0
cleanups
hawkowl Mar 28, 2019
3ca5d0b
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Mar 28, 2019
c91388a
black
hawkowl Mar 28, 2019
b13dc64
fixes + tests
hawkowl Mar 28, 2019
5c1e2b2
use proper time
hawkowl Mar 28, 2019
263170e
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Apr 2, 2019
2809a4b
review comments
hawkowl Apr 2, 2019
f07bcf5
fix tests
hawkowl Apr 2, 2019
22169dc
cleanups
hawkowl Apr 3, 2019
5074aca
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Apr 3, 2019
45dbb51
Update synapse/storage/stats.py
erikjohnston Apr 4, 2019
1cca447
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Apr 4, 2019
9b29621
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Apr 8, 2019
b76289d
review comments
hawkowl Apr 8, 2019
c99ce35
some docs
hawkowl Apr 9, 2019
e9e887c
test some falling-off-branches
hawkowl Apr 10, 2019
6541652
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl Apr 10, 2019
ac685f6
some cleanups and docs
hawkowl Apr 10, 2019
2d631a2
fix
hawkowl Apr 10, 2019
bd18134
fix
hawkowl May 10, 2019
b8365a6
Merge remote-tracking branch 'origin/develop' into hawkowl/test-confi…
hawkowl May 10, 2019
cafe839
fixes, porting
hawkowl May 10, 2019
d963a11
fixes, porting
hawkowl May 10, 2019
ec3d07c
changelog
hawkowl May 10, 2019
1ba0ecc
finish porting
hawkowl May 10, 2019
f531fa4
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl May 10, 2019
4cfe79b
Merge branch 'hawkowl/test-config-parse' into hawkowl/room-stats
hawkowl May 10, 2019
9fac614
fix
hawkowl May 10, 2019
0bd23bb
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl May 13, 2019
1df0d8d
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl May 17, 2019
35410c4
enable -> enabled
hawkowl May 17, 2019
adec289
cleanup
hawkowl May 17, 2019
0094b65
cleanup
hawkowl May 17, 2019
f1ab663
cleanup
hawkowl May 17, 2019
3c49fa0
Merge remote-tracking branch 'origin/develop' into hawkowl/room-stats
hawkowl May 21, 2019
7b1ffe5
fixes
hawkowl May 21, 2019
55f49e6
fixes
hawkowl May 21, 2019
0f2b24a
fixes
hawkowl May 21, 2019
d7fa363
fixes
hawkowl May 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/4338.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Synapse now more efficiently collates room statistics.
9 changes: 9 additions & 0 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,15 @@ password_config:
#



# Stats configuration
hawkowl marked this conversation as resolved.
Show resolved Hide resolved
#
# stats:
# enable: true
# bucket_size: 86400 # 1 day
hawkowl marked this conversation as resolved.
Show resolved Hide resolved
# retention: 31536000 # 1 year


# Server Notices room configuration
#
# Uncomment this section to enable a room which can be used to send notices
Expand Down
1 change: 1 addition & 0 deletions synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class EventTypes(object):

RoomHistoryVisibility = "m.room.history_visibility"
CanonicalAlias = "m.room.canonical_alias"
Encryption = "m.room.encryption"
RoomAvatar = "m.room.avatar"
RoomEncryption = "m.room.encryption"
GuestAccess = "m.room.guest_access"
Expand Down
42 changes: 32 additions & 10 deletions synapse/config/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .api import ApiConfig
from .appservice import AppServiceConfig
from .captcha import CaptchaConfig
Expand All @@ -36,20 +37,41 @@
from .server import ServerConfig
from .server_notices_config import ServerNoticesConfig
from .spam_checker import SpamCheckerConfig
from .stats import StatsConfig
from .tls import TlsConfig
from .user_directory import UserDirectoryConfig
from .voip import VoipConfig
from .workers import WorkerConfig


class HomeServerConfig(ServerConfig, TlsConfig, DatabaseConfig, LoggingConfig,
RatelimitConfig, ContentRepositoryConfig, CaptchaConfig,
VoipConfig, RegistrationConfig, MetricsConfig, ApiConfig,
AppServiceConfig, KeyConfig, SAML2Config, CasConfig,
JWTConfig, PasswordConfig, EmailConfig,
WorkerConfig, PasswordAuthProviderConfig, PushConfig,
SpamCheckerConfig, GroupsConfig, UserDirectoryConfig,
ConsentConfig,
ServerNoticesConfig, RoomDirectoryConfig,
):
class HomeServerConfig(
ServerConfig,
TlsConfig,
DatabaseConfig,
LoggingConfig,
RatelimitConfig,
ContentRepositoryConfig,
CaptchaConfig,
VoipConfig,
RegistrationConfig,
MetricsConfig,
ApiConfig,
AppServiceConfig,
KeyConfig,
SAML2Config,
CasConfig,
JWTConfig,
PasswordConfig,
EmailConfig,
WorkerConfig,
PasswordAuthProviderConfig,
PushConfig,
SpamCheckerConfig,
GroupsConfig,
UserDirectoryConfig,
ConsentConfig,
StatsConfig,
ServerNoticesConfig,
RoomDirectoryConfig,
):
pass
46 changes: 46 additions & 0 deletions synapse/config/stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

from ._base import Config


class StatsConfig(Config):
"""Stats Configuration
Configuration for the behaviour of synapse's stats engine
"""

def read_config(self, config):
self.stats_enable = True
hawkowl marked this conversation as resolved.
Show resolved Hide resolved
self.stats_bucket_size = 86400
self.stats_retention = sys.maxsize
stats_config = config.get("stats", None)
if stats_config:
self.stats_enable = stats_config.get("enable", self.stats_enable)
self.stats_bucket_size = stats_config.get(
"bucket_size", self.stats_bucket_size
)
self.stats_retention = stats_config.get("retention", self.stats_retention)

def default_config(self, config_dir_path, server_name, **kwargs):
return """
# Stats configuration
#
# stats:
# enable: true
hawkowl marked this conversation as resolved.
Show resolved Hide resolved
# bucket_size: 86400 # 1 day
# retention: 31536000 # 1 year
hawkowl marked this conversation as resolved.
Show resolved Hide resolved
"""
Loading