Closed rightaway closed 1 year ago
I'm curious, can you share an example where this becomes problematic? I agree it's not a great hack, but it seems like the most reliable way to determine when the agent should be in http
vs. https
mode. In the past, this module monkey patched https.request
, which was less ideal IMO.
It's for using the stack trace to get metadata that can be used in development tools. Could it default to whichever agent type is more common http or https, and a config setting can be passed to change it if necessary?
I'd be down to accept a PR adding a config option to make an agent instance be explicitly "locked" for use with either http
or https
.
This depends on default stack trace output
https://github.com/TooTallNate/node-agent-base/blob/0288bc26f856dd0473a2923241dfbf1ab67b99b0/src/index.ts#L18
With
Error.prepareStackTrace
https://v8.dev/docs/stack-trace-api#customizing-stack-traces there's no guarantee about its format or that it is even a string. Official v8 docs say that "User stack trace formatters are free to format the stack trace however they want and even return non-string values"https://github.com/TooTallNate/node-agent-base/issues/63