Skip to content

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

Closed as not planned
@mdarens

Description

@mdarens

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions