fix: Various fixes for collaborative editing beta (#2561)
* fix: Remove Saving… message when collab enabled * chore: Add tracing extension to collaboration server * fix: Incorrect debounce behavior due to missing timestamps on events, fixes abundence of notifications when editing in realtime collab mode * fix: Reload document prompt when collab editing
This commit is contained in:
22
server/collaboration/logger.js
Normal file
22
server/collaboration/logger.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// @flow
|
||||
import debug from "debug";
|
||||
|
||||
const log = debug("server");
|
||||
|
||||
export default class Logger {
|
||||
async onCreateDocument(data: { documentName: string }) {
|
||||
log(`Created document "${data.documentName}"`);
|
||||
}
|
||||
|
||||
async onConnect(data: { documentName: string }) {
|
||||
log(`New connection to "${data.documentName}"`);
|
||||
}
|
||||
|
||||
async onDisconnect(data: { documentName: string }) {
|
||||
log(`Connection to "${data.documentName}" closed`);
|
||||
}
|
||||
|
||||
async onUpgrade() {
|
||||
log("Upgrading connection");
|
||||
}
|
||||
}
|
||||
40
server/collaboration/tracing.js
Normal file
40
server/collaboration/tracing.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// @flow
|
||||
import * as metrics from "../utils/metrics";
|
||||
|
||||
let count = 0;
|
||||
|
||||
export default class Tracing {
|
||||
async onCreateDocument({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.create_document", { documentName });
|
||||
|
||||
// TODO: Waiting for `instance` available in payload
|
||||
// metrics.gaugePerInstance(
|
||||
// "collaboration.documents_count",
|
||||
// instance.documents.size()
|
||||
// );
|
||||
}
|
||||
|
||||
async onAuthenticationFailed({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.authentication_failed", { documentName });
|
||||
}
|
||||
|
||||
async onConnect({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.connect", { documentName });
|
||||
metrics.gaugePerInstance("collaboration.connections_count", ++count);
|
||||
}
|
||||
|
||||
async onDisconnect({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.disconnect", { documentName });
|
||||
metrics.gaugePerInstance("collaboration.connections_count", --count);
|
||||
|
||||
// TODO: Waiting for `instance` available in payload
|
||||
// metrics.gaugePerInstance(
|
||||
// "collaboration.documents_count",
|
||||
// instance.documents.size()
|
||||
// );
|
||||
}
|
||||
|
||||
async onChange({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.change", { documentName });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user