aboutsummaryrefslogtreecommitdiff
path: root/clientapi
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-06-12 12:10:08 +0100
committerGitHub <noreply@github.com>2020-06-12 12:10:08 +0100
commit4675e1ddb6a48fe1425032dc4f3cef56cbde7243 (patch)
treec1f900ab4bf0a4fadc7ca81ba614977f4a973f29 /clientapi
parent079d8fe8fb521f76fee3bff5b47482d5fb911257 (diff)
Add trace logging to RoomserverInternalAPI (#1120)
This is a wrapper around whatever impl we have which then logs the function name/request/response/error. Also tweak when we log on kafka streams: only log on the producer side not the consumer side: we've never had issues with comms and having 1 message rather than N would be nice.
Diffstat (limited to 'clientapi')
-rw-r--r--clientapi/producers/syncapi.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/clientapi/producers/syncapi.go b/clientapi/producers/syncapi.go
index 244a61dc..375b1eee 100644
--- a/clientapi/producers/syncapi.go
+++ b/clientapi/producers/syncapi.go
@@ -17,9 +17,9 @@ package producers
import (
"encoding/json"
- "github.com/matrix-org/dendrite/internal"
-
"github.com/Shopify/sarama"
+ "github.com/matrix-org/dendrite/internal"
+ log "github.com/sirupsen/logrus"
)
// SyncAPIProducer produces events for the sync API server to consume
@@ -44,6 +44,11 @@ func (p *SyncAPIProducer) SendData(userID string, roomID string, dataType string
m.Topic = string(p.Topic)
m.Key = sarama.StringEncoder(userID)
m.Value = sarama.ByteEncoder(value)
+ log.WithFields(log.Fields{
+ "user_id": userID,
+ "room_id": roomID,
+ "data_type": dataType,
+ }).Infof("Producing to topic '%s'", p.Topic)
_, _, err = p.Producer.SendMessage(&m)
return err