Also copy function name
Opened this issue · 2 comments
I ran into this when doing Datadog tracing with this library enabled. The function name just shows up as newFn
in the Datadog APM trace view which isn't very helpful. Instead it would be good to copy the name
property from the internal function the same way you copy the length
value currently (with Object.defineProperty), then it would show up as cookieParser
or compression
or whatever instead of newFn
.
@kevinburkenotion newFn
is a bit silly name but that's just a wrapper calling original middleware
and/or param
so you should see both in your callstack? 🤔
Copying function name over would made it pop up twice inside trace and I can't recall any library doing that because that could easily confuse people... 🤔
For example here is what vuex
's mapActions
does:
https://github.com/vuejs/vuex/blob/c92cef3/src/helpers.js#L85-L94
(I took example from different side of spectrum but still, wrapping is wrapping no matter where it happens 😉)
Same issue here with Datadog's APM... would really like #17 to happen.