newrelic / node-newrelic

New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
Apache License 2.0
969 stars 398 forks source link

Fastify transaction naming #974

Closed ISulimanov closed 2 years ago

ISulimanov commented 2 years ago

Description

According to https://github.com/newrelic/node-newrelic/pull/354 , if I understand correct we should have proper transactions name.

Expected Behavior

All transactions have proper name on Transactions page

Actual Begavior

All transactions have * instead of name

image

Steps to Reproduce

Your Environment

Node.js version | v16.13.0 OS version | Windows 10.0.18362 NodeJs Agent | 8.5.2

bizob2828 commented 2 years ago

@ISulimanov I cannot reproduce. I see transactions just fine.

screenshot 2021-11-11 at 10 23 51 AM

The steps I took:

If you're still having trouble it might be best to go through our support team so they can ask for logs and help troubleshoot deeper.

jungRoit commented 2 years ago

I'm facing the same error @ISulimanov @bizob2828. What steps did you take to get it to work as intended?

rwojsznis commented 2 years ago

Samies, I'm using this approach regarding separating concerns - any chance it's related? 🤔

fastify 3.28.0, node v16.14.2, newrelic 8.14.1

edit: before even submitting comment I'm going to answer my own question - it's seems like that's the case. @jungRoit - given example linked above, if have something like:

const server = require('./app')({
  logger: {
    level: 'info',
    transport: {
      target: 'pino-pretty'
    }
  }
})

can you try wrapping server in newrelic as follows:

newrelic.instrumentLoadedModule(
  'fastify',
  server
);

and let me know if it helped? documentation mentions wrapping required fastify module, but I think when you separate concerns it doesn't work as expected - just a guess, I didn't looked into source code, nor I work with node on daily basis (and I'm grateful for that 😆 )