Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReportConcurrentAdminsToNewRelic.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
21  protected $config;
22 
27 
31  protected $newRelicWrapper;
32 
38  public function __construct(
40  \Magento\Backend\Model\Auth\Session $backendAuthSession,
42  ) {
43  $this->config = $config;
44  $this->backendAuthSession = $backendAuthSession;
45  $this->newRelicWrapper = $newRelicWrapper;
46  }
47 
55  public function execute(Observer $observer)
56  {
57  if ($this->config->isNewRelicEnabled()) {
58  if ($this->backendAuthSession->isLoggedIn()) {
59  $user = $this->backendAuthSession->getUser();
60  $this->newRelicWrapper->addCustomParameter(Config::ADMIN_USER_ID, $user->getId());
61  $this->newRelicWrapper->addCustomParameter(Config::ADMIN_USER, $user->getUserName());
62  $this->newRelicWrapper->addCustomParameter(
64  $user->getFirstName() . ' ' . $user->getLastName()
65  );
66  }
67  }
68  }
69 }
$user
Definition: dummy_user.php:13
__construct(Config $config, \Magento\Backend\Model\Auth\Session $backendAuthSession, NewRelicWrapper $newRelicWrapper)