Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-585

Avoid log redaction cost via UD/MD/SD when log-level disabled

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 2.8.0
    • None
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 35, CBG Sprint 36
    • 5

    Description

      The current logging/log redaction framework will run the Redactor type conversions (via base.UD()) before any logging even takes place. This adds unnessesary overhead when logging redactable data at levels like Debug/Trace and we don't have those log levels enabled.

       

      There seems to be a small tweak we can make to the log redactor and logging code that would enable us to only do these Redactor conversions when we know we're going to log, and also when we know we have some log redaction enabled.

      By changing base.UD() from returning a Redactor type, to returning a RedactorFunc (which in turn returns the Redactor), we can choose whether or not to exectue this function down in the logging layer, based on log-level, and log-redaction settings.

       

      We should benchmark this change before/after for enabled and disabled log levels with enabled and disabled redaction settings to make sure we're not introducing more garbage for the GC as a tradeoff.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jacques.rascagneres Jacques Rascagneres
            ben.brooks Ben Brooks
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty