When the asynchronous function is invoked, wrap the callback in a closure that will restore context before executing the original re entry code

I just read the NewRelic documentation about the Context Preservation and they have this statement which I don't understand:

When the asynchronous function is invoked, wrap the callback in a closure that will restore context before executing the original re entry code.

ref: https://github.com/newrelic/node-newrelic/blob/master/examples/shim/Context-Preservation.md

Is anybody here can explain in details this statement ? Maybe a sample code would be appreciated. Thanks you so much.

Hi and welcome to the Elastic APM forum.

I think you have posted your question in the wrong forum, however. Elastic is not affiliated with NewRelic.

Cheers,
Felix

Hi @d3v0ps

As my colleague Felix mentioned, then this is probably not the right forum to ask about New Relic :wink:

That being said, I'm one of the developers of the Elastic APM Node.js Agent, and I'll be happy to answer any questions you might have related to that if you should ever want to try it out :slight_smile:

Read more about Elastic APM here: https://www.elastic.co/solutions/apm

Best,
Thomas

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.