Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Feature Idea: Adding Traces for Promise chain



Please paste the [permalink][1] to the page in question below:[end]=1510320412&tw[start]=1510318612&type=app#id=5b225765625472616e73616374696f6e2f437573746f6d2f2f6e6f766f7374692f6e612d6f646e6f692d697a2d726f73736969736b696b682d646f726f672d706f796176696c61732d7a656272612d646c79612d7375736c696b6f762d30352d30362d323031372e68746d222c22225d

Please share your agent version and other relevant versions below:

“newrelic”: “^2.3.2”,

Please share your question/describe your issue below. Include any screenshots that may help us understand your question:

I’am trying to add traces for my WebTransaction. Below is my code:

return newrelic.startWebTransaction(url, () => {
    return Promise
      .resolve({ ctx, context: {} })
      .then(newrelic.createTracer('node:resolveRouteParams', resolveRouteParams))
      .then(newrelic.createTracer('node:resolveDataProviders', resolveDataProviders))
      .then(newrelic.createTracer('node:resolveRouter', resolveRouter))
      .then(skipIfNeeded(newrelic.createTracer('node:renderApp', renderApp)))
      .then(skipIfNeeded(newrelic.createTracer('node:resolveAssets', resolveAssets)))
      .then(skipIfNeeded(newrelic.createTracer('node:renderPage', renderPage)))
      .then(newrelic.createTracer('node:handleRouterStatus', handleRouterStatus));

Traces appears on dashbord, but look like Avg time for each trace include all previous promises in chain.

How to display them separately?

New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.


@a.pshenkin createTracer() was designed to instrument callbacks rather than promises. When trying to instrument multiple .then() calls all wrapped in tracers, they’d all start near the same time then end when the functions are actually called, which is why you are seeing similar times for each of these segments. Thanks for describing your use case for createTracer()! @Linds will open up a feature idea poll for instrumentation of promises with createTracer.