Optimizations for Synchronous Context #311
Labels
Layer: Configuration
Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type
Layer: Log Management
Items related to the custom objects & Logger Console app
Layer: Logger Engine
Items related to the core logging engine
optimization
Salesforce Feature: Platform Cache
Items related to how platform cache is leveraged by Nebula Logger
Milestone
Discussed in #303
Originally posted by LawrenceLoz April 28, 2022
Hi there,
Firstly big kudos to author/authors and contributors on this project - a really rich and intuitive set of features and some great configuration flexibility.
Running a few experiments and looking at debug logs, I've noticed that when the Logger object class is called several queries are run within the transaction which contribute to the limit of 100 SOQL statements - in my tests this is 4 queries and I think would be 5 for logs being made for community users. Whilst this isn't an especially high, in an ideal world given how widely a logging framework should be used it would be great to reduce the utilisation and improve synchronous performance where possible.
There are a couple of areas resulting in queries being run, and I wonder whether it's viable to refactor to avoid these:
LogEntryEventHandler().executeBeforeInsert(logEntryEvents);
As part of this, TAG_ASSIGNMENT_RULES variable is set from the results of a CMDT query, which includes flitering on SObjectField__r.QualifiedApiName (the bit which makes the CMDT query contribute to limits like a normal SOQL object query). This variable isn't used until after PEs are created so feels like this should be called only at that stageI'm happy to create issues and help out with PRs suggesting changes for some or all of these areas if you agree there's a better approach? Or let me know if I'm missing something about how any of these can be avoided today?
Also a heads up I'm hoping to touch on Nebula Logger as part of a talk I'm co-presenting at London's Calling soon (https://www.londonscalling.net/sessions/session-apex-frameworks-for-architects/). Let me know if you'd like more insight into how this would be included (or if for any reason you'd prefer Nebula Logger not to be included!)
Again, thanks for the great work - I've developed a similarly architected logging framework myself and familiar with many of the challenges you've addressed really well here!
Acceptance Criteria:
LogEntryEventHandler.TAG_ASSIGNMENT_RULES
- Included in PR Bugfix: logging no longer fails when parent transaction ID is not found #307UserInfo.getSessionId()
queryAuthSession()
queryNetwork()
queryOrganization()
queryUser()
LogEntryEventBuilder.parseStackTrace()
LoggerParameter__mdt
record?). If org/session cache isn't available (or disabled), then Nebula Logger should continue to use the existing transaction cacheNext Steps:
The text was updated successfully, but these errors were encountered: