Skip to content
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

Added plugin framework + re-added Slack integration #165

Merged
merged 85 commits into from
Jun 20, 2021

Conversation

jongpie
Copy link
Owner

@jongpie jongpie commented Jun 4, 2021

Closes #164 and closes #169 by introducing a few new features for the trigger handler classes. This is currently only available in the unlocked package - there are some technical concerns & constraints with bringing this functionality into the managed package.

New Logger plugin framework (beta)

  • Added new abstract class LoggerSObjectHandler - the handlers for Log__c, LogEntry__c and LogEntryEvent__e now extend this class
  • Added new CMDT object LoggerSObjectHandler__mdt to control the behavior of the handler classes
    • IsEnabled__c - controls if the handler class runs at all
    • SObjectType__c - entity definition-relationship field to indicate which SObject is processed (Log__c, LogEntry__c and LogEntryEvent__e)
  • Added new CMDT object LoggerSObjectHandlerPlugin__mdt to define & control any plugins that the handler class should execute
    • SObjectHandler__c - a metadata lookup field, used to relate a plugin to an instance of LoggerSObjectHandler__mdt. This controls when your plugin will execute
    • PluginType__c - the type of plugin to execute. Possible values are 'Apex' and 'Flow'
    • PluginApiName__c - the name of an Apex class or Flow to automatically execute
      • Type == 'Apex' - the name of an Apex class that implements the interface LoggerSObjectPostProcessor
      • Type == 'Flow' - the name of a Flow with the input parameters triggerOperationType, records and oldRecords
  • Added new CMDT object LoggerSObjectHandlerPluginParameter__mdt for plugins to store key-value pair configurations

New Slack plugin for Logger (beta)

  • Re-added the old Slack integration using the new plugin framework. Formerly a batch job, the new Slack plugin uses a queueable job for asynchronously sending Slack notifications for logs that meet a threshold logging level

@jongpie jongpie temporarily deployed to Test June 4, 2021 06:57 Inactive
@jongpie jongpie temporarily deployed to Test June 4, 2021 07:28 Inactive
@codecov
Copy link

codecov bot commented Jun 4, 2021

Codecov Report

Merging #165 (6fef1d0) into main (5acd00c) will increase coverage by 0.38%.
The diff coverage is 98.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #165      +/-   ##
==========================================
+ Coverage   93.62%   94.01%   +0.38%     
==========================================
  Files          15       17       +2     
  Lines        1915     1971      +56     
==========================================
+ Hits         1793     1853      +60     
+ Misses        122      118       -4     
Impacted Files Coverage Δ
...in/log-management/classes/LoggerSObjectHandler.cls 97.95% <97.95%> (ø)
...in/log-management/classes/LogEntryEventHandler.cls 98.59% <100.00%> (+0.02%) ⬆️
...er/main/log-management/classes/LogEntryHandler.cls 96.51% <100.00%> (+0.21%) ⬆️
...-logger/main/log-management/classes/LogHandler.cls 99.12% <100.00%> (+0.02%) ⬆️
...management/classes/RelatedLogEntriesController.cls 93.00% <100.00%> (+2.87%) ⬆️
...n-framework/classes/LoggerSObjectHandlerPlugin.cls 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5acd00c...6fef1d0. Read the comment docs.

@jamessimone
Copy link
Collaborator

Nice. Looks like this one is shaping up quickly!

…r is now abstract & used by all 3 handlers (mini trigger framework style)
@jongpie jongpie temporarily deployed to Test June 4, 2021 15:09 Inactive
@jongpie
Copy link
Owner Author

jongpie commented Jun 4, 2021

@jamessimone I made a few small-but-important changes, I'd love to know your thoughts whenever you have a chance:

  • I changed LoggerHandler to be a public abstract class that all 3 handler classes now extend (to allow sharing code between the handlers, like a mini trigger framework)
  • The interface LoggerHandler.PostProcessor has been removed from LoggerHandler and it's now a standalone global interface called LoggerPostProcessor

Copy link
Collaborator

@jamessimone jamessimone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comments!

@jongpie jongpie temporarily deployed to Test June 5, 2021 07:35 Inactive
- Renamed LoggerHandler to LoggerSObjectHandler
- Renamed LoggerPostProcessor to LoggerSObjectPostProcessor
- Renamed LoggerHandlerConfiguration__mdt to LoggerSObjectHandlerConfiguration__mdt
@jongpie jongpie temporarily deployed to Test June 6, 2021 06:42 Inactive
@jongpie jongpie temporarily deployed to Test June 7, 2021 06:58 Inactive
@jongpie jongpie temporarily deployed to Test June 7, 2021 07:04 Inactive
@jongpie jongpie temporarily deployed to Test June 7, 2021 18:17 Inactive
New tests are still failing (they need to be finished)
@jongpie jongpie temporarily deployed to Test June 15, 2021 18:29 Inactive
@jongpie jongpie temporarily deployed to Test June 15, 2021 18:56 Inactive
@jongpie jongpie temporarily deployed to Test June 16, 2021 00:27 Inactive
@jongpie jongpie temporarily deployed to Test June 16, 2021 01:16 Inactive
@jongpie jongpie temporarily deployed to Test June 16, 2021 04:10 Inactive
@derroman
Copy link

We want to see that! :-D

@jamessimone
Copy link
Collaborator

@derroman it’s nearly ready!

@derroman
Copy link

need a helping hand? ;-)

@jongpie jongpie temporarily deployed to Test June 20, 2021 05:31 Inactive
@jongpie jongpie temporarily deployed to Test June 20, 2021 05:45 Inactive
@jongpie jongpie temporarily deployed to Test June 20, 2021 22:17 Inactive
@jongpie jongpie merged commit dae9b86 into main Jun 20, 2021
@jongpie jongpie deleted the feature/handler-post-processors branch June 20, 2021 22:31
@jongpie
Copy link
Owner Author

jongpie commented Jun 20, 2021

@derroman it's ready! I've merged & released these changes - let us know if you have any feedback!

@derroman
Copy link

[cancels every meeting of today] 😂
Great! Looking forward to play around with!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Plugin Framework Items related to Nebula Logger's plugin framework Logging Source: API Items related to using Nebula Logger via REST API Package Type: Unlocked Package Issues and enhancements that specifically apply to the unlocked package Plugin: Slack Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-add Slack integration Add the ability to extend the SObject handler classes
3 participants