-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify RPC logs #1473
Simplify RPC logs #1473
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely an improvement - I was trying to log the error from the response body before I think, but then the stack wasn't working with JSON.
Also getting the response body in Next.js doesn't seem very straightforward, I hadn't found any alternative to that complicated part with the chunks...
|
||
type LogPayload = ReqResLogPayload | RpcReqResLogPayload; | ||
|
||
function logMethod(method: 'info' | 'trace' | 'error' | 'warn' | 'fatal') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, this works better than a function just for logInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm thinking roughly:
fatal
: Unrecoverable errors, the node process should crash (or has crashed and this is the report).error
: Unexpected, but we can degrade in a safe way. The user experience is impacted, so this must be investigatedwarn
: Unexpected, but we can degrade in a safe way. The user experience isn't really impacted, investigate when lots of these happen.info
: informational, we want to see these appear in a log aggregator for metrics
We play with logelevel on different use-cases
- production:
info
- local:
warn
, info will most likely lead to too many logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great, one of the alerts I set up in Sentry was for frequent warnings too.
Fixes issues like: https://sentry.io/organizations/mui-org/issues/3783806362/?environment=production&project=6763402&query=&referrer=issue-stream&statsPeriod=14d
We're not using JSON to transfer messages in RPC (Though it looks like it 🙂 )