PHP Agent Request Queuing incorrect when delaying call to newrelic_set_appname()

I’ve been trying to figure out a peculiar issue with our APM reporting for request_queuing. We were seeing 30ms or so for a Magento application and around 1-2ms for a drupal application, however doing some debugging there was no queuing going on between nginx and php-fpm (a microtime(true) comparison at the top of a php file reported almost identical timestamps, ~ 1ms).

Looking into it further I noticed with Magento we set the app name via the API after we’ve booted the magento framework, and before any real processing occurs (in the controller_action_predispatch_checkout event). With drupal it gets the app name via .ini configuration.

So logging microtime(true) calls in the observer that was setting app name in magento, we had a comparable request queueing time with the microtime(true) - request_start times.

Moving set_application_name to the top of the magento entry point file (index.php) and request queuing went down to 1ms.

So I just want to understand is this behaviour by design, or is it a bug? I can work around it obviously, but it seemed counter intuitive to me.

New Relic Version => (“saffron” - “a09db6f6e5a0”)
PHP 7.2.32 (built: Jul 7 2020 19:40:19) ( NTS )
CentOS Linux release 8.2.2004 & Ubuntu 18.04.4 LTS