Newrelic for php shows "Application code" without any possibility to inspect it

Hello,

Currently we are using newrelic transactions for debugging performance issues in our application. Unfortunately we can’t get information about part of transaction, which consume the biggest amount of time because all what we see is 5,550 97.85% Application code (in …). I’ve added newrelic_add_custom_tracer for required method, but it does not change anything.

What could I do next?

Newrelic version: 9.10.0.262 (“quinoa” - “2d7c0e53f0c9”) but it was also in previous version

PHP 7.3.17-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Apr 19 2020 07:44:05) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.3.17, Copyright © 1998-2018 Zend Technologies with Zend OPcache v7.3.17-1+ubuntu16.04.1+deb.sury.org+1, Copyright © 1999-2018, by Zend Technologies

[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gearman
gettext
hash
iconv
igbinary
intl
json
libxml
mbstring
mongodb
newrelic
openssl
pcntl
pcre
PDO
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tideways
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

newrelic.transaction_tracer.detail => 1 => 1

OS: Ubuntu 16.04.6 LTS

Thank you in advance.

Hi @v.khramtsov

Could you send me the permalink to the one of the mentioned transactions?

To create a permalink to the right app, scroll to the bottom and click ‘Permalink ∞’ all the way on the right next to ‘Kiosk Mode.’ This will show us the exact page and time period that you are observing.

thanks,

Rodrigo

Hi Rodrigo,

Here comes permalink to latest transaction like this: https://rpm.newrelic.com/accounts/67283/applications/289011555/transactions?tw[end]=1589207573&tw[start]=1589196773#id=5b225765625472616e73616374696f6e2f416374696f6e2f64656661756c742f746573742d7265706f72742f637265617465222c22225d&tab-detail_551eb59b-937d-11ea-9ccd-0242ac110009_2969_6076=trace_details&app_trace_id=551eb59b-937d-11ea-9ccd-0242ac110009_2969_6076

Thank you in advance,
Vladimir

@v.khramtsov thanks for sharing that. It looks like you’ll need to add some custom instrumentation to your code. We have a helpful Guide to using the PHP agent API that is a good root node explaining the various functions you’d add to your code for greater visibility.

In particular, you may want to leverage newrelic_add_custom_tracer to add instrumentation to the functions/methods in that piece of application code.

@scandela thanks for suggestion.

I’m calling this method with name of controller action, but have the same situation as before. Should I configure custom tracer for all functions to get proper data or just for top level function only?

Configuring tracer for all functions means that I have to do performance investigation by hands, but I would like to use newrelic functionality for it.

Thanks in advance.

@v.khramtsov personally, I would take the low-hanging-fruit approach of instrumenting the top-level function with newrelic_add_custom_tracer first to see whether it shows enough useful information, then go from there.

Let us know how it goes!

Unfortunately I cannot make it work. I added call of newrelic_add_custom_tracer with name of method that I want to inspect in method, called from contructor of this class, but no luck. Later, this class call another class using wrapper and magic __call, so I ask newrelic module to inspect two methods of real class which make all job. Unfortunately no additional information appears. I’m still see “Application code (in …” here https://rpm.newrelic.com/accounts/67283/applications/289011555/transactions?tw[end]=1590041801&tw[start]=1589998601#id=5b225765625472616e73616374696f6e2f416374696f6e2f64656661756c742f746573742d7265706f72742f637265617465222c22225d&app_trace_id=db5e5716-9acb-11ea-b2ff-0242ac110008_0_3099&tab-detail_db5e5716-9acb-11ea-b2ff-0242ac110008_0_3099=trace_details

What could I do next?

@v.khramtsov sorry to hear that you’re still having trouble. If possible, would you be able to share some code snippets of how you are instrumenting the functions in question?

I don’t want to share any code in public. Could we do this privately? Also I need to add some explanations because of application structre.
Thank you in advance.

@v.khramtsov - Yes of course! I got a ticket opened up for you - you should see that in your email inbox now. Please do add any detail you can to that :slight_smile: Thanks!

Got it. I’m going to add additional information to this ticket

1 Like

Thank you! Please do post back here in this thread when that ticket reaches a solution. I among others are eager to hear what solves this for you :smiley:

Hello once again,

Problem was in call of newrelic_end_of_transaction() at the end of request

1 Like

Thanks for coming back in to let us know :smiley: