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

Flushing logs after request has finished. #133

Open
Henery309 opened this issue Apr 11, 2021 · 3 comments
Open

Flushing logs after request has finished. #133

Henery309 opened this issue Apr 11, 2021 · 3 comments

Comments

@Henery309
Copy link

Hi I am working on a POC for cloud run to use in our app.

I came across 1 interesting use case. The docs for google cloud logging suggest that for high throughput applications we should avoid awaiting when logging (background process takes care of it).

From my understanding - once a request is completed cloud run will immediately throttle the CPU in which case the pending logging request will be dropped. Are we able to flush the logs after the request has completed or do we have to log before returning the response? Logging request takes approximately 300ms adding this time onto the request would be an issue.

Cloud Logging Docs

image

@ahmetb
Copy link
Owner

ahmetb commented Apr 11, 2021

Your analysis is correct. We recommend doing the same for distributed traces. 

@Henery309
Copy link
Author

@ahmetb what if we mark the container as keep warm. If we try to send logs after request has finished will they be dropped?

@ahmetb
Copy link
Owner

ahmetb commented Apr 12, 2021

Warm containers don't mean their cpu is allocated. So you can still lose logs if they're not getting requests when the log flush timer fires.

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

No branches or pull requests

2 participants