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 more fields on LogEntryEvent__e, Log__c, and LogEntry__c #503

Merged
merged 11 commits into from
Jun 5, 2023

Conversation

jongpie
Copy link
Owner

@jongpie jongpie commented Jun 1, 2023

This PR is focused on automatically capturing & storing some new data points (in a few different areas) that provide additional context for monitoring & reporting.

Logging in Lightning Components: New "Browser Details" fields on LogEntry__c

  • Resolved Track additional UI details #225 by updating the logger LWC (logEntryBuilder.js mostly) to capture details about the user's browser & screen. These details are automatically now stored in these new fields on LogEntryEvent__e and LogEntry__c:

    New Fields Source of Data
    LogEntryEvent__e.BrowserFormFactor__c and LogEntry__c.BrowserFormFactor__c The value of FORM_FACTOR, imported using import FORM_FACTOR from '@salesforce/client/formFactor';
    LogEntryEvent__e.BrowserLanguage__c and LogEntry__c.BrowserLanguage__c The value of window.navigator.language
    LogEntryEvent__e.BrowserScreenResolution__c and LogEntry__c.BrowserScreenResolution__c The value of window.screen.availWidth + ' x ' + window.screen.availHeight
    LogEntryEvent__e.BrowserUrl__c and LogEntry__c.BrowserUrl__c The value of window.location.href
    LogEntryEvent__e.BrowserUserAgent__c and LogEntry__c.BrowserUserAgent__c The value of window.navigator.userAgent
    LogEntryEvent__e.BrowserWindowResolution__c and LogEntry__c.BrowserWindowResolution__c The value of window.innerWidth + ' x ' + window.innerHeight

Logging in Flow: New Flow Metadata fields on LogEntry__c

  • Resolved Capture more fields from FlowDefinitionView #451 by capturing some additional details about the running Flow via the object FlowDefinitionView. These details are automatically now stored in these new fields:

    New Fields Source of Data
    LogEntry__c.FlowRecordTriggerType__c The value of FlowDefinitionView.RecordTriggerType
    LogEntry__c.FlowTriggerOrder__c The value of FlowDefinitionView.TriggerOrder
    LogEntry__c.FlowTriggerSObjectType__c The value of FlowDefinitionView.TriggerObjectOrEvent.QualifiedApiName

Organization Details: New & Deprecated fields on LogEntryEvent__e and Log__c

  • "Renamed" (by creating new fields) some fields on LogEntryEvent__e and Log__c to have a more consistent naming convention. Note that the old fields are still included in the core package and are still populated so that orgs have time to update any existing reporting, etc. Eventually, the old fields will be fully removed from the package.

    Field Change Source of Data
    Deprecated Log__c.ApiReleaseNumber__c and replaced it with Log__c.OrganizationReleaseNumber__c Retrieved via the optional callout to https://api.status.salesforce.com
    Deprecated Log__c.ApiReleaseVersion__c and replaced it with Log__c.OrganizationReleaseVersion__c Retrieved via the optional callout to https://api.status.salesforce.com
    Deprecated LogEntryEvent__e.ApiVersion__c and Log__c.ApiVersion__c and replaced them with LogEntryEvent__e.OrganizationApiVersion__c and Log__c.OrganizationApiVersion__c The value of Logger.getOrganizationVersion()
    Added new field Log__c.OrganizationLocation__c Retrieved via the optional callout to https://api.status.salesforce.com

Logger Engine Changes

  • Made some internal changes to the logger LWC so that the JavaScript code's approach more closely aligns with the Apex code's approach. This should not have any functional changes (hopefully 😅), this is just to try to provide a little more consistency within the codebase for approaching the same goal (logging) in 2 different languages (Apex & JavaScript).

    Item In Apex In JavaScript
    Object used to store in-memory logging data LogEntryEvent__e object ComponentLogEntry inner class in logEntryBuilder.js
    Internal method used to access/update in-memory logging data Instance method LogEntryEventBuilder.getLogEntryEvent() Instance method LogEntryEventBuilder.getComponentLogEntry() in logEntryBuilder.js

Bugfixes

  • Small bugfix for logging in Flow: Added an extra guard clause in the private instance method LogEntryHandler.setFlowDefinitionFields() to prevent a possible NullPointerException. Previously, the code assumed that when OriginLocation__c == 'Flow', then OriginLocation__c would be the API name of the logging Flow. However, this may not always be the case, especially since the invocable actions currently rely on admins/devs to provide the Flow's API name, which is inherently an imperfect approach - but there isn't currently a way in Apex or Flow to automatically determine the Flow's API name, so the new guard clause helps avoid an exception.

jongpie added 7 commits June 1, 2023 00:00
…eVersion__c to OrganizationReleaseNumber__c and OrganizationReleaseVersion__c, added new field Log__c.OrganizationLocation__c
…s where OriginLocation__c is not a valid Flow API name
…iggerOrder__c, and FlowTriggerSObjectType__c
…ction, getComponentLogEntry()

This makes the JavaScript code (logEntryBuilder.js + ComponentLogEntry) better align with the Apex equivalent code (LogEntryEventBuilder and LogEntryEvent__e)
@jongpie jongpie added Type: Enhancement New feature or request Salesforce Feature: Reporting Anything related to reports, dashboards, and the underlying data model Logging Source: Flow Items related to using Nebula Logger within Flow Logging Source: Lightning Components Items related to using Nebula Logger using JavaScript within lightning components (lwc & aura) Layer: Log Management Items related to the custom objects & Logger Console app labels Jun 1, 2023
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org June 1, 2023 13:12 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Base Scratch Org June 1, 2023 13:12 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org June 1, 2023 13:15 — with GitHub Actions Failure
@jongpie jongpie had a problem deploying to Base Scratch Org June 1, 2023 13:15 — with GitHub Actions Failure
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org June 1, 2023 15:16 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Base Scratch Org June 1, 2023 15:16 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org June 1, 2023 15:25 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org June 1, 2023 15:38 — with GitHub Actions Inactive
…yEvent__e.OrganizationApiVersion__c, finished some backend changes for several related field deprecations
@jongpie jongpie force-pushed the feature/more-log-and-log-entry-fields branch from f61c037 to 128fdc7 Compare June 1, 2023 18:24
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org June 1, 2023 18:28 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Base Scratch Org June 1, 2023 18:28 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org June 1, 2023 18:37 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org June 1, 2023 18:54 — with GitHub Actions Inactive
@jongpie jongpie changed the title Added more fields on Log__c and LogEntry__c Added more fields on LogEntryEvent__e, Log__c and LogEntry__c Jun 1, 2023
@jongpie jongpie marked this pull request as ready for review June 1, 2023 19:18
@jongpie jongpie changed the title Added more fields on LogEntryEvent__e, Log__c and LogEntry__c Added more fields on LogEntryEvent__e, Log__c, and LogEntry__c Jun 1, 2023
@jongpie jongpie force-pushed the feature/more-log-and-log-entry-fields branch from 0827c56 to 157b2d1 Compare June 1, 2023 20:22
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org June 1, 2023 20:26 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Base Scratch Org June 1, 2023 20:26 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org June 1, 2023 20:33 — with GitHub Actions Inactive
@jongpie jongpie temporarily deployed to Demo Org June 1, 2023 20:45 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Patch coverage: 98.68% and project coverage change: -0.13 ⚠️

Comparison is base (8db89d0) 95.07% compared to head (157b2d1) 94.94%.

❗ Current head 157b2d1 differs from pull request most recent head 75bc462. Consider uploading reports for the commit 75bc462 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #503      +/-   ##
==========================================
- Coverage   95.07%   94.94%   -0.13%     
==========================================
  Files          59       59              
  Lines        5944     5994      +50     
  Branches      129      129              
==========================================
+ Hits         5651     5691      +40     
- Misses        288      298      +10     
  Partials        5        5              
Flag Coverage Δ
Apex 95.49% <96.87%> (+<0.01%) ⬆️
LWC 92.08% <100.00%> (-0.75%) ⬇️

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

Impacted Files Coverage Δ
...g-management/classes/LogManagementDataSelector.cls 99.00% <ø> (ø)
...-management/classes/LoggerHomeHeaderController.cls 100.00% <ø> (ø)
...re/main/log-management/classes/LogEntryHandler.cls 92.85% <80.00%> (-0.34%) ⬇️
...in/log-management/classes/LogEntryEventHandler.cls 90.30% <100.00%> (+0.25%) ⬆️
...ore/main/logger-engine/classes/ComponentLogger.cls 98.42% <100.00%> (+0.19%) ⬆️
...-logger/core/main/logger-engine/classes/Logger.cls 96.10% <100.00%> (-0.01%) ⬇️
...e/main/logger-engine/lwc/logger/logEntryBuilder.js 88.50% <100.00%> (-9.91%) ⬇️
...ogger/core/main/logger-engine/lwc/logger/logger.js 100.00% <100.00%> (ø)
...ore/main/logger-engine/lwc/logger/loggerService.js 88.88% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jongpie jongpie merged commit 36f7440 into main Jun 5, 2023
@jongpie jongpie deleted the feature/more-log-and-log-entry-fields branch June 5, 2023 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layer: Log Management Items related to the custom objects & Logger Console app Logging Source: Flow Items related to using Nebula Logger within Flow Logging Source: Lightning Components Items related to using Nebula Logger using JavaScript within lightning components (lwc & aura) Salesforce Feature: Reporting Anything related to reports, dashboards, and the underlying data model Type: Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Capture more fields from FlowDefinitionView Track additional UI details
2 participants