New Release v4.8.4 - Query Optimizations & More Configurable Controls #402
jongpie
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Core Package Changes
Synchronous Context Optimizations
Several enhancements have been made to reduce the overhead that Nebula Logger consumes when logging - these enhancements help with some platform limits, such as query limits, CPU time limits, etc. (closes #311 reported by @LawrenceLoz). Many thanks again to @LawrenceLoz for doing some stellar analysis on the codebase to identify some of these optimizations.
LoggerParameter__mdt
recordEnableStackTraceParsing
to disable stack trace parsing org-wide. Although parsing stack traces can help provide contextual info for reporting, the code consumes CPU time in Apex - orgs can now choose if they want to disable this functionality to improve Nebula Logger's performance.LoggerParameter__mdt
records to enable/disable ifLogEntryEventBuilder
queries run synchronously (default behavior). When these records are disabled (Value__c = 'false'
), the corresponding queries run asynchronously after platform events are published. This means that the corresponding fields aren't set onLogEntryEvent__e
, but are still populated onLog__c
andLogEntry__c
. Four (4) new custom metadata records are included:LoggerParameter.QueryAuthSessionDataSynchronously
LoggerParameter.QueryNetworkDataSynchronously
LoggerParameter.QueryOrganizationDataSynchronously
LoggerParameter.QueryUserDataSynchronously
Logger
class to internally cached the value ofUserInfo.getSessionId()
. The original (erroneous) assumption was that the platform would handle caching this, but repeated calls to the method seem to consume additional CPU time - the value is now cached in a private constant.Caching System Improvements
Platform Cache is now being leveraged to supplement the existing transaction caching (partially closes #311, and closes #389 reported by @rmccu)
LoggerCache
that comes with 3MB allocated, based on the 3MB that Salesforce provides for security-approved managed packages. Sadly, Nebula Logger has not yet gone through this process yet, but still seemed like a sensible default size to use.LoggerCache
to now support 3 types of caching:LoggerCache.getTransactionCache()
. This is the existing caching system that's been used for a few releases. It caches values in a transaction using aprivate static final Map<String, Object>
constant. This is still used internally throughoutLoggerCache
to supplement some limitations with platform cache, such as not being able to cachenull
valuesLoggerCache.getOrganizationCache()
. This leverages the org partition of Platform CacheLoggerCache.getSessionCache()
. This leverages the session partition of Platform CacheLoggerParameter__mdt
record 'UsePlatformCache' to control if Nebula Logger leverages platform cache. When 'UsePlatformCache' is disabled (Value__c = 'false'), Nebula Logger will only useLogger.getTransactionCache()
(which is existing behavior before platform cache was introduced).Large Data Volume (LDV) Optimizations
I've included some query-related enhancements to address some of the performance problems that @rmccu brought up for orgs with large data volumes (2+ millions
Log__c
records created daily)LoggerParameter__mdt
records to completely disable certain queries executed by Nebula Logger (closes Flags to control potentially "expensive" functionality for high-volume implementations #390 reported by @rmccu). Some of the queries used by Nebula Logger can perform poorly in orgs with large data volumes - the new records provide a way for orgs to completely disable certain queries, with the tradeoff that the corresponding fields will benull
. Seven (7) queries can now be fully disabled - there are still some other queries throughout Nebula Logger that don't have this option, but these should be the most critical queries.LoggerParameter.QueryApexClassData
- when disabled, theApexClass
object is not queried, and the relevant fields onLogEntry__c
are nullLoggerParameter.QueryAuthSessionData
- when disabled, theAuthSession
object is not queried, and the relevant fields onLogEntry__c
are nullLoggerParameter.QueryFlowDefinitionViewData
- when disabled, theFlowDefinitionView
object is not queried, and the relevant fields onLogEntry__c
are nullLoggerParameter.QueryNetworkData
- when disabled, theNetwork
object is not queried, and the relevant fields onLogEntry__c
are null. Note: this only applies to orgs that use an Experience Cloud site (stored in theNetwork
object)LoggerParameter.QueryOrganizationData
- when disabled, theOrganzation
object is not queried, and the relevant fields onLogEntry__c
are nullLoggerParameter.QueryRelatedRecordData
- when disabled, the dynamic queries used to query record names (based on the fieldLogEntry__c.RecordId__c
) are not executed, the fieldLogEntry__c.RecordName__c
is nullLoggerParameter.QueryUserData
- when disabled, theUser
object is not queried, and the relevant fields onLogEntry__c
are nullBugfixes
LogEntry__c.Timestamp__c
being inaccurately set in some edge cases. This was an unreported bug found whereLogEntryEvent__e.TimestampString__c
could be out of sync withLogEntryEvent__e.Timestamp__c
, resulting in inaccurate data being stored inLogEntry__c.Timestamp__c
. The bug has been fixed & some additional tests have been added to ensure that this continues to behave as expected.Data Model Changes
LogEntryEvent__e.RequestId__c
andLog__c.RequestId__c
to store the value ofSystem.Request.getCurrent().getRequestId()
. In versions v3.1.0 through v4.7.2, this value was used forLog__c.TransactionId__c
, but reverted to using a more reliable customUUID
in v4.7.3 (the original solution). The newRequestId__c
fields provides a way to still report on this value, which can be helpful for tying Nebula Logger's data back to platform data & logs.Test Improvements
List.sort()
on the expected query resultsApexTestSuite
LoggerExtraTests (only deployed to/used by the pipeline for integration tests)Network
querying & setting of related fieldsLoggerEngineDataSelector
andLogManagementDataSelector
classes & methodsvirtual
& implemented test implementations in the respective test classesLoggerEngineDataSelector_Tests
andLogManagementDataSelector_Tests
to provide a cleaner way to test query executions within Nebula Logger's codebase.Experience Site Test Metadata Improvements
These changes only impact the pipeline to help validate logic related to orgs that use Nebula Logger for Experience Cloud sites (aka Community Cloud) - these changes don't have any direct functional changes to Nebula Logger
extra-tests
folder. These tests are only used in the pipeline - they are not included in the core package.Async Failure Additions Plugin Package Changes
Created v1.0.2 of the Async Failure Additions plugin
FlowExecutionErrorEvent
(closes Add logging for FlowExecutionErrorEvent in Async Failures Addition plugin #372 - implemented in Flow Execution Error Event Handling #392)Slack Plugin Package Changes
Created v1.5.1 of the Slack plugin
Many thanks to @jamessimone , @LawrenceLoz, @rmccu, and @mykhaylo-partyka for all of the help with this release!
This discussion was created from the release Query Optimizations & More Configurable Controls.
Beta Was this translation helpful? Give feedback.
All reactions