Skip to content
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

Merged
merged 16 commits into from Feb 20, 2024

Conversation

ivan-tymoshenko
Copy link
Member

No description provided.

packages/runtime/lib/management-api.js Show resolved Hide resolved
for (const log of message.logs) {
connection.socket.send(log)
}
})
Copy link
Member

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.

loggerConfig.transport = {
target: 'pino-pretty'
}
pinoStream = pino.multistream([portStream, pinoStream])
Copy link
Member

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) => {
Copy link
Member

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


if (loggerConfig) {
loggerConfig = { ...loggerConfig }
} else {
loggerConfig = {}
}

/* c8 ignore next 10 */
let pinoStream = pino.destination(1)
Copy link
Member

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

@ivan-tymoshenko ivan-tymoshenko marked this pull request as ready for review February 19, 2024 17:00
Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/ajv@8.12.0 None +1 470 kB esp

View full report↗︎

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ivan-tymoshenko ivan-tymoshenko merged commit 2be438c into main Feb 20, 2024
85 checks passed
@ivan-tymoshenko ivan-tymoshenko deleted the add-runtime-logs-management-api branch February 20, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants