Skip to content

(Just for documentary reasons): Using cloud-pine in a Google Cloud Run service while logging extensively is not a good idea #50

Open
@mindactuate

Description

@mindactuate

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:

  1. Start a new node js project
  2. Configure pino logger with cloud-pine as target
  3. Do some really heavy logging
  4. Deploy to GCR
  5. Monitor the load
  6. Turn cloud-pine off
  7. Deploy again
  8. Monitor the load
  9. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions