feat: Normalized server logging (#2567)
* feat: Normalize logging * Remove scattered console.error + Sentry.captureException * Remove mention of debug * cleanup dev output * Edge cases, docs * Refactor: Move logger, metrics, sentry under 'logging' folder. Trying to reduce the amount of things under generic 'utils' * cleanup, last few console calls
This commit is contained in:
@ -1,40 +1,40 @@
|
||||
// @flow
|
||||
import * as metrics from "../utils/metrics";
|
||||
import Metrics from "../logging/metrics";
|
||||
|
||||
let count = 0;
|
||||
|
||||
export default class Tracing {
|
||||
async onCreateDocument({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.create_document", { documentName });
|
||||
Metrics.increment("collaboration.create_document", { documentName });
|
||||
|
||||
// TODO: Waiting for `instance` available in payload
|
||||
// metrics.gaugePerInstance(
|
||||
// Metrics.gaugePerInstance(
|
||||
// "collaboration.documents_count",
|
||||
// instance.documents.size()
|
||||
// );
|
||||
}
|
||||
|
||||
async onAuthenticationFailed({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.authentication_failed", { documentName });
|
||||
Metrics.increment("collaboration.authentication_failed", { documentName });
|
||||
}
|
||||
|
||||
async onConnect({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.connect", { documentName });
|
||||
metrics.gaugePerInstance("collaboration.connections_count", ++count);
|
||||
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);
|
||||
Metrics.increment("collaboration.disconnect", { documentName });
|
||||
Metrics.gaugePerInstance("collaboration.connections_count", --count);
|
||||
|
||||
// TODO: Waiting for `instance` available in payload
|
||||
// metrics.gaugePerInstance(
|
||||
// Metrics.gaugePerInstance(
|
||||
// "collaboration.documents_count",
|
||||
// instance.documents.size()
|
||||
// );
|
||||
}
|
||||
|
||||
async onChange({ documentName }: { documentName: string }) {
|
||||
metrics.increment("collaboration.change", { documentName });
|
||||
Metrics.increment("collaboration.change", { documentName });
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user