Describe the bug
Hi. I used cloud-pine in 2 Google Cloud Run services (because I didn't know better back that day). I did some "heavy logging" for debugging reasons in my QA-environment and everytime at a certain (logging-heavy) function, my service crashed. Even 8 CPUs and 32 GB RAM wasn't enough. Then I turned cloud-pine off (Google Cloud Run works pretty fine without cloud-pine because it streams stdout and stderr to Google Cloud Logging anyway) and everything works like a charm (1 CPU, not more than 150 MB RAM).
I don't know much about the nitty gritty of cloud-pine. Perhaps its not because of your code but more because of the resource-intense API calls that are made to send the logs to Google Cloud Logging?
This issue is just for documentary reasons. I don't need this solved. Perhaps it helps you. I just wanted to share this story with you. I think you should know about it.
To Reproduce
Steps to reproduce the behavior:
- Start a new node js project
- Configure pino logger with cloud-pine as target
- Do some really heavy logging
- Deploy to GCR
- Monitor the load
- Turn cloud-pine off
- Deploy again
- Monitor the load
- Compare
Here my logger config WITH cloud-pine activated. Perhaps I did something wrong?
import pino from 'pino';
import dotenv from 'dotenv';
dotenv.config(); // I have to init dotenv here as it isn't initialized yet
function getTransport() {
if ('LOCAL_LOGGER' in process.env) {
return {};
}
return {
transport: {
target: 'cloud-pine',
},
};
}
const logger = pino({
...getTransport(),
timestamp: pino.stdTimeFunctions.isoTime,
redact: {
paths: ['email', 'password', 'token'],
},
});
export default logger;
Here my logger config without cloud-pine:
import pino from 'pino';
import dotenv from 'dotenv';
dotenv.config(); // I have to init dotenv here as it isn't initialized yet
const logger = pino({
timestamp: pino.stdTimeFunctions.isoTime,
redact: {
paths: ['email', 'password', 'token'],
},
});
export default logger;
Environment
- Google Cloud Run, 1 CPU, 512 MB (but also tried with 8 CPU and 32 GB RAM)
- Docker Image: node:18-alpine (but also tried node:18)