-
-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Query Optimizations & More Configurable Controls (#394)
* Added new LoggerParameter__mdt records to control stacktrace parsing & synchronously querying/setting some fields, centralized the usage of UserInfo.getSessionId(), fixed milestone link in README to use v4.7.0 (instead of the old v4.6.0 milestone link) * Updated LogEntryEventBuilder to only run queries/set relevant fields based on the corresponding LoggerParameter__mdt "synchronous" records, implemented enabling/disabling stack trace parsing via LoggerParameter__mdt record * Updated LogEntryEventHandler to handle setting queried fields when corresponding LoggerParameter__mdt records are set to asynchronously query * Updated LogEntryEventBuilder and LogEntryEventHandler to fully skip some queries, based on new CMDT records to complete enable/disable different queries * Added all included parameters as constants in LoggerParameter, renamed some constant names and LoggerParameter__mdt records * Updated LogEntryEventBuilder & LoggerDataStore to use more lazy loading on some static variables/constants, * Updated LogEntryEventBuilder to consistently use of shouldShould() method internally instead of the shouldSave property * Updated LoggerCache to leverage a new platform cache partition (cleverly also named LoggerCache). Also added a new LoggerParameter__mdt record 'UsePlatformCache' to enable/disable the usage of platform cache * Updated the 2 data selector classes LoggerEngineDataSelector & LogManagementDataSelector to now use either org or session cache - the original transaction cache is now used internally as a fallback/secondary cache * Added new fields LogEntryEvent__e.RequestId__c and Log__c.RequestId__c to store the value of System.Request.getCurrent().getRequestId(). Previously, this value was used for Log__c.TransactionId__c, and I reverted to using a more reliable UUID in v4.7.3, but some orgs would still like to report on the request ID * Fixed an unreported bug where the value for the workaround field LogEntryEvent__e.TimestampString__c was out of sync with LogEntryEvent__e.TimestampString__c, resulting in inaccurate data on LogEntry__c.Timestamp__c * Fixed the approach used to dynamically determine if Experience Cloud is enabled in the current org * Fixed #393 by removing the ORDER BY statements in several queries because sorting didn't serve a functional purpose. Instead, the results are now sorted just in the tests to help with asserting on the returned values. * Updated build.yml to run Apex test twice - synchronously & synchronously. This helps with automatically testing functionality that relies on the AuthSession object by ensuring the code works with & without an active session * Added some new integration tests in the extra-tests folder * Added some additional Experience Site metadata to better test Network fields being queried & set * Updated pwsh script to not include the build number in sfdx-project.json, removed existing build numbers in sfdx-project.json * Created new version of async failure additions plugin based on changes made by @jamessimone in #392 * Create new version v1.5.1 of Slack plugin that fixes the formatting of multi-line text fields in SlackLoggerPlugin
- Loading branch information
Showing
99 changed files
with
3,479 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
config/experience-cloud/experiences/Logger_Test_Site1/routes/tooManyRequests.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
config/experience-cloud/profiles/Logger Test Site User Profile.profile-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Profile xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<userLicense>High Volume Customer Portal</userLicense> | ||
</Profile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
--- | ||
layout: default | ||
--- | ||
|
||
## LoggerCache class | ||
|
||
Class used to cache query results returned by the selector classes | ||
|
||
--- | ||
|
||
### Methods | ||
|
||
#### `contains(String key)` → `Boolean` | ||
|
||
Manages interacting with platform cache partitions, and can be mocked during unit tests so that tests don't have to rely on the actual platform cache partitions configured in the org. | ||
|
||
#### `contains(String key)` → `Boolean` | ||
|
||
Manages interacting with platform cache. The provided transaction cache instance is used internally as the primary caching method, and is further augmented by using Platform Cache to provide caching that spans multiple transactions. | ||
|
||
#### `contains(String key)` → `Boolean` | ||
|
||
Manages any transaction-specific caching, using `Map<String, Object>` | ||
|
||
#### `get(String key)` → `Object` | ||
|
||
#### `get(String key)` → `Object` | ||
|
||
#### `get(String key)` → `Object` | ||
|
||
#### `getOrganizationCache()` → `Cacheable` | ||
|
||
The instance of `Cacheable` used for any organization-specific caching via Platform Cache. When Platform Cache is disabled or not available, the transaction cache is instead used. | ||
|
||
##### Return | ||
|
||
**Type** | ||
|
||
Cacheable | ||
|
||
**Description** | ||
|
||
The singleton instance of `Cacheable` | ||
|
||
#### `getSessionCache()` → `Cacheable` | ||
|
||
The instance of `Cacheable` used for any session-specific caching via Platform Cache. When Platform Cache is disabled or not available, the transaction cache is instead used. | ||
|
||
##### Return | ||
|
||
**Type** | ||
|
||
Cacheable | ||
|
||
**Description** | ||
|
||
The singleton instance of `Cacheable` | ||
|
||
#### `getTransactionCache()` → `Cacheable` | ||
|
||
The instance of `Cacheable` used for any transaction-specific caching. Cached data is stored internally in-memory for the duration of the transaction. | ||
|
||
##### Return | ||
|
||
**Type** | ||
|
||
Cacheable | ||
|
||
**Description** | ||
|
||
The singleton instance of `Cacheable` | ||
|
||
#### `isAvailable()` → `Boolean` | ||
|
||
#### `put(String key, Object value, Integer cacheTtlSeconds, Cache.Visibility cacheVisiblity, Boolean isCacheImmutable)` → `void` | ||
|
||
#### `put(String key, Object value)` → `void` | ||
|
||
#### `put(String key, Object value)` → `void` | ||
|
||
#### `remove(String key)` → `void` | ||
|
||
#### `remove(String key)` → `void` | ||
|
||
#### `remove(String key)` → `void` | ||
|
||
--- | ||
|
||
### Inner Classes | ||
|
||
#### LoggerCache.Cacheable interface | ||
|
||
Interface used to define caches that can be used to store values via different mechanisms | ||
|
||
--- | ||
|
||
##### Methods | ||
|
||
###### `contains(String key)` → `Boolean` | ||
|
||
Indicates if the specified key has already been added to the cache | ||
|
||
####### Parameters | ||
|
||
| Param | Description | | ||
| ----- | ---------------------------------------------- | | ||
| `key` | The `String` key to check for within the cache | | ||
|
||
####### Return | ||
|
||
**Type** | ||
|
||
Boolean | ||
|
||
**Description** | ||
|
||
The `Boolean` result that indicates if the specified key is contained in the cache | ||
|
||
###### `get(String key)` → `Object` | ||
|
||
Returns the cached value for the specified key, or `null` if the specified key does not exist in the cache | ||
|
||
####### Parameters | ||
|
||
| Param | Description | | ||
| ----- | ---------------------------------------------- | | ||
| `key` | The `String` key to check for within the cache | | ||
|
||
####### Return | ||
|
||
**Type** | ||
|
||
Object | ||
|
||
**Description** | ||
|
||
The cached value, or null if no cached value is found for the specified key | ||
|
||
###### `put(String key, Object value)` → `void` | ||
|
||
Adds the provided `Object` value to the cache, using the specified `String` key | ||
|
||
####### Parameters | ||
|
||
| Param | Description | | ||
| ------- | ------------------------------------------------- | | ||
| `key` | The `String` key to add to the cache | | ||
| `value` | The `Object` value to cache for the specified key | | ||
|
||
###### `remove(String key)` → `void` | ||
|
||
Removes the specified `String` key from the cache | ||
|
||
####### Parameters | ||
|
||
| Param | Description | | ||
| ----- | ----------------------------------------- | | ||
| `key` | The `String` key to remove from the cache | | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.