config = $config; $this->customerSession = $customerSession; $this->customerRepository = $customerRepository; $this->storeManager = $storeManager; $this->newRelicWrapper = $newRelicWrapper; } /** * Adds New Relic custom parameters per request for store, website, and logged in user if applicable * * @param Observer $observer * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function execute(Observer $observer) { if ($this->config->isNewRelicEnabled()) { $this->newRelicWrapper->addCustomParameter(Config::STORE, $this->storeManager->getStore()->getName()); $this->newRelicWrapper->addCustomParameter(Config::WEBSITE, $this->storeManager->getWebsite()->getName()); if ($this->customerSession->isLoggedIn()) { $customer = $this->customerRepository->getById($this->customerSession->getCustomerId()); $this->newRelicWrapper->addCustomParameter(Config::CUSTOMER_ID, $customer->getId()); $this->newRelicWrapper->addCustomParameter( Config::CUSTOMER_NAME, $customer->getFirstname() . ' ' . $customer->getLastname() ); } } } }