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
feat: add logs api to the runtime management api #2125
Conversation
for (const log of message.logs) { | ||
connection.socket.send(log) | ||
} | ||
}) |
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.
If the WebSocket goes down, you must remove the event listener. Otherwise, there will be a massive memory leak.
packages/runtime/lib/worker.js
Outdated
loggerConfig.transport = { | ||
target: 'pino-pretty' | ||
} | ||
pinoStream = pino.multistream([portStream, pinoStream]) |
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.
I think youàd need to set the log levels in a slightly different way. We might want to receive also trace and debug messages on the port, and filter them out on the other side.
@@ -115,7 +117,11 @@ async function createManagementApi (configManager, runtimeApiClient) { | |||
}) | |||
|
|||
app.get('/logs', { websocket: true }, async (connection) => { |
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.
I think we should accept the log level as a querystring parameter
packages/runtime/lib/worker.js
Outdated
|
||
if (loggerConfig) { | ||
loggerConfig = { ...loggerConfig } | ||
} else { | ||
loggerConfig = {} | ||
} | ||
|
||
/* c8 ignore next 10 */ | ||
let pinoStream = pino.destination(1) |
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.
do not instantiate to override
fcb0070
to
68ce4d0
Compare
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
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.
lgtm
No description provided.