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

Track OrgLimits data on Log__c #646

Merged
merged 12 commits into from
Mar 12, 2024
Merged

Conversation

jongpie
Copy link
Owner

@jongpie jongpie commented Mar 12, 2024

Core Unlocked Package Changes

  • Resolved Capture OrgLimits data on Log__c #630 by adding new functionality to track organization limits data, returned by the class System.OrgLimits

    • This data is automatically stored as JSON in the new field Log__c.OrganizationLimits__c

    • You can disable storing this data, using the new LoggerParameter__mdt record StoreOrganizationLimits

    • This data is displayed within a new "Organization Limits" tab on the Log__c flexipage, using a new LWC logOrganizationLimits (shown below). The design of this LWC is intended to mimic the existing formula fields shown on LogEntry__c that are used to track transaction limits.

      image

      • For comparison, this image shows the existing formula fields on LogEntry__c that are used to track transaction limits.

        image

  • Added another new LoggerParameter__mdt record, StoreTransactionLimits, to control if transaction limits are retrieved from the class System.Limits & stored on LogEntry__c

    • Previously, transaction limits were always populated, with no way to disable it - using the System.Limits class does seem to have some overhead (namely, it uses CPU time), so being able to disable this functionality can, hilariously, help to reduce transaction limits usage.
  • loggerPageSection LWC changes: Fixed some padding in loggerPageSection.html so it's more consistent with 'real' field section headers

jongpie added 9 commits March 11, 2024 10:13
… filtering on records that have a value populated in Log__c.OrganizationLimits__c
…izationLimits__c and display it in a page section, similar to how the LogEntry__c formula fields for transaction limits are displayed
…nLimits, to control if transaction limits are retrieved from the class System.Limits & stored on LogEntry__c

Previously, transaction limits were always populated, with no way to disable it - using the Limits class does seem to have some overheaded, so being able to disable this functionality can, hilariously, help with limits
…e default values (true) for 'StoreOrganizationLimits' and 'StoreTransactionLimits'
@jongpie jongpie added Type: Enhancement New feature or request Layer: Log Management Items related to the custom objects & Logger Console app labels Mar 12, 2024
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org March 12, 2024 03:00 — with GitHub Actions Failure
@jongpie jongpie temporarily deployed to Base Scratch Org March 12, 2024 03:00 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Base Scratch Org March 12, 2024 03:31 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org March 12, 2024 03:31 — with GitHub Actions Inactive
@jongpie jongpie marked this pull request as ready for review March 12, 2024 04:23
@jongpie
Copy link
Owner Author

jongpie commented Mar 12, 2024

@jamessimone following up on your comment about OrgLimits.getMap() failing during synchronous tests, I think it's maybe fixed now, kind of?

  • I did initially have a relevant flaky test failure - my new test method failed once due to the returned JSON output not matching the expected value. Due to the length of the JSON, the assert message was truncated, so I couldn't see exactly why it didn't match (but calling OrgLimits.getMap() didn't seem to throw an exception). The same test passed during the same build in 1 of the 2 scratch orgs used in the pipeline (the base scratch org), but failed in the other (experience cloud scratch org).
  • I then re-ran the build, and was able to successfully run the pipeline for all steps, including running of all tests synchronously and asynchronously, creating a managed package version, and an unlocked package version.
  • This known issue sounds relevant to the problem you've had, and it's now marked as "solution delivered".

The 1 flaky test failure seems a little suspicious, but I haven't been able to reproduce it. Do you remember if you were seeing a specific error message before when you tried to use OrgLimits.getMap()?

@jamessimone
Copy link
Collaborator

@jongpie let me take a look, at the time I was able to repro the issue with a synchronous test run

@jamessimone
Copy link
Collaborator

It seems to work now, great call!

@jongpie
Copy link
Owner Author

jongpie commented Mar 12, 2024

@jamessimone awesome, thanks for checking!

@jongpie jongpie force-pushed the feature/track-organization-limits branch from 14e1aea to 46c7bd9 Compare March 12, 2024 17:49
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org March 12, 2024 17:53 — with GitHub Actions Failure
@jongpie jongpie force-pushed the feature/track-organization-limits branch from 9f0394b to 77982ce Compare March 12, 2024 18:56
@jongpie jongpie temporarily deployed to Base Scratch Org March 12, 2024 19:00 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org March 12, 2024 19:00 — with GitHub Actions Inactive
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.05%. Comparing base (5835da6) to head (77982ce).

❗ Current head 77982ce differs from pull request most recent head fe01586. Consider uploading reports for the commit fe01586 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #646      +/-   ##
==========================================
+ Coverage   95.03%   95.05%   +0.01%     
==========================================
  Files          50       50              
  Lines        5624     5663      +39     
==========================================
+ Hits         5345     5383      +38     
- Misses        279      280       +1     
Flag Coverage Δ
Apex 95.05% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jongpie jongpie changed the title Track organization limits Track OrgLimits data on Log__c Mar 12, 2024
@jongpie jongpie merged commit 11964ad into main Mar 12, 2024
1 check passed
@jongpie jongpie deleted the feature/track-organization-limits branch March 12, 2024 22:31
@jongpie jongpie added the Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Capture OrgLimits data on Log__c
3 participants