Merge pull request #2705 from overleaf/jpa-pub-sub-metrics
[misc] track redis pub/sub payload sizes on publish GitOrigin-RevId: 7ef7ada34f9f6376abdd2b0b6aa10a5aac56a62f
This commit is contained in:
@@ -21,6 +21,7 @@ const modulePath = require('path').join(
|
||||
describe('EditorRealTimeController', function() {
|
||||
beforeEach(function() {
|
||||
this.rclient = { publish: sinon.stub() }
|
||||
this.Metrics = { summary: sinon.stub() }
|
||||
this.EditorRealTimeController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
@@ -33,6 +34,7 @@ describe('EditorRealTimeController', function() {
|
||||
io: (this.io = {})
|
||||
},
|
||||
'settings-sharelatex': { redis: {} },
|
||||
'metrics-sharelatex': this.Metrics,
|
||||
crypto: (this.crypto = {
|
||||
randomBytes: sinon
|
||||
.stub()
|
||||
@@ -71,6 +73,20 @@ describe('EditorRealTimeController', function() {
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should track the payload size', function() {
|
||||
this.Metrics.summary
|
||||
.calledWith(
|
||||
'redis.publish.editor-events',
|
||||
JSON.stringify({
|
||||
room_id: this.room_id,
|
||||
message: this.message,
|
||||
payload: this.payload,
|
||||
_id: this.message_id
|
||||
}).length
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('emitToAll', function() {
|
||||
|
||||
Reference in New Issue
Block a user