Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add telemetry logging support to Trigger Actions Framework#182

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ssk42 wants to merge1 commit intomitchspano:main
base:main
Choose a base branch
Loading
fromssk42:feature/176-telemetry-logging

Conversation

ssk42
Copy link

Summary

Implements a pluggable telemetry logging system for the Trigger Actions Framework to track Salesforce limits and performance metrics during trigger action execution. This feature addresses issue#176 by providing developers with debugging and performance monitoring capabilities.

Key Features

  • ITriggerActionTelemetryLogger interface for pluggable telemetry implementations
  • Default LimitLogger implementation tracking SOQL queries, DML statements, CPU time, and heap usage
  • TelemetryContext class providing execution metadata (action class, operation, sObject type, record count)
  • Enable_Telemetry__c checkbox field to enable/disable telemetry per trigger action
  • Telemetry_Logger_Class__c text field to specify custom logger implementations
  • Namespace-aware permission checking for improved package compatibility

Implementation Details

  • Telemetry logging occurs at START and FINISH phases of trigger action execution
  • Graceful fallback to LimitLogger if custom logger class fails to instantiate
  • Debug-level logging for minimal performance impact
  • Comprehensive test coverage with all 147 tests passing
  • Compatible with existing trigger actions without requiring changes

Testing

  • ✅ All existing tests continue to pass (147/147)
  • ✅ New test classes added for LimitLogger and telemetry functionality
  • ✅ Successfully deployed to scratch org without issues
  • ✅ Namespace safety validated with permission checking enhancements

Usage Example

// Enable telemetry in Custom Metadata TypeTrigger_Action__mdtmyAction=newTrigger_Action__mdt(Apex_Class_Name__c='MyTriggerAction',Enable_Telemetry__c=true,Telemetry_Logger_Class__c='LimitLogger'// Optional, defaults to LimitLogger);

Sample debug output:

[START] BEFORE_INSERT on Account.MyTriggerAction (5 records) - Queries: 0/100, DML: 0/150, CPU: 12/10000ms, Heap: 2048/6000000bytes[FINISH] BEFORE_INSERT on Account.MyTriggerAction (5 records) - Queries: 2/100, DML: 0/150, CPU: 45/10000ms, Heap: 3072/6000000bytes

Test plan

  • All existing tests pass (147/147 tests)
  • New telemetry functionality properly tested
  • Scratch org deployment successful
  • No breaking changes to existing functionality
  • Telemetry can be enabled/disabled per trigger action
  • Custom logger classes can be specified and fall back gracefully
  • Namespace-aware permission checking works correctly

🤖 Generated withClaude Code

Implement pluggable telemetry logging system to track Salesforce limits and performance metrics during trigger action execution. This feature helps with debugging and performance monitoring in development environments.Key Features:- ITriggerActionTelemetryLogger interface for pluggable telemetry implementations- Default LimitLogger implementation tracking SOQL, DML, CPU, and heap limits- TelemetryContext providing execution metadata (action, operation, sObject, record count)- Enable_Telemetry__c checkbox field to enable/disable telemetry per trigger action- Telemetry_Logger_Class__c field to specify custom logger implementations- Namespace-aware permission checking for better package compatibility- Comprehensive test coverage with 147 tests passingImplementation Details:- Telemetry logging occurs at START and FINISH phases of trigger action execution- Graceful fallback to LimitLogger if custom logger class fails to instantiate- Debug-level logging for minimal performance impact- Not recommended for production environmentsClosesmitchspano#176🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
@google-claGoogle CLA
Copy link

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View thisfailed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@ssk42

[8]ページ先頭

©2009-2025 Movatter.jp