-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Add the ability to log and display function arguments alongside performance metrics to help users correlate slow function executions with specific inputs.
Use Case
As highlighted by a user: "For example, say you call a function several times and of of the executions runs several times as long. You'd probably want to present that invocation's arguments directly with the function when logging so the association is more obvious."
This would be particularly valuable when:
- The same function is called multiple times with different arguments
- Some invocations are significantly slower than others
- Developers need to identify which specific inputs cause performance issues
Proposed Implementation
Several possible approaches:
-
Extend tracking methods:
- Add an option to
track()andcreateTrackable()to capture function arguments - Example:
tracePerf.track(myFunction, { captureArgs: true })
- Add an option to
-
Include in execution records:
- Store argument values in execution records
- Display them in the execution flow chart
-
Argument filtering:
- Allow users to specify which arguments to capture (for privacy or to avoid logging large objects)
- Example:
tracePerf.track(myFunction, { captureArgs: ['id', 'limit'] })
-
Argument transformation:
- Provide hooks to transform arguments before logging (e.g., to mask sensitive data)
Considerations
- Performance impact: Capturing and storing arguments could add overhead
- Memory usage: Large arguments could significantly increase memory usage
- Privacy: Need to be careful about logging sensitive information
- Circular references: Need to handle circular references in arguments
Questions
- Should we limit the depth of object serialization?
- Should we have a max size limit for captured arguments?
- Should we provide a way to filter or transform arguments before logging?
Related Features
- This could be extended to also capture return values for even more comprehensive debugging
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request