-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hi,
Currently, the ContinuousProfiler includes profile processing functionality. We propose extending this capability to the Express middleware by introducing a configuration option that utilizes the processProfile utility function.
Key points:
-
New Configuration Option:
- Introduce a config option in the Express middleware to enable profile processing.
- This would leverage the existing
processProfileutility function.
-
Documentation Update:
- The current documentation for pull mode with Express middleware is incomplete.
- The NodeJS SDK documentation only mentions pull mode with Grafana Alloy or Grafana Agent.
- We should add detailed instructions for using pull mode with Express middleware.
-
Improved Function Naming:
- This feature would be particularly beneficial for scenarios involving anonymous functions.
- Instead of generic "anonymous function" labels in the profile output, users would see filenames, enhancing debuggability.
- This improvement is inspired by the discussion in issue Restore fileName to anonymous function names #84.
-
Real-world Use Case:
-
Our team encountered this need and believes it could be generally useful.
-
As a temporary solution, we patched the middleware to call the
processProfileutility function:async function collectProfile(profiler) { const profile = profiler.profile().profile; const processedProfile = processProfile(profile) profiler.stop(); return encode(processedProfile); }
-
This workaround functions correctly with pull mode.
-
By implementing this feature, we can enhance the profiling capabilities of the Express middleware, providing more detailed and useful information to users, especially in scenarios involving anonymous functions.
I am more than happy to implement this feature and contribute to the project if needed. Thanks