-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Bugfix: logging no longer fails when parent transaction ID is not found #307
Bugfix: logging no longer fails when parent transaction ID is not found #307
Conversation
…pdated trigger handler logic to optionally set Log__c.ParentLog__c when the parent log is found/skips it when the parent log is not found I also added CODEOWNERS file, and updated the description of perm set LoggerLogCreator to indicate that it's currently optional, but might be needed in the future
…or creating the unlocked package This will add more time to the build, but it will ensure that the managed package (the more problematic package) can be created before creating the unlocked package
… methods that will eventually be rewritten, alphabetized some fields in LogEntryEventBuilder
…String, Object>) since the current approach doesn't actually set any fields on AggregateResult Thanks to @jamessimone for pointing this out in my last PR. Long term, I'll change the approach used for AggregateResult
…ading (discussed in #303) and added a check on `LogEntryTagRule__mdt.getAll().isEmpty() == true` to minimize the usage of querying on LogEntryTagRule__mdt
…classes, promoted a few buried strings to be constants, and a cleaned up a few other small code bits
…s dependencies & recreating package-lock.json
…ember (now Schema.FieldSetMember)
…ic names (FieldSet, FieldSetMember, SObjectField, SObjectType and Test for now) - this will cause deployment errors in the pipeline if there are any references that don't use the System/Schema namespaces
f594f68
to
439d24f
Compare
…namespace (System.Test)
#309) * Adding new plugin for BatchApexErrorEvent and default Finalizer implementation for logging failures * Code review feedback - updated test class to make use of User metadata to avoid having to perform DML/the extra logs associated with Account, and updated example image in README to correctly describe the process for enabling unexpected batch error logging
5214e3c
to
9c3d859
Compare
… the new Async Failure Additions plugin (created by @jamessimone), promoted all plugin packages, added prod installation buttons in plugin README files
9c3d859
to
5e646cd
Compare
Codecov Report
@@ Coverage Diff @@
## main #307 +/- ##
==========================================
- Coverage 95.53% 95.52% -0.01%
==========================================
Files 43 45 +2
Lines 4593 4651 +58
Branches 92 92
==========================================
+ Hits 4388 4443 +55
- Misses 202 205 +3
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Core Package Changes
Log__c.ParentLogTransactionId__c
and updated trigger handler logic to optionally setLog__c.ParentLog__c
when the parent log is found (or skips it when the parent log is not found)Log__c
flexipage and page layout now use a new formula fieldLog__c.ParentLogLink__c
to display either a link toParentLog__c
when set or the text value ofParentLogTransactionId__c
LoggerLogCreator
to indicate that it's currently optional, but might be needed in the futureLogEntryEventHandler.TAG_ASSIGNMENT_RULES
by adding lazy-loading (discussed in Reducing use of SOQL in synchronous context #303) and adding a check onLogEntryTagRule__mdt.getAll().isEmpty() == true
to minimize the usage of querying onLogEntryTagRule__mdt
Logger_Tests
, and added TODOs for several test methods that will eventually be rewritten in a future release@SuppressWarnings
annotations in a couple of Apex classes-LoggerMockDataCreator.createAggregateResult(Map<String, Object>)
since the current mocking approach doesn't/can't actually set any fields on the mockAggregateResult
LoggerSObjectHandler__mdt.SObjectTypeOverride__c
as a way to support triggers on objects that are not supported viaEntityDefinition
lookupsNew Async Failures Additions Plugin
@jamessimone created a new plugin (implemented in #309), this plugin adds support for logging asynchronous batchable and queueable exceptions.
Batchable Error Logging
All a batch class needs to do is implement the marker
Database.RaisesPlatformEvents
interface and create aLoggerParameter__mdt
record where theValue
field matches the name of the batch class you are looking to add logging for, and the DeveloperName (the "Name" field) starts withBatchError
:And the CMDT record:
Once you've correctly configured those two things (the marker interface
Database.RaisesPlatformEvents
on the Apex batchable class, and the Logger Parameter CMDT record), your class will now log any uncaught exceptions that cause that batch class to fail unexpectedly.Queueable Error Logging
If you have Apex classes that implement
System.Queueable
, you can add error logging with some minimal code additions:If you'd like to do additional processing, you can alternatively choose to extend
LogFinalizer
:Promoted All Plugin Packages
Previously, the package plugins had not been promoted, which prevented them from being installed directly into production. The most recent package versions for each plugin has now been promoted, allowing all plugins to now be installed into production. At the moment, there are 5 plugins available:
Note that several plugins are still considered to be in beta - the code has been tested and everything is expected to work in production, but as some plugins are relatively new, there may be some bigger changes between releases (depending on community feedback about new features & bugfixes).
Pipeline Changes
CODEOWNERS
filebuild.yml
so that the managed package build is a dependency for creating the unlocked package. This will add more time to the build, but it will ensure that the managed package (the more problematic package) can be created before creating the unlocked packageREADME.md
package.json
& recreatingpackage-lock.json