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

Optionally log based on status code responses #49

Open
chasers opened this issue Oct 21, 2021 · 3 comments
Open

Optionally log based on status code responses #49

chasers opened this issue Oct 21, 2021 · 3 comments
Labels
enhancement New feature or request observability Logs, metrics, traces etc

Comments

@chasers
Copy link

chasers commented Oct 21, 2021

Can we optionally log something based on the status code when the response is handled?

Default to logging 4xx - 5xx response codes would be great, and then everyone would automatically get this info in their Postgres logs.

@chasers chasers added enhancement New feature or request observability Logs, metrics, traces etc labels Oct 21, 2021
@steve-chavez
Copy link
Member

Yeah, that can be done by using a call to elog in the background worker.

Can we optionally log something based on the status code when the response is handled?

We should have a config to turn this on/off, maybe named like pg_net.log_http_errors(off by default).

@chasers
Copy link
Author

chasers commented Oct 21, 2021

Do all responses get put in the table you collect responses from? Maybe we just build a UI over that? I thought I read somewhere a concept of sync vs async, but maybe either way they end up in the collect response table?

I'm assuming actual connection errors will end up in the logs though. Is this correct?

@soedirgo
Copy link
Member

The response table is private API and subject to breakage, so we should probably avoid that. But yes, they end up in the response table.

I don't think we log connection errors right now, only for debugging purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request observability Logs, metrics, traces etc
Projects
None yet
Development

No branches or pull requests

3 participants