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

[perf] Consider skipping input/result serialization on Cloud Code triggers when loglevel is silent #9148

Closed
mdarens opened this issue Jun 7, 2024 · 3 comments
Labels
type:question Support or code-level question

Comments

@mdarens
Copy link

mdarens commented Jun 7, 2024

Issue Description

Currently, registering any trigger will stringify input/results and call the associated logTrigger* utilities, which internally do an early return after checking logLevel, which is passed in as a param based on config.logLevels.triggerAfter, config.logLevels.triggerBeforeSuccess etc.
The given log utility will then early return or truncate the stringified value, but if we know the loglevel from the caller we can avoid the serialization overhead altogether.

Steps to reproduce

  1. Set logLevels.triggerAfter to silent
  2. Register any Cloud Code hook eg afterFind
  3. Trigger the hook and attach to the Parse Server process

Actual Outcome

In triggers.js, the result is stringified before being discarded inside the logger function

Expected Outcome

It'd be nice to avoid serializing objects we don't intend to log

Environment

v7.1.0-alpha.9

Server

  • Parse Server version: v7.1.0-alpha.9
  • Operating system: Alpine Linux 3.18 (from node:18-alpine3.18 docker image)
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Google Cloud

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 6
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): N/A
  • SDK version: N/A

Logs

Copy link

Thanks for opening this issue!

@dplewis
Copy link
Member

dplewis commented Jun 7, 2024

I believe this feature has already been added #8803.

@mdarens
Copy link
Author

mdarens commented Jun 7, 2024

Whoops, my mistake! I was looking at what appeared to be the latest tagged release. Thanks!

@mdarens mdarens closed this as completed Jun 7, 2024
@mdarens mdarens closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2024
@mtrezza mtrezza added the type:question Support or code-level question label Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants