NebulaLogger icon indicating copy to clipboard operation
NebulaLogger copied to clipboard

Capture OrgLimits data on Log__c

Open jongpie opened this issue 2 years ago • 3 comments

Currently, the LogEntry__c object has multiple fields related to tracking transactional limits, using the class System.Limits. I think it'd be helpful to capture and store organizational limits on Log__c, using the class System.OrgLimits.

This data would probably need to be stored in a long text-area field (as JSON) and displayed using a custom component - the values returned by OrgLimits can be drastically different between orgs, based on the orgs licenses & add-ons, so it's not feasible to have a predefined number of fields on Log__c. This means that things like standard reports & dashboards probably can't be used to view this data, but using a custom component would at least provide admins/devs with a way to see the information.

jongpie avatar Feb 08 '24 12:02 jongpie

Love this idea! Something to be aware of from my own usage of OrgLimits within Apex Rollup - calling getMap() fails during synchronous test runs (so, during packaging...) which means a nice little stub will be helpful to get around that particular platform idiosyncrasy 😅

jamessimone avatar Feb 08 '24 13:02 jamessimone

@jamessimone that's great to know, because that sounds... terribly frustrating 😅 I'm trying to think of a rational explanation for why the OrgLimits would work that way, but I'm guessing there's not a very satisfying answer. Sounds like a stub will definitely be needed!

jongpie avatar Feb 08 '24 14:02 jongpie

Haha yeah. Here're the relevant lines in the codebase and the test that uses the stub!

jamessimone avatar Feb 08 '24 15:02 jamessimone

This is now available in release v4.13.2 🎉

jongpie avatar Mar 13 '24 01:03 jongpie