8 use \Magento\Framework\HTTP\ZendClient;
71 if (empty($this->eventsUrl)) {
72 $accountId = $this->config->getNewRelicAccountId();
73 if (empty($accountId)) {
74 throw new \Magento\Framework\Exception\LocalizedException(
__(
75 'No New Relic Application ID configured, cannot continue with Cron Event reporting' 78 $this->eventsUrl = sprintf(
79 $this->config->getInsightsApiUrl(),
93 if (!isset($this->request)) {
94 $this->request = $this->clientFactory->create();
96 $insertKey = $this->config->getInsightsInsertKey();
99 $this->request->setHeaders(
101 'X-Insert-Key' => $insertKey,
102 'Content-Type' =>
'application/json',
117 'eventType' =>
'Cron',
118 'appName' => $this->config->getNewRelicAppName(),
119 'appId' => $this->config->getNewRelicAppId(),
121 $jsonArrayKeys = array_keys($json);
123 foreach ($jsonArrayKeys as $jsonKey) {
124 if (array_key_exists($jsonKey, $this->customParameters)) {
125 unset($this->customParameters[$jsonKey]);
129 $json = array_merge($json, $this->customParameters);
131 return $this->jsonEncoder->encode($json);
142 $this->customParameters = array_merge($this->customParameters,
$data);
__construct(\Magento\NewRelicReporting\Model\Config $config, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Framework\HTTP\ZendClientFactory $clientFactory)