aboutsummaryrefslogtreecommitdiff
path: root/keyserver
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-08-18 11:14:37 +0100
committerGitHub <noreply@github.com>2020-08-18 11:14:37 +0100
commite571e196ce67581996b429f349527015038afb86 (patch)
treee03f8ab28a5280f0fcb5aad8d93fe475548aff06 /keyserver
parent02a8515e9909369bb2b56f39b301aef0b85be421 (diff)
Summarise key change logs (#1278)
Diffstat (limited to 'keyserver')
-rw-r--r--keyserver/producers/keychange.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/keyserver/producers/keychange.go b/keyserver/producers/keychange.go
index 99629b42..0fe21d8b 100644
--- a/keyserver/producers/keychange.go
+++ b/keyserver/producers/keychange.go
@@ -42,6 +42,7 @@ func (p *KeyChange) DefaultPartition() int32 {
// ProduceKeyChanges creates new change events for each key
func (p *KeyChange) ProduceKeyChanges(keys []api.DeviceMessage) error {
+ userToDeviceCount := make(map[string]int)
for _, key := range keys {
var m sarama.ProducerMessage
@@ -62,12 +63,12 @@ func (p *KeyChange) ProduceKeyChanges(keys []api.DeviceMessage) error {
if err != nil {
return err
}
+ userToDeviceCount[key.UserID]++
+ }
+ for userID, count := range userToDeviceCount {
logrus.WithFields(logrus.Fields{
- "user_id": key.UserID,
- "device_id": key.DeviceID,
- "partition": partition,
- "offset": offset,
- "len_key_bytes": len(key.KeyJSON),
+ "user_id": userID,
+ "num_key_changes": count,
}).Infof("Produced to key change topic '%s'", p.Topic)
}
return nil