diff --git a/logging/log.ts b/logging/log.ts index 2a9214d0..816b05ed 100644 --- a/logging/log.ts +++ b/logging/log.ts @@ -18,7 +18,7 @@ export type Logger = { [key in LoggingLevel]: (msg: string, metadata?: MessageMetadata) => void; }; -export type Tags = 'invariant-violation'; +export type Tags = 'invariant-violation' | 'invalid-request'; const cleanedLogFn = (log: LogFn) => { return (msg: string, metadata?: MessageMetadata) => { diff --git a/router/server.ts b/router/server.ts index 672ea847..4d4bb504 100644 --- a/router/server.ts +++ b/router/server.ts @@ -291,6 +291,7 @@ class RiverServer validationErrors: [ ...Value.Errors(InputErrResultSchema, msg.payload), ], + tags: ['invalid-request'], }); } @@ -311,6 +312,7 @@ class RiverServer ...loggingMetadata, clientId: this.transport.clientId, transportMessage: msg, + tags: ['invalid-request'], }); onServerAbort( @@ -341,6 +343,7 @@ class RiverServer clientId: this.transport.clientId, transportMessage: msg, validationErrors, + tags: ['invalid-request'], }); onServerAbort( @@ -579,7 +582,10 @@ class RiverServer `got request for invalid procedure type ${ (procedure as AnyProcedure).type } at ${serviceName}.${procedureName}`, - loggingMetadata, + { + ...loggingMetadata, + tags: ['invariant-violation'], + }, ); return; @@ -651,6 +657,7 @@ class RiverServer ...session.loggingMetadata, clientId: this.transport.clientId, transportMessage: initMessage, + tags: ['invalid-request'], }); this.abortStream( @@ -671,6 +678,7 @@ class RiverServer ...session.loggingMetadata, clientId: this.transport.clientId, transportMessage: initMessage, + tags: ['invalid-request'], }); this.abortStream( @@ -691,6 +699,7 @@ class RiverServer ...session.loggingMetadata, clientId: this.transport.clientId, transportMessage: initMessage, + tags: ['invalid-request'], }); this.abortStream( @@ -711,6 +720,7 @@ class RiverServer ...session.loggingMetadata, clientId: this.transport.clientId, transportMessage: initMessage, + tags: ['invalid-request'], }); this.abortStream( @@ -732,6 +742,7 @@ class RiverServer ...session.loggingMetadata, clientId: this.transport.clientId, transportMessage: initMessage, + tags: ['invalid-request'], }); this.abortStream( @@ -754,6 +765,7 @@ class RiverServer ...session.loggingMetadata, clientId: this.transport.clientId, transportMessage: initMessage, + tags: ['invalid-request'], }); this.abortStream(